当前位置: 首页>>代码示例>>C#>>正文


C# Customer.IsGuest方法代码示例

本文整理汇总了C#中Nop.Core.Domain.Customers.Customer.IsGuest方法的典型用法代码示例。如果您正苦于以下问题:C# Customer.IsGuest方法的具体用法?C# Customer.IsGuest怎么用?C# Customer.IsGuest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nop.Core.Domain.Customers.Customer的用法示例。


在下文中一共展示了Customer.IsGuest方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckDiscountLimitations

        /// <summary>
        /// Checks discount limitation for customer
        /// </summary>
        /// <param name="discount">Discount</param>
        /// <param name="customer">Customer</param>
        /// <returns>Value indicating whether discount can be used</returns>
        protected virtual bool CheckDiscountLimitations(Discount discount, Customer customer)
        {
            if (discount == null)
                throw new ArgumentNullException("discount");

            switch (discount.DiscountLimitation)
            {
                case DiscountLimitationType.Unlimited:
                    {
                        return true;
                    }
                case DiscountLimitationType.NTimesOnly:
                    {
                        var totalDuh = GetAllDiscountUsageHistory(discount.Id, null, null, 0, 1).TotalCount;
                        return totalDuh < discount.LimitationTimes;
                    }
                case DiscountLimitationType.NTimesPerCustomer:
                    {
                        if (customer != null && !customer.IsGuest())
                        {
                            //registered customer
                            var totalDuh = GetAllDiscountUsageHistory(discount.Id, customer.Id, null, 0, 1).TotalCount;
                            return totalDuh < discount.LimitationTimes;
                        }
                        else
                        {
                            //guest
                            return true;
                        }
                    }
                default:
                    break;
            }
            return false;
        }
开发者ID:haithemChkel,项目名称:nopCommerce_33,代码行数:41,代码来源:DiscountService.cs

