public async Task <IActionResult> BudgetSetUpCostCenter(int SID) { if (SID == 0) { return(RedirectToAction("CostCentralBugets", "CostCentralBugets", new { Area = "Administration" })); } var model = new ShipToModel(); var setup = await _bugetManagentService.GetBugetSetUpCostCenter(SID); model = _mapper.Map <ShipToModel>(setup); model.AvailableGeneralLedger.Add(new SelectListItem { Text = "None", Value = "Unallocated" }); foreach (var item in (await _vendorManagementService.GetGeneralLedger( (int)_workContext.CurrentCustomer.ClientId))) { model.AvailableGeneralLedger.Add(new SelectListItem { Text = item.Gl1, Value = item.Gl1 }); } return(View(model)); }
public override UpdateCartParameter MapParameter(CartModel cartModel, HttpRequestMessage request) { UpdateCartParameter updateCartParameter1 = new UpdateCartParameter(); updateCartParameter1.CartId = cartModel.Id.ToCurrentOrGuid(); updateCartParameter1.Status = cartModel.Status; ShipToModel shipTo = cartModel.ShipTo; updateCartParameter1.ShipToId = shipTo != null ? new Guid?(shipTo.Id.ToGuid()) : new Guid?(); updateCartParameter1.ShipViaId = cartModel.ShipVia?.Id; updateCartParameter1.Notes = cartModel.Notes; updateCartParameter1.PoNumber = cartModel.PoNumber; updateCartParameter1.TermsCode = cartModel.PaymentMethod?.Name; PaymentMethodDto paymentMethod = cartModel.PaymentMethod; updateCartParameter1.RequestedDeliveryDate = cartModel.RequestedDeliveryDate; UpdateCartParameter updateCartParameter2 = updateCartParameter1; if (cartModel.PaymentOptions != null && cartModel.PaymentOptions.IsPayPal) { updateCartParameter2.IsPayPal = cartModel.PaymentOptions.IsPayPal; updateCartParameter2.PaypalRedirectUrl = cartModel.PaymentOptions.PayPalPaymentUrl; if (cartModel.Status == "Submitted") { updateCartParameter2.PayPalPayerId = cartModel.PaymentOptions.PayPalPayerId; updateCartParameter2.PayPalToken = cartModel.PaymentOptions.PayPalToken; } } if (!cartModel.Status.EqualsIgnoreCase("Submitted") && !cartModel.Status.EqualsIgnoreCase("CreateSmartSupply") && !cartModel.Status.EqualsIgnoreCase("SaveNewCard") && !cartModel.Status.EqualsIgnoreCase("PayInvoice")) //BUSA-PIO { return(updateCartParameter2); } updateCartParameter2.PaymentMethod = cartModel.PaymentMethod; //if (cartModel.PaymentMethod.IsCreditCard) if (cartModel.PaymentOptions.PaymentMethods.Count > 0) /*BUSA-619 : Card Information popup becomes unresponsive on clicking save button.*/ { updateCartParameter2.CreditCard = cartModel.PaymentOptions.CreditCard; } updateCartParameter2.StorePaymentProfile = cartModel.PaymentOptions.StorePaymentProfile; if (cartModel.PaymentMethod != null && cartModel.PaymentMethod.IsPaymentProfile) { updateCartParameter2.IsPaymentProfile = true; updateCartParameter2.PaymentProfileId = cartModel.PaymentMethod.Name; } //BUSA-1170 Added order level property for sample product if (cartModel.CartLines.Where(cl => cl.Properties.ContainsKey("isSampleCartLine") && cl.Properties.ContainsValue("true")).Count() > 0) { cartModel.Properties.Add("isSampleOrder", "true"); } updateCartParameter2.Properties = cartModel.Properties; // return(updateCartParameter2); }
private ShipToModel MappShipTo(DirectBookingDraftCollection collection) { ShipToModel shipTo = new ShipToModel(); shipTo.Name = collection.FirstName + collection.LastName; shipTo.Address1 = collection.Address; shipTo.Address2 = string.IsNullOrWhiteSpace(collection.Address2.Trim()) ? "" : collection.Address2.Trim(); shipTo.City = collection.City; shipTo.State = collection.State; shipTo.PostalCode = collection.PostCode; shipTo.Country = collection.Country.Code2; shipTo.Phone = collection.Phone; shipTo.Email = collection.Email; return(shipTo); }
public async Task <IActionResult> BudgetSetUpCostCenter(ShipToModel model) { var ship = await _bugetManagentService.GetBugetSetUpCostCenter(model.Sid); if (ship == null) { return(RedirectToAction("CostCentralBugets", "CostCentralBugets", new { Area = "Administration" })); } if (model.S2gl1 != "Unallocated") { ship.S2gl1 = model.S2gl1; } if (model.S2gl2 != "Unallocated") { ship.S2gl2 = model.S2gl2; } if (model.S2gl3 != "Unallocated") { ship.S2gl3 = model.S2gl3; } if (model.S2gl4 != "Unallocated") { ship.S2gl4 = model.S2gl4; } if (model.S2gl5 != "Unallocated") { ship.S2gl5 = model.S2gl5; } ship.S2b1past = model.S2b1past; ship.S2b1now = model.S2b1now; ship.S2b1next = model.S2b1next; ship.S2b2past = model.S2b2past; ship.S2b2now = model.S2b2now; ship.S2b2next = model.S2b2next; ship.S2b3past = model.S2b3past; ship.S2b3now = model.S2b3now; ship.S2b3next = model.S2b3next; ship.S2b4past = model.S2b4past; ship.S2b4now = model.S2b4now; ship.S2b4next = model.S2b4next; ship.S2b5past = model.S2b5past; ship.S2b5now = model.S2b5now; ship.S2b5next = model.S2b5next; var result = await _bugetManagentService.UpdateBugetSetupCostCenter(ship); if (result) { SuccessNotification("The cost center data has been updated successfully."); return(RedirectToAction("BudgetSetUpCostCenter", "BugetManagement", new { SID = model.Sid })); } else { ModelState.AddModelError("", "Something went wrong while update record"); } return(RedirectToAction("BudgetSetUpCostCenter")); }