public ProductPartialController( IMemberIntegralService iMemberIntegralService, IProductService iProductService, ICouponService iCouponService, IShopBonusService iShopBonusService, IArticleService iArticleService, IArticleCategoryService iArticleCategoryService, INavigationService iNavigationService, IHomeCategoryService iHomeCategoryService, IBrandService iBrandService, ICategoryService iCategoryService, ICustomerService iCustomerService, ISlideAdsService iSlideAdsService ) { _iMemberIntegralService = iMemberIntegralService; _iProductService = iProductService; _iCouponService = iCouponService; _iShopBonusService = iShopBonusService; _iArticleService = iArticleService; _iArticleCategoryService = iArticleCategoryService; _iNavigationService = iNavigationService; _iHomeCategoryService = iHomeCategoryService; _iBrandService = iBrandService; _iCategoryService = iCategoryService; _iCustomerService = iCustomerService; _iSlideAdsService = iSlideAdsService; }
public ActionResult Submit(string cartItemIds, long?regionId) { int num; int num1; dynamic obj; IOrderService orderService = ServiceHelper.Create <IOrderService>(); IMemberIntegralService memberIntegralService = ServiceHelper.Create <IMemberIntegralService>(); MemberIntegralExchangeRules integralChangeRule = memberIntegralService.GetIntegralChangeRule(); MemberIntegral memberIntegral = memberIntegralService.GetMemberIntegral(base.CurrentUser.Id); int num2 = (integralChangeRule == null ? 0 : integralChangeRule.MoneyPerIntegral); dynamic viewBag = base.ViewBag; num = (integralChangeRule == null ? 0 : integralChangeRule.IntegralPerMoney); viewBag.IntegralPerMoney = num; dynamic viewBag1 = base.ViewBag; num1 = (memberIntegral == null ? 0 : memberIntegral.AvailableIntegrals); viewBag1.Integral = num1; ViewBag.Logo = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings().Logo; ViewBag.Step = 2; ViewBag.Member = base.CurrentUser; ViewBag.cartItemIds = cartItemIds; GetOrderProductsInfo(cartItemIds, regionId); dynamic obj1 = base.ViewBag; obj = (num2 == 0 ? 0 : Math.Floor(ViewBag.totalAmount / num2)); obj1.TotalIntegral = obj; ViewBag.MoneyPerIntegral = num2; GetShippingAddress(regionId); ViewBag.InvoiceTitle = orderService.GetInvoiceTitles(base.CurrentUser.Id); ViewBag.InvoiceContext = orderService.GetInvoiceContexts(); return(View()); }
public UserInviteController(ISiteSettingService iSiteSettingService, IMemberInviteService iMemberInviteService, IMemberIntegralService iMemberIntegralService ) { _iMemberInviteService = iMemberInviteService; _iMemberIntegralService = iMemberIntegralService; _iSiteSettingService = iSiteSettingService; this._siteSetting = _iSiteSettingService.GetSiteSettings(); }
public MemberIntegralController(IMemberService iMemberService, IMemberIntegralService iMemberIntegralService, IMemberGradeService iMemberGradeService, IMemberIntegralConversionFactoryService iMemberIntegralConversionFactoryService) { _iMemberService = iMemberService; _iMemberIntegralService = iMemberIntegralService; _iMemberGradeService = iMemberGradeService; _iMemberIntegralConversionFactoryService = iMemberIntegralConversionFactoryService; }
public ScratchCardController(IBonusService iBonusService, IMemberIntegralService iMemberIntegralService) { _iBonusService = iBonusService; _iMemberIntegralService = iMemberIntegralService; var siteSetting = SiteSettingApplication.SiteSettings; if (string.IsNullOrWhiteSpace(siteSetting.WeixinAppId) || string.IsNullOrWhiteSpace(siteSetting.WeixinAppSecret)) { throw new MallException("未配置公众号参数"); } }
public SideController(IMemberIntegralService iMemberIntegralService, IProductService iProductService, IShopBonusService iShopBonusService, ICouponService iCouponService ) { _iMemberIntegralService = iMemberIntegralService; _iProductService = iProductService; _iShopBonusService = iShopBonusService; _iCouponService = iCouponService; }
// Methods public BigWheelController(IBonusService iBonusService, IMemberIntegralService iMemberIntegralService, ISiteSettingService iSiteSettingService) { this._iBonusService = iBonusService; this._iMemberIntegralService = iMemberIntegralService; this._iSiteSettingService = iSiteSettingService; this._siteSetting = this._iSiteSettingService.GetSiteSettings(); if (string.IsNullOrWhiteSpace(this._siteSetting.WeixinAppId) || string.IsNullOrWhiteSpace(this._siteSetting.WeixinAppSecret)) { throw new HimallException("未配置公众号参数"); } }
public RegisterActivityController( IMemberService iMemberService, IMemberInviteService iMemberInviteService, IMemberIntegralService iMemberIntegralService, IMemberIntegralConversionFactoryService iMemberIntegralConversionFactoryService, IBonusService iBonusService, IMessageService iMessageService ) { _iMessageService = iMessageService; _iMemberInviteService = iMemberInviteService; _iMemberIntegralService = iMemberIntegralService; }
public void AddInviteIntegel(UserMemberInfo RegMember, UserMemberInfo InviteMember) { InviteRuleInfo inviteRule = GetInviteRule(); if (inviteRule != null) { int?inviteIntegral = inviteRule.InviteIntegral; if ((inviteIntegral.GetValueOrDefault() != 0 ? true : !inviteIntegral.HasValue)) { if (!HasInviteIntegralRecord(RegMember.Id)) { IMemberIntegralConversionFactoryService create = Instance <IMemberIntegralConversionFactoryService> .Create; IMemberIntegralService memberIntegralService = Instance <IMemberIntegralService> .Create; MemberIntegralRecord memberIntegralRecord = new MemberIntegralRecord() { UserName = RegMember.UserName, MemberId = RegMember.Id, RecordDate = new DateTime?(DateTime.Now), ReMark = "被邀请注册", TypeId = MemberIntegral.IntegralType.Others }; IConversionMemberIntegralBase conversionMemberIntegralBase = create.Create(MemberIntegral.IntegralType.Others, inviteRule.RegIntegral.Value); memberIntegralService.AddMemberIntegral(memberIntegralRecord, conversionMemberIntegralBase); MemberIntegralRecord memberIntegralRecord1 = new MemberIntegralRecord() { UserName = InviteMember.UserName, MemberId = InviteMember.Id, RecordDate = new DateTime?(DateTime.Now), ReMark = "邀请会员", TypeId = MemberIntegral.IntegralType.InvitationMemberRegiste }; memberIntegralService.AddMemberIntegral(memberIntegralRecord1, create.Create(MemberIntegral.IntegralType.InvitationMemberRegiste, 0)); InviteRecordInfo inviteRecordInfo = new InviteRecordInfo() { RegIntegral = new int?(inviteRule.RegIntegral.GetValueOrDefault()), InviteIntegral = inviteRule.InviteIntegral.GetValueOrDefault(), RecordTime = new DateTime?(DateTime.Now), RegTime = new DateTime?(RegMember.CreateDate), RegUserId = new long?(RegMember.Id), RegName = RegMember.UserName, UserId = new long?(InviteMember.Id), UserName = InviteMember.UserName }; AddInviteRecord(inviteRecordInfo); } return; } } }
public RegisterActivityController( IMemberService iMemberService, ISiteSettingService iSiteSettingService, IMemberInviteService iMemberInviteService, IMemberIntegralService iMemberIntegralService, IMemberIntegralConversionFactoryService iMemberIntegralConversionFactoryService, IBonusService iBonusService, IMessageService iMessageService ) { _iMessageService = iMessageService; _iSiteSettingService = iSiteSettingService; _iMemberInviteService = iMemberInviteService; _iMemberIntegralService = iMemberIntegralService; this._siteSetting = _iSiteSettingService.GetSiteSettings(); }
public JsonResult List(int page, string userName, DateTime?startDate, DateTime?endDate, int rows) { IEnumerable <MemberGrade> memberGradeList = ServiceHelper.Create <IMemberGradeService>().GetMemberGradeList(); IMemberIntegralService memberIntegralService = ServiceHelper.Create <IMemberIntegralService>(); IntegralQuery integralQuery = new IntegralQuery() { UserName = userName, StartDate = startDate, EndDate = endDate, PageNo = page, PageSize = rows }; PageModel <MemberIntegral> memberIntegralList = memberIntegralService.GetMemberIntegralList(integralQuery); var list = from item in memberIntegralList.Models.ToList() select new { Id = item.Id, UserName = item.UserName, UserId = item.MemberId, AvailableIntegrals = item.AvailableIntegrals, MemberGrade = GetMemberGrade(memberGradeList, item.HistoryIntegrals), HistoryIntegrals = item.HistoryIntegrals, RegDate = item.Himall_Members.CreateDate.ToString("yyyy-MM-dd") }; return(Json(new { rows = list, total = memberIntegralList.Total })); }
public BranchOrderController() { _iOrderService = new OrderService(); _iCartService = new CartService(); _iMemberService = new MemberService(); _iProductService = new ProductService(); _iPaymentConfigService = new PaymentConfigService(); _iCashDepositsService = new CashDepositsService(); _iShopService = ServiceProvider.Instance<IShopService>.Create; _iLimitTimeBuyService = new LimitTimeBuyService(); _iCouponService = new CouponService(); _iShopBonusService = new ShopBonusService(); _iCollocationService = new CollocationService(); _iMemberCapitalService = new MemberCapitalService(); _iShippingAddressService = new ShippingAddressService(); _iMemberIntegralService = new MemberIntegralService(); _iRegionService = new RegionService(); _iVShopService = new VShopService(); _iRefundService = new RefundService(); _iFightGroupService = new FightGroupService(); }
public BranchOrderController() { this._iOrderService = (IOrderService) new OrderService(); this._iCartService = (ICartService) new CartService(); this._iMemberService = (IMemberService) new MemberService(); this._iProductService = (IProductService) new ProductService(); this._iPaymentConfigService = (IPaymentConfigService) new PaymentConfigService(); this._iCashDepositsService = (ICashDepositsService) new CashDepositsService(); this._iSiteSettingService = (ISiteSettingService) new SiteSettingService(); this._iShopService = (IShopService) new ShopService(); this._iLimitTimeBuyService = (ILimitTimeBuyService) new LimitTimeBuyService(); this._iCouponService = (ICouponService) new CouponService(); this._iShopBonusService = (IShopBonusService) new ShopBonusService(); this._iCollocationService = (ICollocationService) new CollocationService(); this._iMemberCapitalService = (IMemberCapitalService) new MemberCapitalService(); this._iShippingAddressService = (IShippingAddressService) new ShippingAddressService(); this._iMemberIntegralService = (IMemberIntegralService) new MemberIntegralService(); this._iRegionService = (IRegionService) new RegionService(); this._iVShopService = (IVShopService) new VShopService(); this._iRefundService = (IRefundService) new RefundService(); this._iFightGroupService = (IFightGroupService) new FightGroupService(); }
public ActionResult SubmitByProductId(string skuIds, string counts, long?regionId, string collpids = null) { int num; int num1; int num2; dynamic obj; IOrderService orderService = ServiceHelper.Create <IOrderService>(); ViewBag.Logo = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings().Logo; ViewBag.Member = base.CurrentUser; GetOrderProductsInfo(skuIds, counts, collpids); GetShippingAddress(regionId); IMemberIntegralService memberIntegralService = ServiceHelper.Create <IMemberIntegralService>(); MemberIntegralExchangeRules integralChangeRule = memberIntegralService.GetIntegralChangeRule(); MemberIntegral memberIntegral = memberIntegralService.GetMemberIntegral(base.CurrentUser.Id); dynamic viewBag = base.ViewBag; num = (integralChangeRule == null ? 0 : integralChangeRule.IntegralPerMoney); viewBag.IntegralPerMoney = num; dynamic viewBag1 = base.ViewBag; num1 = (integralChangeRule == null ? 0 : integralChangeRule.MoneyPerIntegral); viewBag1.MoneyPerIntegral = num1; dynamic obj1 = base.ViewBag; num2 = (memberIntegral == null ? 0 : memberIntegral.AvailableIntegrals); obj1.Integral = num2; dynamic viewBag2 = base.ViewBag; obj = (ViewBag.MoneyPerIntegral == 0 ? 0 : Math.Floor(ViewBag.totalAmount / ViewBag.MoneyPerIntegral)); viewBag2.TotalIntegral = obj; ViewBag.collIds = collpids; ViewBag.skuIds = skuIds; ViewBag.counts = counts; ViewBag.InvoiceTitle = orderService.GetInvoiceTitles(base.CurrentUser.Id); ViewBag.InvoiceContext = orderService.GetInvoiceContexts(); return(View("Submit")); }
public UserCommentController(ICommentService iCommentService, IMemberIntegralService iMemberIntegralService, IMemberIntegralConversionFactoryService iMemberIntegralConversionFactoryService) { _iCommentService = iCommentService; _iMemberIntegralService = iMemberIntegralService; _iMemberIntegralConversionFactoryService = iMemberIntegralConversionFactoryService; }
public IntegralRuleController(IMemberIntegralService iMemberIntegralService) { _iMemberIntegralService = iMemberIntegralService; }
public UserInviteController(IMemberInviteService iMemberInviteService, IMemberIntegralService iMemberIntegralService) { _iMemberInviteService = iMemberInviteService; _iMemberIntegralService = iMemberIntegralService; }
public UserHelper() { _iMemberService = Himall.ServiceProvider.Instance <IMemberService> .Create; _iMemberIntegralService = Himall.ServiceProvider.Instance <IMemberIntegralService> .Create; _iOrderService = Himall.ServiceProvider.Instance <IOrderService> .Create; }
public UserIntegralController(IGiftsOrderService iGiftsOrderService, IMemberIntegralService iMemberIntegralService) { _iGiftsOrderService = iGiftsOrderService; _iMemberIntegralService = iMemberIntegralService; }
private void GetOrderProductsInfo(string cartItemIds) { CartHelper cartHelper = new CartHelper(); IEnumerable <ShoppingCartItem> cartItems = null; if (!string.IsNullOrWhiteSpace(cartItemIds)) { char[] chrArray = new char[] { ',' }; IEnumerable <long> nums = from t in cartItemIds.Split(chrArray) select long.Parse(t); cartItems = ServiceHelper.Create <ICartService>().GetCartItems(nums); } else { cartItems = cartHelper.GetCart(base.CurrentUser.Id).Items; } int cityId = 0; ShippingAddressInfo defaultUserShippingAddressByUserId = ServiceHelper.Create <IShippingAddressService>().GetDefaultUserShippingAddressByUserId(base.CurrentUser.Id); if (defaultUserShippingAddressByUserId != null) { cityId = Instance <IRegionService> .Create.GetCityId(defaultUserShippingAddressByUserId.RegionIdPath); } IProductService productService = ServiceHelper.Create <IProductService>(); IShopService shopService = ServiceHelper.Create <IShopService>(); List <CartItemModel> list = cartItems.Select <ShoppingCartItem, CartItemModel>((ShoppingCartItem item) => { ProductInfo product = productService.GetProduct(item.ProductId); SKUInfo sku = productService.GetSku(item.SkuId); return(new CartItemModel() { skuId = item.SkuId, id = product.Id, imgUrl = product.GetImage(ProductInfo.ImageSize.Size_100, 1), name = product.ProductName, price = sku.SalePrice, shopId = product.ShopId, count = item.Quantity }); }).ToList(); IEnumerable <IGrouping <long, CartItemModel> > groupings = from a in list group a by a.shopId; List <ShopCartItemModel> shopCartItemModels = new List <ShopCartItemModel>(); foreach (IGrouping <long, CartItemModel> nums1 in groupings) { IEnumerable <long> nums2 = from r in nums1 select r.id; IEnumerable <int> nums3 = from r in nums1 select r.count; ShopCartItemModel shopCartItemModel = new ShopCartItemModel() { shopId = nums1.Key }; if (ServiceHelper.Create <IVShopService>().GetVShopByShopId(shopCartItemModel.shopId) != null) { shopCartItemModel.vshopId = ServiceHelper.Create <IVShopService>().GetVShopByShopId(shopCartItemModel.shopId).Id; } else { shopCartItemModel.vshopId = 0; } shopCartItemModel.CartItemModels = ( from a in list where a.shopId == shopCartItemModel.shopId select a).ToList(); shopCartItemModel.ShopName = shopService.GetShop(shopCartItemModel.shopId, false).ShopName; if (cityId > 0) { shopCartItemModel.Freight = ServiceHelper.Create <IProductService>().GetFreight(nums2, nums3, cityId); } List <ShopBonusReceiveInfo> detailToUse = ServiceHelper.Create <IShopBonusService>().GetDetailToUse(shopCartItemModel.shopId, base.CurrentUser.Id, nums1.Sum <CartItemModel>((CartItemModel a) => a.price * a.count)); List <CouponRecordInfo> userCoupon = ServiceHelper.Create <ICouponService>().GetUserCoupon(shopCartItemModel.shopId, base.CurrentUser.Id, nums1.Sum <CartItemModel>((CartItemModel a) => a.price * a.count)); if (detailToUse.Count() > 0 && userCoupon.Count() > 0) { ShopBonusReceiveInfo shopBonusReceiveInfo = detailToUse.FirstOrDefault(); CouponRecordInfo couponRecordInfo = userCoupon.FirstOrDefault(); decimal?price = shopBonusReceiveInfo.Price; decimal num = couponRecordInfo.ChemCloud_Coupon.Price; if ((price.GetValueOrDefault() <= num ? true : !price.HasValue)) { shopCartItemModel.Coupon = new CouponModel() { CouponName = couponRecordInfo.ChemCloud_Coupon.CouponName, CouponId = couponRecordInfo.Id, CouponPrice = couponRecordInfo.ChemCloud_Coupon.Price, Type = 0 }; } else { shopCartItemModel.Coupon = new CouponModel() { CouponName = shopBonusReceiveInfo.ChemCloud_ShopBonusGrant.ChemCloud_ShopBonus.Name, CouponId = shopBonusReceiveInfo.Id, CouponPrice = shopBonusReceiveInfo.Price.Value, Type = 1 }; } } else if (detailToUse.Count() <= 0 && userCoupon.Count() <= 0) { shopCartItemModel.Coupon = null; } else if (detailToUse.Count() <= 0 && userCoupon.Count() > 0) { CouponRecordInfo couponRecordInfo1 = userCoupon.FirstOrDefault(); shopCartItemModel.Coupon = new CouponModel() { CouponName = couponRecordInfo1.ChemCloud_Coupon.CouponName, CouponId = couponRecordInfo1.Id, CouponPrice = couponRecordInfo1.ChemCloud_Coupon.Price, Type = 0 }; } else if (detailToUse.Count() > 0 && userCoupon.Count() <= 0) { ShopBonusReceiveInfo shopBonusReceiveInfo1 = detailToUse.FirstOrDefault(); shopCartItemModel.Coupon = new CouponModel() { CouponName = shopBonusReceiveInfo1.ChemCloud_ShopBonusGrant.ChemCloud_ShopBonus.Name, CouponId = shopBonusReceiveInfo1.Id, CouponPrice = shopBonusReceiveInfo1.Price.Value, Type = 1 }; } decimal num1 = shopCartItemModel.CartItemModels.Sum <CartItemModel>((CartItemModel d) => d.price * d.count); decimal num2 = num1 - (shopCartItemModel.Coupon == null ? new decimal(0) : shopCartItemModel.Coupon.CouponPrice); decimal freeFreight = shopService.GetShop(shopCartItemModel.shopId, false).FreeFreight; shopCartItemModel.isFreeFreight = false; if (freeFreight > new decimal(0)) { shopCartItemModel.shopFreeFreight = freeFreight; if (num2 >= freeFreight) { shopCartItemModel.Freight = new decimal(0); shopCartItemModel.isFreeFreight = true; } } shopCartItemModels.Add(shopCartItemModel); } decimal num3 = ( from a in shopCartItemModels where a.Coupon != null select a).Sum <ShopCartItemModel>((ShopCartItemModel b) => b.Coupon.CouponPrice); ViewBag.products = shopCartItemModels; base.ViewBag.totalAmount = list.Sum <CartItemModel>((CartItemModel item) => item.price * item.count); base.ViewBag.Freight = shopCartItemModels.Sum <ShopCartItemModel>((ShopCartItemModel a) => a.Freight); dynamic viewBag = base.ViewBag; dynamic obj = ViewBag.totalAmount; viewBag.orderAmount = obj + ViewBag.Freight - num3; IMemberIntegralService memberIntegralService = ServiceHelper.Create <IMemberIntegralService>(); MemberIntegral memberIntegral = memberIntegralService.GetMemberIntegral(base.CurrentUser.Id); int num4 = (memberIntegral == null ? 0 : memberIntegral.AvailableIntegrals); ViewBag.userIntegrals = num4; ViewBag.integralPerMoney = 0; ViewBag.memberIntegralInfo = memberIntegral; MemberIntegralExchangeRules integralChangeRule = memberIntegralService.GetIntegralChangeRule(); decimal num5 = new decimal(0); decimal num6 = new decimal(0); decimal viewBag1 = (decimal)ViewBag.totalAmount; if (integralChangeRule == null || integralChangeRule.IntegralPerMoney <= 0) { num5 = new decimal(0); num6 = new decimal(0); } else { if (((viewBag1 - num3) - Math.Round((decimal)num4 / integralChangeRule.IntegralPerMoney, 2)) <= new decimal(0)) { num5 = Math.Round(viewBag1 - num3, 2); num6 = Math.Round((viewBag1 - num3) * integralChangeRule.IntegralPerMoney); } else { num5 = Math.Round((decimal)num4 / integralChangeRule.IntegralPerMoney, 2); num6 = num4; } if (num5 <= new decimal(0)) { num5 = new decimal(0); num6 = new decimal(0); } } ViewBag.integralPerMoney = num5; ViewBag.userIntegrals = num6; }
private void GetOrderProductsInfo(IEnumerable <string> skuIds, IEnumerable <int> counts) { IProductService productService = ServiceHelper.Create <IProductService>(); IShopService shopService = ServiceHelper.Create <IShopService>(); int num3 = 0; int cityId = 0; ShippingAddressInfo defaultUserShippingAddressByUserId = ServiceHelper.Create <IShippingAddressService>().GetDefaultUserShippingAddressByUserId(base.CurrentUser.Id); if (defaultUserShippingAddressByUserId != null) { cityId = Instance <IRegionService> .Create.GetCityId(defaultUserShippingAddressByUserId.RegionIdPath); } List <CartItemModel> list = skuIds.Select <string, CartItemModel>((string item) => { SKUInfo sku = productService.GetSku(item); IEnumerable <int> nums = counts; int num = num3; int num1 = num; num3 = num + 1; int num2 = nums.ElementAt <int>(num1); LimitTimeMarketInfo limitTimeMarketItemByProductId = ServiceHelper.Create <ILimitTimeBuyService>().GetLimitTimeMarketItemByProductId(sku.ProductInfo.Id); if (limitTimeMarketItemByProductId != null && num2 > limitTimeMarketItemByProductId.MaxSaleCount) { throw new HimallException(string.Concat("超过最大限购数量:", limitTimeMarketItemByProductId.MaxSaleCount.ToString())); } return(new CartItemModel() { skuId = item, id = sku.ProductInfo.Id, imgUrl = sku.ProductInfo.GetImage(ProductInfo.ImageSize.Size_100, 1), name = sku.ProductInfo.ProductName, shopId = sku.ProductInfo.ShopId, price = (limitTimeMarketItemByProductId == null ? sku.SalePrice : limitTimeMarketItemByProductId.Price), count = num2, productCode = sku.ProductInfo.ProductCode }); }).ToList(); IEnumerable <IGrouping <long, CartItemModel> > groupings = from a in list group a by a.shopId; List <ShopCartItemModel> shopCartItemModels = new List <ShopCartItemModel>(); foreach (IGrouping <long, CartItemModel> nums1 in groupings) { IEnumerable <long> nums2 = from r in nums1 select r.id; IEnumerable <int> nums3 = from r in nums1 select r.count; ShopCartItemModel shopCartItemModel = new ShopCartItemModel() { shopId = nums1.Key }; shopCartItemModel.CartItemModels = ( from a in list where a.shopId == shopCartItemModel.shopId select a).ToList(); shopCartItemModel.ShopName = shopService.GetShop(shopCartItemModel.shopId, false).ShopName; if (cityId != 0) { shopCartItemModel.Freight = ServiceHelper.Create <IProductService>().GetFreight(nums2, nums3, cityId); } List <ShopBonusReceiveInfo> detailToUse = ServiceHelper.Create <IShopBonusService>().GetDetailToUse(shopCartItemModel.shopId, base.CurrentUser.Id, nums1.Sum <CartItemModel>((CartItemModel a) => a.price * a.count)); List <CouponRecordInfo> userCoupon = ServiceHelper.Create <ICouponService>().GetUserCoupon(shopCartItemModel.shopId, base.CurrentUser.Id, nums1.Sum <CartItemModel>((CartItemModel a) => a.price * a.count)); if (detailToUse.Count() > 0 && userCoupon.Count() > 0) { ShopBonusReceiveInfo shopBonusReceiveInfo = detailToUse.FirstOrDefault(); CouponRecordInfo couponRecordInfo = userCoupon.FirstOrDefault(); decimal?price = shopBonusReceiveInfo.Price; decimal price1 = couponRecordInfo.ChemCloud_Coupon.Price; if ((price.GetValueOrDefault() <= price1 ? true : !price.HasValue)) { shopCartItemModel.Coupon = new CouponModel() { CouponName = couponRecordInfo.ChemCloud_Coupon.CouponName, CouponId = couponRecordInfo.Id, CouponPrice = couponRecordInfo.ChemCloud_Coupon.Price, Type = 0 }; } else { shopCartItemModel.Coupon = new CouponModel() { CouponName = shopBonusReceiveInfo.ChemCloud_ShopBonusGrant.ChemCloud_ShopBonus.Name, CouponId = shopBonusReceiveInfo.Id, CouponPrice = shopBonusReceiveInfo.Price.Value, Type = 1 }; } } else if (detailToUse.Count() <= 0 && userCoupon.Count() <= 0) { shopCartItemModel.Coupon = null; } else if (detailToUse.Count() <= 0 && userCoupon.Count() > 0) { CouponRecordInfo couponRecordInfo1 = userCoupon.FirstOrDefault(); shopCartItemModel.Coupon = new CouponModel() { CouponName = couponRecordInfo1.ChemCloud_Coupon.CouponName, CouponId = couponRecordInfo1.Id, CouponPrice = couponRecordInfo1.ChemCloud_Coupon.Price, Type = 0 }; } else if (detailToUse.Count() > 0 && userCoupon.Count() <= 0) { ShopBonusReceiveInfo shopBonusReceiveInfo1 = detailToUse.FirstOrDefault(); shopCartItemModel.Coupon = new CouponModel() { CouponName = shopBonusReceiveInfo1.ChemCloud_ShopBonusGrant.ChemCloud_ShopBonus.Name, CouponId = shopBonusReceiveInfo1.Id, CouponPrice = shopBonusReceiveInfo1.Price.Value, Type = 1 }; } decimal num4 = shopCartItemModel.CartItemModels.Sum <CartItemModel>((CartItemModel d) => d.price * d.count); decimal num5 = num4 - (shopCartItemModel.Coupon == null ? new decimal(0) : shopCartItemModel.Coupon.CouponPrice); decimal freeFreight = shopService.GetShop(shopCartItemModel.shopId, false).FreeFreight; shopCartItemModel.isFreeFreight = false; if (freeFreight > new decimal(0)) { shopCartItemModel.shopFreeFreight = freeFreight; if (num5 >= freeFreight) { shopCartItemModel.Freight = new decimal(0); shopCartItemModel.isFreeFreight = true; } } shopCartItemModels.Add(shopCartItemModel); } decimal num6 = ( from a in shopCartItemModels where a.Coupon != null select a).Sum <ShopCartItemModel>((ShopCartItemModel b) => b.Coupon.CouponPrice); ViewBag.products = shopCartItemModels; base.ViewBag.totalAmount = list.Sum <CartItemModel>((CartItemModel item) => item.price * item.count); base.ViewBag.Freight = shopCartItemModels.Sum <ShopCartItemModel>((ShopCartItemModel a) => a.Freight); dynamic viewBag = base.ViewBag; dynamic obj = ViewBag.totalAmount; viewBag.orderAmount = obj + ViewBag.Freight - num6; IMemberIntegralService memberIntegralService = ServiceHelper.Create <IMemberIntegralService>(); MemberIntegral memberIntegral = memberIntegralService.GetMemberIntegral(base.CurrentUser.Id); int num7 = (memberIntegral == null ? 0 : memberIntegral.AvailableIntegrals); ViewBag.userIntegrals = num7; ViewBag.integralPerMoney = 0; ViewBag.memberIntegralInfo = memberIntegral; MemberIntegralExchangeRules integralChangeRule = memberIntegralService.GetIntegralChangeRule(); decimal viewBag1 = new decimal(0); decimal viewBag2 = new decimal(0); if (integralChangeRule == null || integralChangeRule.IntegralPerMoney <= 0) { viewBag1 = new decimal(0); viewBag2 = new decimal(0); } else { if (ViewBag.totalAmount - num6 - Math.Round((decimal)num7 / integralChangeRule.IntegralPerMoney, 2) <= 0) { viewBag1 = Math.Round(ViewBag.totalAmount - num6, 2); viewBag2 = Math.Round((ViewBag.totalAmount - num6) * integralChangeRule.IntegralPerMoney); } else { viewBag1 = Math.Round((decimal)num7 / integralChangeRule.IntegralPerMoney, 2); viewBag2 = num7; } if (viewBag1 <= new decimal(0)) { viewBag1 = new decimal(0); viewBag2 = new decimal(0); } } ViewBag.integralPerMoney = viewBag1; ViewBag.userIntegrals = viewBag2; }