示例2: IsCustomerAllowedToSetTopicPriority

        /// <summary>
        /// Check whether customer is allowed to set topic priority
        /// </summary>
        /// <param name="customer">Customer</param>
        /// <returns>True if allowed, otherwise false</returns>
        public virtual bool IsCustomerAllowedToSetTopicPriority(Customer customer)
        {
            if (customer == null)
            {
                return false;
            }

            if (customer.IsGuest())
            {
                return false;
            }

            if (IsForumModerator(customer))
            {
                return true;
            }            

            return false;
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:24,代码来源:ForumService.cs

示例3: IsCustomerAllowedToSubscribe

        /// <summary>
        /// Check whether customer is allowed to watch topics
        /// </summary>
        /// <param name="customer">Customer</param>
        /// <returns>True if allowed, otherwise false</returns>
        public virtual bool IsCustomerAllowedToSubscribe(Customer customer)
        {
            if (customer == null)
            {
                return false;
            }

            if (customer.IsGuest())
            {
                return false;
            }

            return true;
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:19,代码来源:ForumService.cs

示例4: IsCustomerAllowedToCreatePost

        /// <summary>
        /// Check whether customer is allowed to create new post
        /// </summary>
        /// <param name="customer">Customer</param>
        /// <param name="topic">Topic</param>
        /// <returns>True if allowed, otherwise false</returns>
        public virtual bool IsCustomerAllowedToCreatePost(Customer customer, ForumTopic topic)
        {
            if (topic == null)
            {
                return false;
            }

            if (customer == null)
            {
                return false;
            }

            if (customer.IsGuest() && !_forumSettings.AllowGuestsToCreatePosts)
            {
                return false;
            }

            return true;
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:25,代码来源:ForumService.cs

示例5: IsCustomerAllowedToDeletePost

        /// <summary>
        /// Check whether customer is allowed to delete post
        /// </summary>
        /// <param name="customer">Customer</param>
        /// <param name="post">Topic</param>
        /// <returns>True if allowed, otherwise false</returns>
        public virtual bool IsCustomerAllowedToDeletePost(Customer customer, ForumPost post)
        {
            if (post == null)
            {
                return false;
            }

            if (customer == null)
            {
                return false;
            }

            if (customer.IsGuest())
            {
                return false;
            }

            if (IsForumModerator(customer))
            {
                return true;
            }

            if (_forumSettings.AllowCustomersToDeletePosts)
            {
                bool ownPost = customer.Id == post.CustomerId;
                return ownPost;
            }

            return false;
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:36,代码来源:ForumService.cs

示例6: IsCustomerAllowedToMoveTopic

        /// <summary>
        /// Check whether customer is allowed to move topic
        /// </summary>
        /// <param name="customer">Customer</param>
        /// <param name="topic">Topic</param>
        /// <returns>True if allowed, otherwise false</returns>
        public virtual bool IsCustomerAllowedToMoveTopic(Customer customer, ForumTopic topic)
        {
            if (topic == null)
            {
                return false;
            }

            if (customer == null)
            {
                return false;
            }

            if (customer.IsGuest())
            {
                return false;
            }

            if (IsForumModerator(customer))
            {
                return true;
            }

            return false;
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:30,代码来源:ForumService.cs

示例7: IsCustomerAllowedToDeleteTopic

        /// <summary>
        /// Check whether customer is allowed to delete topic
        /// </summary>
        /// <param name="customer">Customer</param>
        /// <param name="topic">Topic</param>
        /// <returns>True if allowed, otherwise false</returns>
        public virtual bool IsCustomerAllowedToDeleteTopic(Customer customer, ForumTopic topic)
        {
            if (topic == null)
            {
                return false;
            }

            if (customer == null)
            {
                return false;
            }

            if (customer.IsGuest())
            {
                return false;
            }

            if (IsForumModerator(customer))
            {
                return true;
            }

            if (_forumSettings.AllowCustomersToDeletePosts)
            {
                bool ownTopic = customer.Id == topic.CustomerId;
                return ownTopic;
            }

            return false;
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:36,代码来源:ForumService.cs

示例8: CalculateRewardPoints

        /// <summary>
        /// Calculate how much reward points will be earned/reduced based on certain amount spent
        /// </summary>
        /// <param name="customer">Customer</param>
        /// <param name="amount">Amount (in primary store currency)</param>
        /// <returns>umber of reward points</returns>
        public virtual int CalculateRewardPoints(Customer customer, decimal amount)
        {
            if (!_rewardPointsSettings.Enabled)
                return 0;

            if (_rewardPointsSettings.PointsForPurchases_Amount <= decimal.Zero)
                return 0;

            //Ensure that reward points are applied only to registered users
            if (customer == null || customer.IsGuest())
                return 0;

            var points = (int)Math.Truncate(amount / _rewardPointsSettings.PointsForPurchases_Amount * _rewardPointsSettings.PointsForPurchases_Points);
            return points;
        }
开发者ID:LaOrigin,项目名称:Leorigin,代码行数:21,代码来源:OrderTotalCalculationService.cs

示例9: IsCustomerAllowedToCreateTopic

        /// <summary>
        /// Check whether customer is allowed to create new topics
        /// </summary>
        /// <param name="customer">Customer</param>
        /// <param name="forum">Forum</param>
        /// <returns>True if allowed, otherwise false</returns>
        public virtual bool IsCustomerAllowedToCreateTopic(Customer customer, Forum forum)
        {
            if (forum == null)
            {
                return false;
            }

            if (customer == null)
            {
                return false;
            }

            if (customer.IsGuest() && !_forumSettings.AllowGuestsToCreateTopics)
            {
                return false;
            }

            if (IsForumModerator(customer))
            {
                return true;
            }

            return true;
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:30,代码来源:ForumService.cs

示例10: PrepareCustomerModelForList

 protected CustomerModel PrepareCustomerModelForList(Customer customer)
 {
     return new CustomerModel()
     {
         Id = customer.Id,
         Email = !String.IsNullOrEmpty(customer.Email) ? customer.Email : (customer.IsGuest() ? _localizationService.GetResource("Admin.Customers.Guest") : "Unknown"),
         Username = customer.Username,
         FullName = customer.GetFullName(),
         Company = customer.GetAttribute<string>(SystemCustomerAttributeNames.Company),
         Phone = customer.GetAttribute<string>(SystemCustomerAttributeNames.Phone),
         ZipPostalCode = customer.GetAttribute<string>(SystemCustomerAttributeNames.ZipPostalCode),
         CustomerRoleNames = GetCustomerRolesNames(customer.CustomerRoles.ToList()),
         Active = customer.Active,
         CreatedOn = _dateTimeHelper.ConvertToUserTime(customer.CreatedOnUtc, DateTimeKind.Utc),
         LastActivityDate = _dateTimeHelper.ConvertToUserTime(customer.LastActivityDateUtc, DateTimeKind.Utc),
     };
 }
开发者ID:nopmcs,项目名称:mycreativestudio,代码行数:17,代码来源:CustomerController.cs

示例11: Can_check_whether_customer_is_guest

        public void Can_check_whether_customer_is_guest()
        {
            var customer = new Customer();

            customer.CustomerRoles.Add(new CustomerRole
            {
                Active = true,
                Name = "Registered",
                SystemName = SystemCustomerRoleNames.Registered
            });

            customer.CustomerRoles.Add(new CustomerRole
            {
                Active = true,
                Name = "Administrators",
                SystemName = SystemCustomerRoleNames.Administrators
            });

            customer.IsGuest().ShouldBeFalse();

            customer.CustomerRoles.Add(
                new CustomerRole
                {
                    Active = true,
                    Name = "Guests",
                    SystemName = SystemCustomerRoleNames.Guests

                }
                );
            customer.IsGuest().ShouldBeTrue();
        }
开发者ID:491134648,项目名称:nopCommerce,代码行数:31,代码来源:CustomerTests.cs

示例12: PrepareCustomerModelForList

 protected CustomerModel PrepareCustomerModelForList(Customer customer)
 {
     return new CustomerModel()
     {
         Id = customer.Id,
         Email = !String.IsNullOrEmpty(customer.Email) ? customer.Email : (customer.IsGuest() ? _localizationService.GetResource("Admin.Customers.Guest") : "Unknown"),
         Username = customer.Username,
         FullName = customer.GetFullName(),
         //CustomerRoleNames = GetCustomerRolesNames(customer.CustomerRoles.ToList()),
         Active = customer.Active,
         //CreatedOn = _dateTimeHelper.ConvertToUserTime(customer.CreatedOnUtc, DateTimeKind.Utc),
         //LastActivityDate = _dateTimeHelper.ConvertToUserTime(customer.LastActivityDateUtc, DateTimeKind.Utc),
     };
 }
开发者ID:priceLiu,项目名称:MulitNop,代码行数:14,代码来源:VendorController.cs

示例13: PrepareCustomerModelForList

 private CustomerModel PrepareCustomerModelForList(Customer customer)
 {
     return new CustomerModel()
     {
         Id = customer.Id,
         Email = !String.IsNullOrEmpty(customer.Email) ? customer.Email : (customer.IsGuest() ? "Guest" : "Unknown"),
         Username = customer.Username,
         FullName = customer.GetFullName(),
         CustomerRoleNames = GetCustomerRolesNames(customer.CustomerRoles.ToList()),
         Active = customer.Active,
         CreatedOn = _dateTimeHelper.ConvertToUserTime(customer.CreatedOnUtc, DateTimeKind.Utc),
         LastActivityDate = _dateTimeHelper.ConvertToUserTime(customer.LastActivityDateUtc, DateTimeKind.Utc),
     };
 }
开发者ID:cmcginn,项目名称:StoreFront,代码行数:14,代码来源:CustomerController.cs

示例14: CheckDiscountLimitations

        /// <summary>
        /// Checks discount limitation for customer
        /// </summary>
        /// <param name="discount">Discount</param>
        /// <param name="customer">Customer</param>
        /// <returns>Value indicating whether discount can be used</returns>
        protected virtual bool CheckDiscountLimitations(Discount discount, Customer customer)
        {
            if (discount == null)
                throw new ArgumentNullException("discount");

            switch (discount.DiscountLimitation)
            {
                case DiscountLimitationType.Unlimited:
                    {
                        return true;
                    }
                case DiscountLimitationType.NTimesOnly:
                    {
                        var usageHistory = discount.DiscountUsageHistory;
                        return usageHistory.Count < discount.LimitationTimes;
                    }
                case DiscountLimitationType.NTimesPerCustomer:
                    {
                        if (customer != null && !customer.IsGuest())
                        {
                            //registered customer
                            var usageHistory = discount.DiscountUsageHistory
                                .Where(duh => duh.Order != null
                                    //&& !duh.Order.Deleted
                                    && duh.Order.CustomerId == customer.Id).ToList();
                            return usageHistory.Count < discount.LimitationTimes;
                        }
                        else
                        {
                            //guest
                            return true;
                        }
                    }
                default:
                    break;
            }
            return false;
        }
开发者ID:cmcginn,项目名称:StoreFront,代码行数:44,代码来源:DiscountService.cs


注:本文中的Nop.Core.Domain.Customers.Customer.IsGuest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。