當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。