public ShoppingCartsController(ApplicationDbContext context, ILoggerFactory loggerFactory) { _context = context; factory = loggerFactory; logger = factory.CreateLogger <ShoppingCartsController>(); cartHelper = new ShoppingCartHelper(_context, factory.CreateLogger <ShoppingCartHelper>()); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <GuessContext>(options => options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity <IdentityUser, IdentityRole>().AddEntityFrameworkStores <GuessContext>(); services.Configure <IdentityOptions>(options => { options.Password.RequiredLength = 4; options.Password.RequireDigit = false; options.Password.RequireUppercase = false; options.Password.RequireNonAlphanumeric = false; }); //RegistretionRepository(services); RegisterDIObjects(services); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddScoped(sp => ShoppingCartHelper.GetCart(sp)); services.AddTransient(typeof(IProductRepository <Product>), typeof(ProductRepository <Product>)); services.AddTransient(typeof(IOrderRepository), typeof(OrderRepository)); services.AddSession(); services.AddMemoryCache(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); }
public async Task <ActionResult> RemoveFromCart(int id) { var cartId = new ShoppingCartHelper(this.HttpContext).GetCartId(); var cart = new Cart() { RecordId = id, CartId = cartId }; int itemCount = await apiHelper.PostAsync <Cart, int>("/api/ShoppingCart/RemoveFromCart", cart); string albumName = await apiHelper.GetAsync <string>("/api/Store/AlbumName?id=" + id); // Display the confirmation message var results = new ShoppingCartRemoveViewModel { Message = HtmlEncoder.Default.Encode(albumName) + " has been removed from your shopping cart.", CartTotal = await apiHelper.GetAsync <decimal>("/api/ShoppingCart/Total?id=" + cartId), CartCount = await apiHelper.GetAsync <int>("/api/ShoppingCart/Count?id=" + cartId), ItemCount = itemCount, DeleteId = id }; return(Json(results)); //return RedirectToAction("Index"); }
public async Task <IViewComponentResult> InvokeAsync() { var cart = new ShoppingCartHelper(this.HttpContext); var cartId = cart.GetCartId(); int cartCount = await apiHelper.GetAsync <int>("/api/ShoppingCart/Count?id=" + cartId); if (this.HttpContext.User.Identity.IsAuthenticated) { string userName = new ContextHelper().GetUsernameFromClaims(this.HttpContext); int userCartCount = await apiHelper.GetAsync <int>("/api/ShoppingCart/Count?id=" + userName); if (userName != cartId && userCartCount == 0) { CartMigration migration = new CartMigration() { SourceCartId = cartId, DestCartId = userName }; await apiHelper.PostAsync <CartMigration>("/api/ShoppingCart/MigrateCart", migration); cartCount = userCartCount; } if (cartId != userName) { cart.SetCartId(userName); cartCount = await apiHelper.GetAsync <int>("/api/ShoppingCart/Count?id=" + userName); } } ViewData["CartCount"] = cartCount; return(View()); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddAutoMapper(typeof(Startup)); services.AddControllers(setupAction => { setupAction.ReturnHttpNotAcceptable = true; setupAction.OutputFormatters.Add(new XmlDataContractSerializerOutputFormatter()); }).AddNewtonsoftJson( setupAction => { setupAction.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); } ); services.AddControllersWithViews().AddNewtonsoftJson(); services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultContext"))); services.AddRazorPages().AddNewtonsoftJson(); services.AddMvc().AddNewtonsoftJson(options => { options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; }); services.AddSession(); services.AddScoped <ShoppingCartHelper>(sp => ShoppingCartHelper.GetCart(sp)); services.AddHttpContextAccessor(); services.AddScoped <IShoppingCartService, ShoppingCartService>(); services.AddScoped <IAppointmentService, AppointmentService>(); services.AddScoped <IBannerService, BannerService>(); services.AddScoped <IBannerStatisticService, BannerStatisticService>(); services.AddScoped <IBlogCategoryService, BlogCategoryService>(); services.AddScoped <IBlogPostService, BlogPostService>(); services.AddScoped <IBlogPostCategoryService, BlogPostCategoryService>(); services.AddScoped <IBrandService, BrandService>(); services.AddScoped <IEventService, EventService>(); services.AddScoped <IEventLocationService, EventLocationService>(); services.AddScoped <IMediaService, MediaService>(); services.AddScoped <IOfferDetailService, OfferDetailService>(); services.AddScoped <IOfferService, OfferService>(); services.AddScoped <IOrderDetailService, OrderDetailService>(); services.AddScoped <IOrderService, OrderService>(); services.AddScoped <IPressReleaseService, PressReleaseService>(); services.AddScoped <IProductService, ProductService>(); services.AddScoped <IFeatureService, FeatureService>(); services.AddScoped <IFeatureAttributeService, FeatureAttributeService>(); services.AddScoped <IShopCategoryService, ShopCategoryService>(); services.AddScoped <IShoppingCartService, ShoppingCartService>(); services.AddScoped <ITagService, TagService>(); services.AddScoped <IBlogCategoryService, BlogCategoryService>(); services.AddScoped <IBlogPostTagService, BlogPostTagService>(); services.AddScoped <IBlogPostMediaService, BlogPostMediaService>(); services.AddScoped <IEventMediaService, EventMediaService>(); services.AddScoped <IEventTagService, EventTagService>(); services.AddScoped <IShopCategoryFeatureService, ShopCategoryFeatureService>(); services.AddScoped <IProductShopCategoryService, ProductShopCategoryService>(); services.AddScoped <IProductMediaService, ProductMediaService>(); services.AddScoped <IProductTagService, ProductTagService>(); services.AddScoped <IProductAttributeService, ProductAttributeService>(); }
public async Task ShouldHandleNewItem() { var helper = new ShoppingCartHelper(); var unitOfWork = AppObjectFactory.GetContainer().GetInstance <IUnitOfWork>(); await helper.AddToCartAsync(unitOfWork.Set <Product>().First(), 2, unitOfWork.Set <User>().First(), unitOfWork); }
public CartModelFactory(IWorkContext workContext, ShoppingCartHelper shoppingCartHelper, ProductDataService productDataService, ICurrentUserService currentUserService) { _workContext = workContext; _shoppingCartHelper = shoppingCartHelper; _productDataService = productDataService; _currentUserService = currentUserService; }
public ProdukteController(ApplicationDbContext context, ILoggerFactory loggerFactory, IMetaService metaService) { _context = context; factory = loggerFactory; logger = factory.CreateLogger <ProdukteController>(); cartHelper = new ShoppingCartHelper(_context, factory.CreateLogger <ShoppingCartHelper>()); this.metaService = metaService; }
public HomeController(ApplicationDbContext context, ILoggerFactory loggerFactory, IMetaService service) { _context = context; factory = loggerFactory; _logger = factory.CreateLogger <HomeController>(); metaService = service; cartHelper = new ShoppingCartHelper(_context, factory.CreateLogger <ShoppingCartHelper>()); }
public OrdersController(ApplicationDbContext context, UserManager <ApplicationUser> userManager, ILoggerFactory loggerFactory, IEmailSender emailSender) { _context = context; _userManager = userManager; factory = loggerFactory; this.logger = factory.CreateLogger <OrdersController>(); _emailSender = emailSender; cartHelper = new ShoppingCartHelper(_context, factory.CreateLogger <ShoppingCartHelper>()); addressHelper = new ShippingAddressHelper(_context); }
public async Task <ActionResult> AddressAndPayment(IFormCollection values) { var order = new Order(); bool success = TryUpdateModelAsync <Order>(order).Result; try { if (string.Equals(values["PromoCode"], PromoCode, StringComparison.OrdinalIgnoreCase) == false) { return(View(order)); } else { order.Username = new ContextHelper().GetUsernameFromClaims(this.HttpContext); order.OrderDate = DateTime.Now; try { // get cart items var cartId = new ShoppingCartHelper(this.HttpContext).GetCartId(); var cartItems = await shoppingCartApiHelper.GetAsync <List <Cart> >("/api/ShoppingCart/CartItems?id=" + cartId); // avoid sending unuseful data on to the service cartItems.ForEach((item) => { item.Album.Genre = null; item.Album.Artist = null; }); OrderCreation creation = new OrderCreation() { OrderToCreate = order, CartItems = cartItems }; int orderId = await orderApiHelper.PostAsync <OrderCreation, int>("/api/AddressAndPayment", creation); await shoppingCartApiHelper.PostAsync <string>("/api/ShoppingCart/EmptyCart", $"'{cartId}'"); return(RedirectToAction("Complete", new { id = orderId })); } catch (Exception) { //Log return(View(order)); } } } catch (Exception) { //Invalid - redisplay with errors return(View(order)); } }
/// <summary> /// gets Shipping cost response /// </summary> /// <returns></returns> private BaseResponseDto<EstimateDeliveryPricePayloadDto> GetShippingResponse() { try { EstimateDeliveryPriceRequestDto estimationdto = ShoppingCartHelper.GetEstimationDTO(Cart); return ShoppingCartHelper.CallEstimationService(estimationdto); } catch (Exception ex) { EventLogProvider.LogInformation("Kadena_CMSWebParts_Kadena_Cart_DistributorCartDetails", "OnPreRender", ex.Message); return null; } }
// // GET: /ShoppingCart/ public async Task <ActionResult> Index() { var cartId = new ShoppingCartHelper(this.HttpContext).GetCartId(); // Set up our ViewModel var viewModel = new ShoppingCartViewModel { CartItems = await apiHelper.GetAsync <List <Cart> >("/api/ShoppingCart/CartItems?id=" + cartId), CartTotal = await apiHelper.GetAsync <decimal>("/api/ShoppingCart/Total?id=" + cartId) }; // Return the view return(View(viewModel)); }
public static object OpenCampaignID(EvaluationContext context, params object[] parameters) { try { var campaign = ShoppingCartHelper.GetOpenCampaign(); return(campaign != null? campaign.CampaignID:default(int)); } catch (Exception ex) { EventLogProvider.LogInformation("Kadena Macro methods", "OpenCampaignID", ex.Message); return(default(int)); } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddDefaultIdentity <IdentityUser>().AddEntityFrameworkStores <ApplicationDbContext>(); services.AddScoped <IPieRepository, PieRepository>(); services.AddScoped <ICategoryRepository, CategoryRepository>(); services.AddScoped <IShoppingCartRepository, ShoppingCartRepository>(); services.AddScoped <IOrderRepository, OrderRepository>(); services.AddScoped(sp => ShoppingCartHelper.GetCart(sp)); services.AddHttpContextAccessor(); services.AddSession(); services.AddControllersWithViews(); services.AddRazorPages(); }
public static object GetCartTotalByInventoryType(EvaluationContext context, params object[] parameters) { try { int userID = ValidationHelper.GetInteger(parameters[1], default(int)); int inventoryType = ValidationHelper.GetInteger(parameters[2], default(int)); int openCampaignID = ValidationHelper.GetInteger(parameters[3], default(int)); if (inventoryType == (Int32)ProductType.PreBuy) { var query = new DataQuery(SQLQueries.getShoppingCartTotal); QueryDataParameters queryParams = new QueryDataParameters(); queryParams.Add("@ShoppingCartUserID", userID); queryParams.Add("@ShoppingCartInventoryType", inventoryType); queryParams.Add("@ShoppingCartCampaignID", openCampaignID); var cartTotal = ConnectionHelper.ExecuteScalar(query.QueryText, queryParams, QueryTypeEnum.SQLQuery, true); return(ValidationHelper.GetDecimal(cartTotal, default(decimal))); } else { var loggedInUSerCartIDs = ShoppingCartHelper.GetCartsByUserID(userID, ProductType.GeneralInventory, openCampaignID); decimal cartTotal = 0; loggedInUSerCartIDs.ForEach(cartID => { var Cart = ShoppingCartInfoProvider.GetShoppingCartInfo(cartID); if (Cart.ShippingOption != null && Cart.ShippingOption.ShippingOptionCarrierServiceName.ToLower() != ShippingOption.Ground) { EstimateDeliveryPriceRequestDto estimationdto = ShoppingCartHelper.GetEstimationDTO(Cart); var estimation = ShoppingCartHelper.CallEstimationService(estimationdto); cartTotal += ValidationHelper.GetDecimal(estimation?.Payload?.Cost, default(decimal)); } }); return(ValidationHelper.GetDecimal(cartTotal, default(decimal))); } } catch (Exception ex) { EventLogProvider.LogInformation("Kadena Macro methods", "BindPrograms", ex.Message); return(default(double)); } }
/// <summary> /// Chekcou click event for order processing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnkCheckout_Click(object sender, EventArgs e) { try { if (AuthenticationHelper.IsAuthenticated()) { int CampaignID = QueryHelper.GetInteger("campid", 0); if (CampaignID > 0 && !_failedOrders.GetCampaignOrderStatus(CampaignID)) { ShoppingCartHelper.ProcessOrders(CampaignID); Response.Redirect(Request.RawUrl); } else { lnkCheckout.Visible = false; } } } catch (Exception ex) { EventLogProvider.LogInformation("Kadena_CMSWebParts_Kadena_Cart_FailedOrdersCheckout", "lnkCheckout_Click", ex.Message); } }
private void AddToCart() { int quantity = int.Parse(Quantity); // If true, update quantity on the item already in the cart if (ShoppingCartHelper.IsAlreadyInCart(Product, SelectedSize.Size)) { ShoppingCartHelper.UpdateItemQuantity(Product.ProductId, SelectedSize.Size, quantity); return; } var productVM = new ProductViewModel { ProductId = Product.ProductId, Name = Product.Name, Description = Product.Description, ImageUrl = Product.ImageUrl, Quantity = quantity, Size = SelectedSize.Size, Cost = SelectedSize.Cost * quantity }; ShoppingCartHelper.AddToCart(productVM); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddAutoMapper(typeof(Startup)); services.AddControllers(); services.AddControllersWithViews().AddNewtonsoftJson(); services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultContext"))); services.AddRazorPages().AddNewtonsoftJson(); services.AddMvc().AddNewtonsoftJson(options => { options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; }); services.AddSession(); services.AddHttpContextAccessor(); services.AddIdentity <IdentityUser, IdentityRole>() // services.AddDefaultIdentity<IdentityUser>() .AddEntityFrameworkStores <ApplicationDbContext>() .AddDefaultTokenProviders(); services.AddMvc() .AddRazorPagesOptions(options => { //options.AllowAreas = true; options.Conventions.AuthorizeAreaFolder("Identity", "/Account/Manage"); options.Conventions.AuthorizeAreaPage("Identity", "/Account/Logout"); }); services.ConfigureApplicationCookie(options => { options.LoginPath = $"/Identity/Account/Login"; options.LogoutPath = $"/Identity/Account/Logout"; options.AccessDeniedPath = $"/Identity/Account/AccessDenied"; }); services.AddSession(); services.AddHttpContextAccessor(); // using Microsoft.AspNetCore.Identity.UI.Services; services.AddSingleton <IEmailSender, EmailSender>(); //services.AddApplicationInsightsTelemetry(); services.AddScoped <ShoppingCartHelper>(sp => ShoppingCartHelper.GetCart(sp)); services.AddScoped <IAppointmentService, AppointmentService>(); services.AddScoped <IBannerService, BannerService>(); services.AddScoped <IBannerStatisticService, BannerStatisticService>(); services.AddScoped <IBlogCategoryService, BlogCategoryService>(); services.AddScoped <IBlogPostService, BlogPostService>(); services.AddScoped <IBlogPostCategoryService, BlogPostCategoryService>(); services.AddScoped <IBrandService, BrandService>(); services.AddScoped <IEventService, EventService>(); services.AddScoped <IEventLocationService, EventLocationService>(); services.AddScoped <IMediaService, MediaService>(); services.AddScoped <IOfferDetailService, OfferDetailService>(); services.AddScoped <IOfferService, OfferService>(); services.AddScoped <IOrderDetailService, OrderDetailService>(); services.AddScoped <IOrderService, OrderService>(); services.AddScoped <IPressReleaseService, PressReleaseService>(); services.AddScoped <IProductService, ProductService>(); services.AddScoped <IFeatureService, FeatureService>(); services.AddScoped <IFeatureAttributeService, FeatureAttributeService>(); services.AddScoped <IShopCategoryService, ShopCategoryService>(); services.AddScoped <IShoppingCartService, ShoppingCartService>(); services.AddScoped <ITagService, TagService>(); services.AddScoped <IBlogCategoryService, BlogCategoryService>(); services.AddScoped <IBlogPostTagService, BlogPostTagService>(); services.AddScoped <IBlogPostMediaService, BlogPostMediaService>(); services.AddScoped <IEventMediaService, EventMediaService>(); services.AddScoped <IEventTagService, EventTagService>(); services.AddScoped <IShopCategoryFeatureService, ShopCategoryFeatureService>(); services.AddScoped <IProductShopCategoryService, ProductShopCategoryService>(); services.AddScoped <IProductMediaService, ProductMediaService>(); services.AddScoped <IProductTagService, ProductTagService>(); services.AddScoped <IProductAttributeService, ProductAttributeService>(); }
/// <summary> /// This method will do order processing /// </summary> /// <param name="openCampaignID"></param> /// <param name="campaignClosingUserID"></param> /// <returns></returns> private string GenerateOrder(int openCampaignID, int campaignClosingUserID) { try { var shoppingCartInfo = DIContainer.Resolve <IShoppingCartProvider>(); var addrerss = DIContainer.Resolve <IAddressBookService>(); var userInfo = DIContainer.Resolve <IKenticoUserProvider>(); var kenticoResourceService = DIContainer.Resolve <IKenticoResourceService>(); var usersWithShoppingCartItems = shoppingCartInfo.GetUserIDsWithShoppingCart(openCampaignID, Convert.ToInt32(ProductsType.PreBuy)); var orderTemplateSettingKey = kenticoResourceService.GetSettingsKey("KDA_OrderReservationEmailTemplate"); var failedOrderTemplateSettingKey = kenticoResourceService.GetSettingsKey("KDA_FailedOrdersEmailTemplate"); var failedOrdersUrl = kenticoResourceService.GetSettingsKey("KDA_FailedOrdersPageUrl"); var unprocessedDistributorIDs = new List <Tuple <int, string> >(); usersWithShoppingCartItems.ForEach(shoppingCartUser => { var salesPerson = userInfo.GetUserByUserId(shoppingCartUser); var loggedInUserCartIDs = ShoppingCartHelper.GetCartsByUserID(shoppingCartUser, ProductType.PreBuy, openCampaignID); loggedInUserCartIDs.ForEach(cart => { var shippingCost = default(decimal); Cart = ShoppingCartInfoProvider.GetShoppingCartInfo(cart); OrderDTO ordersDTO = ShoppingCartHelper.CreateOrdersDTO(Cart, Cart.ShoppingCartUserID, OrderType.prebuy, shippingCost); var response = ShoppingCartHelper.ProcessOrder(Cart, Cart.ShoppingCartUserID, OrderType.prebuy, ordersDTO, shippingCost); if (response != null && response.Success) { ordersDTO.OrderID = response.Payload; ProductEmailNotifications.SendMail(salesPerson, ordersDTO, orderTemplateSettingKey); InBoundFormHelper.InsertIBFForm(ordersDTO); ShoppingCartInfoProvider.DeleteShoppingCartInfo(Cart); ShoppingCartHelper.UpdateRemainingBudget(ordersDTO, salesPerson.UserId); DIContainer.Resolve <IIBTFService>().InsertIBTFAdjustmentRecord(ordersDTO); } else { unprocessedDistributorIDs.Add(new Tuple <int, string>(Cart.GetIntegerValue("ShoppingCartDistributorID", default(int)), response.ErrorMessages)); } }); }); var distributors = addrerss.GetAddressesByAddressIds(unprocessedDistributorIDs.Select(x => x.Item1).ToList()).Select(x => { return(new { AddressID = x?.Id, AddressPersonalName = x?.AddressPersonalName }); }).ToList(); var listofFailedOrders = unprocessedDistributorIDs.Select(x => { var distributor = distributors.Where(y => y.AddressID == x.Item1).FirstOrDefault(); return(new { Name = distributor.AddressPersonalName, Reason = x.Item2 }); }).ToList(); var user = userInfo.GetUserByUserId(campaignClosingUserID); if (user?.Email != null && listofFailedOrders.Count > 0) { Dictionary <string, object> failedOrderData = new Dictionary <string, object>(); failedOrderData.Add("failedorderurl", URLHelper.AddHTTPToUrl($"{SiteContext.CurrentSite.DomainName}{failedOrdersUrl}?campid={openCampaignID}")); failedOrderData.Add("failedordercount", listofFailedOrders.Count); failedOrderData.Add("failedorders", listofFailedOrders); ProductEmailNotifications.SendEmailNotification(failedOrderTemplateSettingKey, user.Email, listofFailedOrders, "failedOrders", failedOrderData); UpdatetFailedOrders(openCampaignID, true); } return(ResHelper.GetString("KDA.OrderSchedular.TaskSuccessfulMessage")); } catch (Exception ex) { EventLogProvider.LogException("GeneratePrebuyOrderTask", "GenerateOrder", ex, SiteContext.CurrentSiteID, ex.Message); return(ex.Message); } }
/// <summary> /// Chekcou click event for order processing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnkCheckout_Click(object sender, EventArgs e) { try { if (!DIContainer.Resolve <IShoppingCartProvider>().ValidateAllCarts(userID: CurrentUser.UserID)) { Response.Cookies["status"].Value = QueryStringStatus.InvalidCartItems; Response.Cookies["status"].HttpOnly = false; return; } var loggedInUserCartIDs = GetCartsByUserID(CurrentUser.UserID, ProductType.GeneralInventory, OpenCampaign?.CampaignID); settingKeys = DIContainer.Resolve <IKenticoResourceService>(); var orderTemplateSettingKey = settingKeys.GetSettingsKey("KDA_OrderReservationEmailTemplateGI"); var unprocessedDistributorIDs = new List <Tuple <int, string> >(); var userInfo = DIContainer.Resolve <IKenticoUserProvider>(); var salesPerson = userInfo.GetUserByUserId(CurrentUser.UserID); loggedInUserCartIDs.ForEach(distributorCart => { Cart = ShoppingCartInfoProvider.GetShoppingCartInfo(distributorCart); decimal shippingCost = default(decimal); if (Cart.ShippingOption != null && Cart.ShippingOption.ShippingOptionName.ToLower() != ShippingOption.Ground) { var shippingResponse = GetOrderShippingTotal(Cart); if (shippingResponse != null && shippingResponse.Success) { shippingCost = ValidationHelper.GetDecimal(shippingResponse?.Payload?.Cost, default(decimal)); } else { unprocessedDistributorIDs.Add(new Tuple <int, string>(Cart.GetIntegerValue("ShoppingCartDistributorID", default(int)), shippingResponse.ErrorMessages)); return; } } OrderDTO ordersDTO = CreateOrdersDTO(Cart, Cart.ShoppingCartUserID, OrderType.generalInventory, shippingCost); var response = ProcessOrder(Cart, CurrentUser.UserID, OrderType.generalInventory, ordersDTO, shippingCost); if (response != null && response.Success) { UpdateAvailableSKUQuantity(Cart); UpdateAllocatedProductQuantity(Cart, salesPerson.UserId); ProductEmailNotifications.SendMail(salesPerson, ordersDTO, orderTemplateSettingKey); ShoppingCartInfoProvider.DeleteShoppingCartInfo(Cart); ShoppingCartHelper.UpdateRemainingBudget(ordersDTO, CurrentUser.UserID); } else { unprocessedDistributorIDs.Add(new Tuple <int, string>(Cart.GetIntegerValue("ShoppingCartDistributorID", default(int)), response.ErrorMessages)); } }); if (unprocessedDistributorIDs.Count == 0) { Response.Cookies["status"].Value = QueryStringStatus.OrderSuccess; Response.Cookies["status"].HttpOnly = false; URLHelper.Redirect(Request.RawUrl); } else { if (loggedInUserCartIDs.Count > unprocessedDistributorIDs.Count) { Response.Cookies["status"].Value = QueryStringStatus.OrderSuccess; Response.Cookies["status"].HttpOnly = false; } Response.Cookies["error"].Value = QueryStringStatus.OrderFail; Response.Cookies["error"].HttpOnly = false; ShowOrderErrorList(unprocessedDistributorIDs); divErrorDailogue.Attributes.Add("class", "dialog active"); } } catch (Exception ex) { EventLogProvider.LogInformation("Kadena_CMSWebParts_Kadena_Cart_CartCheckout", "lnkCheckout_Click", ex.Message); } }
public ShoppingCartController(ShoppingCartHelper shoppingCart) { _shoppingCart = shoppingCart ?? throw new ArgumentNullException(nameof(shoppingCart)); }
public ShoppingCartSummary(ShoppingCartHelper shoppingCart) { _shoppingCart = shoppingCart; }
public CheckoutController(ShoppingCartHelper shoppingCart, IOrderService orderService) { _shoppingCart = shoppingCart ?? throw new ArgumentNullException(nameof(shoppingCart)); _orderService = orderService ?? throw new ArgumentNullException(nameof(orderService)); }