public OrderModel() { TaxRates = new List<TaxRate>(); GiftCards = new List<GiftCard>(); Items = new List<OrderItemModel>(); AutoUpdateOrderItem = new AutoUpdateOrderItemModel(); }
public OrderModel() { TaxRates = new List <TaxRate>(); GiftCards = new List <GiftCard>(); Items = new List <OrderItemModel>(); AutoUpdateOrderItem = new AutoUpdateOrderItemModel(); }
public ActionResult Accept(AutoUpdateOrderItemModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageReturnRequests)) return AccessDeniedView(); var returnRequest = _orderService.GetReturnRequestById(model.Id); var oi = _orderService.GetOrderItemById(returnRequest.OrderItemId); int cancelQuantity = (returnRequest.Quantity > oi.Quantity ? oi.Quantity : returnRequest.Quantity); var context = new AutoUpdateOrderItemContext() { OrderItem = oi, QuantityOld = oi.Quantity, QuantityNew = Math.Max(oi.Quantity - cancelQuantity, 0), AdjustInventory = model.AdjustInventory, UpdateRewardPoints = model.UpdateRewardPoints, UpdateTotals = model.UpdateTotals }; returnRequest.ReturnRequestStatus = ReturnRequestStatus.ReturnAuthorized; _customerService.UpdateCustomer(returnRequest.Customer); _orderProcessingService.AutoUpdateOrderDetails(context); TempData[AutoUpdateOrderItemContext.InfoKey] = context.ToString(_localizationService); return RedirectToAction("Edit", new { id = returnRequest.Id }); }
public ReturnRequestModel() { AvailableReasonForReturn = new List <SelectListItem>(); AvailableRequestedAction = new List <SelectListItem>(); AutoUpdateOrderItem = new AutoUpdateOrderItemModel(); }
public ActionResult DeleteOrderItem(AutoUpdateOrderItemModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageOrders)) return AccessDeniedView(); var oi = _orderService.GetOrderItemById(model.Id); if (oi == null) throw new ArgumentException("No order item found with the specified id"); int orderId = oi.Order.Id; var context = new AutoUpdateOrderItemContext() { OrderItem = oi, QuantityOld = oi.Quantity, QuantityNew = 0, AdjustInventory = model.AdjustInventory, UpdateRewardPoints = model.UpdateRewardPoints, UpdateTotals = model.UpdateTotals }; _orderProcessingService.AutoUpdateOrderDetails(context); _orderService.DeleteOrderItem(oi); TempData[AutoUpdateOrderItemContext.InfoKey] = context.ToString(_localizationService); return RedirectToAction("Edit", new { id = orderId }); }
public ActionResult EditOrderItem(AutoUpdateOrderItemModel model, FormCollection form) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageOrders)) return AccessDeniedView(); var oi = _orderService.GetOrderItemById(model.Id); if (oi == null) throw new ArgumentException("No order item found with the specified id"); int orderId = oi.Order.Id; if (model.NewQuantity.HasValue) { var context = new AutoUpdateOrderItemContext() { OrderItem = oi, QuantityOld = oi.Quantity, QuantityNew = model.NewQuantity.Value, AdjustInventory = model.AdjustInventory, UpdateRewardPoints = model.UpdateRewardPoints, UpdateTotals = model.UpdateTotals }; oi.Quantity = model.NewQuantity.Value; oi.UnitPriceInclTax = model.NewUnitPriceInclTax ?? oi.UnitPriceInclTax; oi.UnitPriceExclTax = model.NewUnitPriceExclTax ?? oi.UnitPriceExclTax; oi.DiscountAmountInclTax = model.NewDiscountInclTax ?? oi.DiscountAmountInclTax; oi.DiscountAmountExclTax = model.NewDiscountExclTax ?? oi.DiscountAmountExclTax; oi.PriceInclTax = model.NewPriceInclTax ?? oi.PriceInclTax; oi.PriceExclTax = model.NewPriceExclTax ?? oi.PriceExclTax; _orderService.UpdateOrder(oi.Order); _orderProcessingService.AutoUpdateOrderDetails(context); // we do not delete order item automatically anymore. //if (oi.Quantity <= 0) //{ // _orderService.DeleteOrderItem(oi); //} TempData[AutoUpdateOrderItemContext.InfoKey] = context.ToString(_localizationService); } return RedirectToAction("Edit", new { id = orderId }); }
public ReturnRequestModel() { AvailableReasonForReturn = new List<SelectListItem>(); AvailableRequestedAction = new List<SelectListItem>(); AutoUpdateOrderItem = new AutoUpdateOrderItemModel(); }