public ActionResult EditBulkSingle(int id, string PageSessionToken) { SetViewBagItems(); List <object> expecHours = new List <object>(); for (int ctr = 1; ctr <= 10; ctr++) { expecHours.Add(new { ExpectedHours = ctr }); } var order = OrderService.GetOrderById(id); ViewBag.OrderGroupToken = order.OrderGroupToken; ViewBag.AuthUserId = CurrentUserId; ViewBag.AccountContacts = new SelectList(AccountServices.GetAllTopAccountContactsByTenantId(CurrentTenantId), "AccountContactId", "ContactName"); ViewBag.OrderDetails = order.OrderDetails; ViewBag.OrderProcesses = new List <OrderProcess>(); if (string.IsNullOrEmpty(PageSessionToken)) { ViewBag.ForceRegeneratePageToken = "True"; ViewBag.ForceRegeneratedPageToken = Guid.NewGuid().ToString(); } else { ViewBag.ForceRegeneratedPageToken = PageSessionToken; } var details = OrderService.GetAllValidOrderDetailsByOrderId(id).ToList(); GaneOrderDetailsSessionHelper.SetOrderDetailSessions(ViewBag.ForceRegeneratedPageToken, Mapper.Map(details, new List <OrderDetailSessionViewModel>())); GaneOrderNotesSessionHelper.SetOrderNotesSessions(ViewBag.ForceRegeneratedPageToken, order.OrderNotes.Where(m => m.IsDeleted != true).ToList()); return(PartialView(order)); }
public ActionResult CreateBulkSingle(string pageToken) { /// Authorization Check if (!caSession.AuthoriseSession()) { return(Redirect((string)Session["ErrorUrl"])); } Order NewOrder = new Order(); NewOrder.OrderNumber = GeneratePO(); SetViewBagItems(); List <object> expecHours = new List <object>(); for (int ctr = 1; ctr <= 10; ctr++) { expecHours.Add(new { ExpectedHours = ctr }); } ViewBag.OrderGroupToken = Guid.NewGuid().ToString(); ViewBag.AuthUserId = CurrentUserId; ViewBag.AccountContacts = new SelectList(AccountServices.GetAllTopAccountContactsByTenantId(CurrentTenantId), "AccountContactId", "ContactName"); ViewBag.OrderDetails = new List <OrderDetail>(); ViewBag.OrderProcesses = new List <OrderProcess>(); if (string.IsNullOrEmpty(pageToken)) { ViewBag.ForceRegeneratePageToken = "True"; ViewBag.ForceRegeneratedPageToken = Guid.NewGuid().ToString(); } GaneOrderDetailsSessionHelper.SetOrderDetailSessions(ViewBag.ForceRegeneratedPageToken, new List <OrderDetailSessionViewModel>()); GaneOrderNotesSessionHelper.SetOrderNotesSessions(ViewBag.ForceRegeneratedPageToken, new List <OrderNotes>()); return(PartialView(NewOrder)); }
public async Task <ActionResult> Edit(Order Order, FormCollection formCollection, OrderRecipientInfo shipmentAndRecipientInfo, string orderSaveAndProcess, int EmailTemplate) { if (ModelState.IsValid) { Order.OrderNumber = Order.OrderNumber.Trim(); // get properties of user caUser user = caCurrent.CurrentUser(); Order.DateUpdated = DateTime.UtcNow; Order.UpdatedBy = user.UserId; Order.WarehouseId = CurrentWarehouseId; var items = GaneOrderDetailsSessionHelper.GetOrderDetailSession(shipmentAndRecipientInfo.PageSessionToken); var nItems = GaneOrderNotesSessionHelper.GetOrderNotesSession(shipmentAndRecipientInfo.PageSessionToken); Order = OrderService.SaveSalesOrder(Order, shipmentAndRecipientInfo, CurrentTenantId, CurrentWarehouseId, CurrentUserId, Mapper.Map(items, new List <OrderDetail>()), nItems); if (shipmentAndRecipientInfo.SendEmailWithAttachment) { var report = CreateSalesOrderPrint(Order.OrderID); PrepareDirectory("~/UploadedFiles/reports/so/"); var reportPath = "~/UploadedFiles/reports/so/" + Order.OrderNumber + ".pdf"; report.ExportToPdf(Server.MapPath(reportPath)); var result = await GaneConfigurationsHelper.CreateTenantEmailNotificationQueue($"#{Order.OrderNumber} - Sales order has been updated", Mapper.Map(Order, new OrderViewModel()), reportPath, shipmentAndRecipientInfo : shipmentAndRecipientInfo, worksOrderNotificationType : (WorksOrderNotificationTypeEnum)EmailTemplate); if (result != "Success") { TempData["Error"] = result; } } if (Order.OrderStatusID == (int)OrderStatusEnum.AwaitingAuthorisation) { var result = await GaneConfigurationsHelper.CreateTenantEmailNotificationQueue($"#{Order.OrderNumber} - Order Requires Authorisation", Mapper.Map(Order, new OrderViewModel()), null, shipmentAndRecipientInfo : shipmentAndRecipientInfo, worksOrderNotificationType : WorksOrderNotificationTypeEnum.AwaitingOrderTemplate); if (result != "Success") { TempData["Error"] = result; } } GaneOrderDetailsSessionHelper.ClearSessionTokenData(shipmentAndRecipientInfo.PageSessionToken); GaneOrderNotesSessionHelper.ClearSessionTokenData(shipmentAndRecipientInfo.PageSessionToken); ViewBag.Fragment = Request.Form["fragment"]; if (orderSaveAndProcess == "1") { return(Redirect(Url.RouteUrl(new { controller = "SalesOrders", action = "ProcessOrder", id = Order.OrderID }) + "?fragment=" + ViewBag.Fragment as string)); } return(AnchoredOrderIndex("SalesOrders", "Index", ViewBag.Fragment as string)); } ViewBag.ForceRegeneratePageToken = "True"; ViewBag.ForceRegeneratedPageToken = shipmentAndRecipientInfo.PageSessionToken ?? Guid.NewGuid().ToString(); SetViewBagItems(CurrentTenant, EnumAccountType.Customer); ViewBag.SupplierID = new SelectList(AccountServices.GetAllValidAccounts(CurrentTenantId, EnumAccountType.Supplier), "SupplierID", "CompanyName", Order.AccountID); ViewBag.AccountAddresses = new List <SelectListItem>(); if (Order.AccountID > 0) { var account = AccountServices.GetAccountsById(Order.AccountID.Value); ViewBag.AccountAddresses = new SelectList(account.AccountAddresses, "AddressID", "FullAddressValue", Order.ShipmentAccountAddressId); if (Order.ConsignmentTypeId.HasValue && Order.ConsignmentTypeId.Value != (int)ConsignmentTypeEnum.Collection && Order.ShipmentAccountAddressId > 0) { ViewBag.ShipmentAccountAddressId = Order.ShipmentAccountAddressId; ViewBag.IsShipmentToAccountAddress = true; ViewBag.IsShipmentToCustomAddress = false; } else { ViewBag.ShipmentAccountAddressId = 0; ViewBag.IsShipmentToAccountAddress = false; ViewBag.IsShipmentToCustomAddress = true; } } ViewBag.ConsignmentTypes = new SelectList(OrderService.GetAllValidConsignmentTypes(CurrentTenantId), "ConsignmentTypeId", "ConsignmentType", Order.ConsignmentTypeId); return(View(Order)); }
public ActionResult Edit(int?id, string pageToken) { if (!caSession.AuthoriseSession()) { return(Redirect((string)Session["ErrorUrl"])); } caTenant tenant = caCurrent.CurrentTenant(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Order Order = OrderService.GetOrderById(id.Value); if (Order == null) { return(HttpNotFound()); } var list = OrderService.GetAccountContactId(id ?? 0).ToList(); var EmailAutoCheckedOnEdit = _tenantServices.GetTenantConfigById(CurrentTenantId).EmailAutoCheckedOnEdit; if (EmailAutoCheckedOnEdit) { if (list.Any()) { ViewBag.accountShip = true; } } if (string.IsNullOrEmpty(pageToken)) { ViewBag.ForceRegeneratePageToken = "True"; ViewBag.ForceRegeneratedPageToken = Guid.NewGuid().ToString(); } var odList = OrderService.GetAllValidOrderDetailsByOrderId(id.Value).ToList(); GaneOrderDetailsSessionHelper.SetOrderDetailSessions(ViewBag.ForceRegeneratedPageToken, Mapper.Map(odList, new List <OrderDetailSessionViewModel>())); SetViewBagItems(tenant, EnumAccountType.Customer, Order); //ViewBag.AccountContacts = new SelectList(AccountServices.GetAllTopAccountContactsByTenantId(CurrentTenantId), "AccountContactId", "ContactName"); int ids = 0; var accountaddress = _accountServices.GetAllValidAccountContactsByAccountId(ids, CurrentTenantId); ViewBag.AccountContactes = new SelectList(accountaddress, "AccountContactId", "ContactEmail", accountaddress.Select(x => x.AccountID).FirstOrDefault()); var odNotes = Order.OrderNotes.Where(a => a.IsDeleted != true).ToList(); GaneOrderNotesSessionHelper.SetOrderNotesSessions(ViewBag.ForceRegeneratedPageToken, odNotes); ViewBag.AccountAddresses = new List <SelectListItem>(); if (Order.AccountID > 0) { var account = AccountServices.GetAccountsById(Order.AccountID.Value); ViewBag.AccountAddresses = new SelectList(account.AccountAddresses, "AddressID", "FullAddressValue", Order.ShipmentAccountAddressId); if (Order.ConsignmentTypeId.HasValue && Order.ConsignmentTypeId.Value != (int)ConsignmentTypeEnum.Collection && Order.ShipmentAccountAddressId > 0) { ViewBag.ShipmentAccountAddressId = Order.ShipmentAccountAddressId; ViewBag.IsShipmentToAccountAddress = true; ViewBag.IsShipmentToCustomAddress = false; } else { ViewBag.ShipmentAccountAddressId = 0; ViewBag.IsShipmentToAccountAddress = false; ViewBag.IsShipmentToCustomAddress = true; } } ViewBag.ConsignmentTypes = new SelectList(OrderService.GetAllValidConsignmentTypes(CurrentTenantId), "ConsignmentTypeId", "ConsignmentType", Order.ConsignmentTypeId); return(View(Order)); }
public async Task <ActionResult> Create(Order Order, OrderRecipientInfo shipmentAndRecipientInfo, int EmailTemplate) { try { if (ModelState.IsValid) { var tempNotesList = GaneOrderNotesSessionHelper.GetOrderNotesSession(shipmentAndRecipientInfo.PageSessionToken); var tempList = GaneOrderDetailsSessionHelper.GetOrderDetailSession(shipmentAndRecipientInfo.PageSessionToken); Order = OrderService.CreateSalesOrder(Order, shipmentAndRecipientInfo, CurrentTenantId, CurrentWarehouseId, CurrentUserId, Mapper.Map(tempList, new List <OrderDetail>()), tempNotesList); if (shipmentAndRecipientInfo.SendEmailWithAttachment) { var report = CreateSalesOrderPrint(Order.OrderID); PrepareDirectory("~/UploadedFiles/reports/so/"); var reportPath = "~/UploadedFiles/reports/so/" + Order.OrderNumber + ".pdf"; report.ExportToPdf(Server.MapPath(reportPath)); var result = await GaneConfigurationsHelper.CreateTenantEmailNotificationQueue($"#{Order.OrderNumber} - Sales order", Mapper.Map(Order, new OrderViewModel()), reportPath, shipmentAndRecipientInfo : shipmentAndRecipientInfo, worksOrderNotificationType : (WorksOrderNotificationTypeEnum)EmailTemplate); if (result != "Success") { TempData["Error"] = result; } } if (Order.OrderStatusID == (int)OrderStatusEnum.AwaitingAuthorisation) { var result = await GaneConfigurationsHelper.CreateTenantEmailNotificationQueue($"#{Order.OrderNumber} - Order Requires Authorisation", Mapper.Map(Order, new OrderViewModel()), null, shipmentAndRecipientInfo : shipmentAndRecipientInfo, worksOrderNotificationType : WorksOrderNotificationTypeEnum.AwaitingOrderTemplate); if (result != "Success") { TempData["Error"] = result; } } //send ingredients email for certain categories var productCategoryTc = _tenantServices.GetTenantConfigById(Order.TenentId)?.ProductCatagories; if (Order.InventoryTransactionTypeId == (int)InventoryTransactionTypeEnum.SalesOrder && !string.IsNullOrEmpty(productCategoryTc)) { var productcategoryList = productCategoryTc.Split(',').Select(int.Parse).ToList(); if (Order.OrderDetails.Any(x => productcategoryList.Contains((int?)x.ProductMaster?.ProductGroupId ?? 0))) { var result = await GaneConfigurationsHelper.SendStandardMailProductGroup(Order.TenentId, Order.OrderNumber, Order.AccountID ?? 0); if (result != "Success") { TempData["Error"] = result; } } } GaneOrderDetailsSessionHelper.ClearSessionTokenData(shipmentAndRecipientInfo.PageSessionToken); GaneOrderNotesSessionHelper.ClearSessionTokenData(shipmentAndRecipientInfo.PageSessionToken); return(AnchoredOrderIndex("SalesOrders", "Index", "SOA")); } int id = 0; var accountaddress = _accountServices.GetAllValidAccountContactsByAccountId(id, CurrentTenantId); ViewBag.AccountContactes = new SelectList(accountaddress, "AccountContactId", "ContactEmail", accountaddress.Select(x => x.AccountID).FirstOrDefault()); ViewBag.ForceRegeneratePageToken = "True"; ViewBag.ForceRegeneratedPageToken = shipmentAndRecipientInfo.PageSessionToken ?? Guid.NewGuid().ToString(); SetViewBagItems(CurrentTenant, EnumAccountType.Customer); ViewBag.OrderDetails = Order.OrderDetails; ViewBag.OrderProcesses = Order.OrderProcess; ViewBag.IsShipmentToAccountAddress = true; ViewBag.AccountAddresses = new List <SelectListItem>() { new SelectListItem() { Text = "Select", Value = "0" } }; ViewBag.ShipmentAccountAddressId = 0; ViewBag.IsShipmentToCustomAddress = false; ViewBag.ConsignmentTypes = new SelectList(OrderService.GetAllValidConsignmentTypes(CurrentTenantId), "ConsignmentTypeId", "ConsignmentType"); ViewBag.SupplierID = new SelectList(AccountServices.GetAllValidAccounts(CurrentTenantId, EnumAccountType.Supplier), "AccountID", "CompanyName", Order.AccountID); return(View(Order)); } catch (Exception Exp) { int ids = 0; var accountaddress = _accountServices.GetAllValidAccountContactsByAccountId(ids, CurrentTenantId); ViewBag.AccountContactes = new SelectList(accountaddress, "AccountContactId", "ContactEmail", accountaddress.Select(x => x.AccountID).FirstOrDefault()); ViewBag.IsShipmentToAccountAddress = true; ViewBag.AccountAddresses = new List <SelectListItem>() { new SelectListItem() { Text = "Select", Value = "0" } }; ViewBag.ShipmentAccountAddressId = 0; ViewBag.IsShipmentToCustomAddress = false; if (Exp.InnerException != null && Exp.InnerException.Message == "Duplicate Order Number") { ModelState.AddModelError("OrderNumber", Exp.Message); } else { ModelState.AddModelError("", Exp.Message); } var tenent = caCurrent.CurrentTenant(); SetViewBagItems(tenent, EnumAccountType.Customer); ViewBag.OrderDetails = Order.OrderDetails; ViewBag.OrderProcesses = Order.OrderProcess; ViewBag.ForceRegeneratePageToken = "True"; ViewBag.ForceRegeneratedPageToken = shipmentAndRecipientInfo.PageSessionToken ?? Guid.NewGuid().ToString(); ViewBag.ConsignmentTypes = new SelectList(OrderService.GetAllValidConsignmentTypes(CurrentTenantId), "ConsignmentTypeId", "ConsignmentType"); ViewBag.SupplierID = new SelectList(AccountServices.GetAllValidAccounts(CurrentTenantId, EnumAccountType.Supplier), "AccountID", "CompanyName", Order.AccountID); return(View(Order)); } }
public PartialViewResult _OrderDetail(int?Id, string pageSessionToken) { ViewBag.cases = false; DateTime?exp_dte = null; var orderId = 0; if (!string.IsNullOrEmpty(Request.Params["OrderID"])) { orderId = int.Parse(Request.Params["OrderID"]); } if (Request.Params["exp_date"] != "") { exp_dte = DateTime.Parse(Request.Params["exp_date"].ToString()); } var value = int.Parse(Request.Params["did"] ?? "0"); if (Request.Params["rec_qty"] != null) { ViewBag.RecQty = Request.Params["rec_qty"].ToString(); } ViewBag.Products = new SelectList(_productServices.GetAllValidProductMasters(CurrentTenantId), "ProductId", "NameWithCode"); ViewBag.ProductAccounts = new SelectList(new List <ProductAccountCodes>(), "ProdAccCodeID", "ProdAccCode"); if (!string.IsNullOrEmpty(Request.Params["account"])) { var accountId = int.Parse(Request.Params["account"]); var data = (from pac in AccountServices.GetAllProductAccountCodesByAccount(accountId) select new { pac.ProdAccCodeID, pac.ProdAccCode }).ToList(); ViewBag.ProductAccounts = new SelectList(data, "ProdAccCodeID", "ProdAccCode"); } if (!string.IsNullOrEmpty(Request.Params["product"])) { var productid = int.Parse(Request.Params["product"]); var product = _productServices.GetProductMasterById(productid); if (product != null) { ViewBag.ProductCurrentPrice = product.SellPrice; } } ViewBag.GlobalWarranties = new SelectList(LookupServices.GetAllTenantWarrenties(CurrentTenantId), "WarrantyID", "WarrantyName"); var taxes = (from gtax in LookupServices.GetAllValidGlobalTaxes(CurrentTenant.CountryID) select new { TaxId = gtax.TaxID, TaxName = gtax.TaxName + " - " + gtax.PercentageOfAmount + " %" }).ToList(); ViewBag.GlobalTaxes = new SelectList(taxes, "TaxId", "TaxName"); if (value == 0) { ViewBag.IsTransferOrderAdd = true; return(PartialView("Create", new OrderDetailSessionViewModel { ExpectedDate = exp_dte, OrderID = !string.IsNullOrEmpty(Request.Params["oid"]) ? (int.Parse(Request.Params["oid"])) : orderId, TenentId = CurrentTenantId, WarehouseId = CurrentWarehouseId })); } else { if (Request.UrlReferrer.AbsolutePath.Contains("ProcessOrder")) { var cObject = OrderService.GetOrderDetailsById(value); ViewBag.productId = cObject.ProductId; var product = _productServices.GetProductMasterById(cObject.ProductId); ViewBag.cases = product?.ProcessByCase; ViewBag.processcase = product?.ProductsPerCase == null ? 1 : product.ProductsPerCase; if (product?.ProcessByCase != null && product?.ProcessByCase == true) { ViewBag.caseProcess = (cObject.Qty / (product?.ProductsPerCase == null ? 1 : product.ProductsPerCase)); } var cOrderSessionViewModel = AutoMapper.Mapper.Map(cObject, new OrderDetailSessionViewModel()); return(PartialView("Create", cOrderSessionViewModel)); } var odList = GaneOrderDetailsSessionHelper.GetOrderDetailSession(pageSessionToken); var model = odList.FirstOrDefault(a => a.OrderDetailID == value && a.IsDeleted != true); if (model != null) { ViewBag.productId = model.ProductId; var product = _productServices.GetProductMasterById(model.ProductId); ViewBag.cases = product?.ProcessByCase; ViewBag.processcase = product?.ProductsPerCase == null ? 1 : product.ProductsPerCase; if (product?.ProcessByCase != null && product?.ProcessByCase == true) { ViewBag.caseProcess = (model.Qty / (product?.ProductsPerCase == null ? 1 : product.ProductsPerCase)); } } if (model == null) { model = new OrderDetailSessionViewModel() { OrderID = orderId }; ViewBag.IsTransferOrderAdd = true; } return(PartialView("Create", model)); } }
public async Task <ActionResult> Create(Order Order, OrderRecipientInfo shipmentAndRecipientInfo, int EmailTemplate) { try { if (ModelState.IsValid) { if (shipmentAndRecipientInfo.ShipmentDestination == null || shipmentAndRecipientInfo.TenantAddressID == null) { ViewBag.Error = "Please choose a delivery address"; } else { var orderDetails = GaneOrderDetailsSessionHelper.GetOrderDetailSession(shipmentAndRecipientInfo.PageSessionToken); var orderNotes = GaneOrderNotesSessionHelper.GetOrderNotesSession(shipmentAndRecipientInfo.PageSessionToken); OrderService.CreatePurchaseOrder(Order, shipmentAndRecipientInfo, CurrentTenantId, CurrentWarehouseId, CurrentUserId, Mapper.Map(orderDetails, new List <OrderDetail>()), orderNotes); if (shipmentAndRecipientInfo.SendEmailWithAttachment) { var report = CreatePurchaseOrderPrint(Order.OrderID); PrepareDirectory("~/UploadedFiles/reports/po/"); var reportPath = "~/UploadedFiles/reports/po/" + Order.OrderNumber + ".pdf"; report.ExportToPdf(Server.MapPath(reportPath)); var result = await GaneConfigurationsHelper.CreateTenantEmailNotificationQueue($"#{Order.OrderNumber} - Purchase order", Mapper.Map(Order, new OrderViewModel()), reportPath, shipmentAndRecipientInfo : shipmentAndRecipientInfo, worksOrderNotificationType : (WorksOrderNotificationTypeEnum)EmailTemplate); if (result != "Success") { TempData["Error"] = result; } } GaneOrderDetailsSessionHelper.ClearSessionTokenData(shipmentAndRecipientInfo.PageSessionToken); GaneOrderNotesSessionHelper.ClearSessionTokenData(shipmentAndRecipientInfo.PageSessionToken); return(AnchoredOrderIndex("PurchaseOrders", "Index", "PO")); } } SetViewBagItems(Order, EnumAccountType.Supplier); int id = 0; ViewBag.AllowAccountAddress = caCurrent.CurrentWarehouse().AllowShipToAccountAddress; var accountaddress = _accountServices.GetAllValidAccountContactsByAccountId(id, CurrentTenantId); ViewBag.AccountContactes = new SelectList(accountaddress, "AccountContactId", "ContactEmail", accountaddress.Select(x => x.AccountID).FirstOrDefault()); var directsales = _salesServices.GetDirectSaleOrders(null); ViewBag.DirectOrderList = new SelectList(directsales, "OrderID", "OrderNumber"); if (string.IsNullOrEmpty(shipmentAndRecipientInfo.PageSessionToken)) { ViewBag.ForceRegeneratePageToken = "True"; ViewBag.ForceRegeneratedPageToken = Guid.NewGuid().ToString(); } return(View(Order)); } catch (Exception Exp) { if (Exp.InnerException != null && Exp.InnerException.Message == "Duplicate Order Number") { ModelState.AddModelError("OrderNumber", Exp.Message); } else { ModelState.AddModelError("", Exp.Message); } SetViewBagItems(Order); int id = 0; var accountaddress = _accountServices.GetAllValidAccountContactsByAccountId(id, CurrentTenantId); ViewBag.AccountContactes = new SelectList(accountaddress, "AccountContactId", "ContactEmail", accountaddress.Select(x => x.AccountID).FirstOrDefault()); ViewBag.ForceRegeneratePageToken = "True"; ViewBag.ForceRegeneratedPageToken = shipmentAndRecipientInfo.PageSessionToken ?? Guid.NewGuid().ToString(); var directsales = _salesServices.GetDirectSaleOrders(null); ViewBag.DirectOrderList = new SelectList(directsales, "OrderID", "OrderNumber"); return(View(Order)); } }
public ActionResult Edit(int?id, string pageSessionToken = null) { if (!caSession.AuthoriseSession()) { return(Redirect((string)Session["ErrorUrl"])); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Order Order = OrderService.GetOrderById(id.Value); var accountaddressId = OrderService.GetAccountContactId(id.Value).ToList(); if (Order == null) { return(HttpNotFound()); } var list = OrderService.GetAccountContactId(id ?? 0).ToList(); var EmailAutoCheckedOnEdit = _tenantServices.GetTenantConfigById(CurrentTenantId).EmailAutoCheckedOnEdit; if (EmailAutoCheckedOnEdit) { if (list.Any()) { ViewBag.accountShip = true; } } int ids = 0; var accountaddress = _accountServices.GetAllValidAccountContactsByAccountId(ids, CurrentTenantId); ViewBag.AccountContactes = new SelectList(accountaddress, "AccountContactId", "ContactEmail"); ViewBag.AllowAccountAddress = caCurrent.CurrentWarehouse().AllowShipToAccountAddress; SetViewBagItems(Order, EnumAccountType.Supplier); if (string.IsNullOrEmpty(pageSessionToken)) { ViewBag.ForceRegeneratePageToken = "True"; ViewBag.ForceRegeneratedPageToken = Guid.NewGuid().ToString(); } var odList = OrderService.GetAllValidOrderDetailsByOrderId(id.Value).ToList(); GaneOrderDetailsSessionHelper.SetOrderDetailSessions(ViewBag.ForceRegeneratedPageToken, Mapper.Map(odList, new List <OrderDetailSessionViewModel>())); var odNotes = Order.OrderNotes.Where(a => a.IsDeleted != true).ToList(); GaneOrderNotesSessionHelper.SetOrderNotesSessions(ViewBag.ForceRegeneratedPageToken, odNotes); if (Order.ShipmentPropertyId.HasValue && Order.ShipmentPropertyId > 0) { ViewBag.IsShipmentToProperty = true; ViewBag.ShipmentPropertyId = Order.ShipmentPropertyId; } else if (Order.AccountAddressId.HasValue && Order.AccountAddressId > 0) { ViewBag.IsAccountAddressId = true; ViewBag.AccountAddressId = Order.AccountAddressId; } else if (Order.IsShippedToTenantMainLocation || Order.ShipmentWarehouseId != null) { ViewBag.IsShipmentToWarehouse = true; } else if (Order.IsCollectionFromCustomerSide) { ViewBag.IsCollectionFromCustomerSide = true; } else { ViewBag.IsShipmentToCustomAddress = true; } return(View(Order)); }
public ActionResult ClearPageSessionData(string id = null) { GaneOrderDetailsSessionHelper.ClearSessionTokenData(id); return(Json(true, JsonRequestBehavior.AllowGet)); }