コード例 #1
0
        public ActionResult Create()
        {
            OrderShipmentModel newShipment = SessionHelper.Shipment;

            if (newShipment == null)
            {
                newShipment = new OrderShipmentModel
                {
                    DeliveryDate   = DateTime.Now,
                    CompanyId      = AuthenticationHelper.CompanyId.Value,
                    OrderShipments = new List <OrderShipmentLine>()
                };
                SessionHelper.Shipment = newShipment;
            }

            newShipment.Customers = CustomerHelper.GetActiveCustomersCombo(newShipment.DeliveryDate);
            if (newShipment.Customers != null && newShipment.Customers.Count() > 0)
            {
                newShipment.CustomerId = newShipment.CustomerId > 0 ? newShipment.CustomerId : 0;
                newShipment.Customers.Add(new SelectListItem {
                    Text = "-- Select --", Value = "0"
                });
                newShipment.CustomerSites = CustomerHelper.GetCustomerSitesCombo(newShipment.CustomerId);
                if (newShipment.CustomerSites != null && newShipment.CustomerSites.Count() > 0)
                {
                    newShipment.CustomerSiteId = newShipment.CustomerSiteId > 0 ? newShipment.CustomerSiteId : 0;
                    newShipment.CustomerSites.Add(new SelectListItem {
                        Text = "-- Select --", Value = "0"
                    });
                }
            }

            newShipment.Orders = OrderHelper.GetOrdersCombo();
            if (newShipment.Orders != null && newShipment.Orders.Count() > 0)
            {
                newShipment.OrderId = newShipment.OrderId > 0 ? newShipment.OrderId : 0;
                newShipment.Orders.Add(new SelectListItem {
                    Text = "-- Select --", Value = "0"
                });
            }

            newShipment.Warehouses = WarehouseHelper.GetWarehousesCombo(SessionHelper.SOBId);
            if (newShipment.Warehouses != null && newShipment.Warehouses.Count() > 0)
            {
                newShipment.WarehouseId = newShipment.WarehouseId > 0 ? newShipment.WarehouseId : Convert.ToInt64(newShipment.Warehouses.First().Value);
            }

            newShipment.DeliveryNo = "New";
            SessionHelper.Shipment = newShipment;
            SessionHelper.Shipment.OrderShipments = ShipmentHelper.GetShipment(newShipment.WarehouseId, newShipment.CustomerId, newShipment.CustomerSiteId, newShipment.OrderId).OrderShipments;

            return(View("Edit", newShipment));
        }
コード例 #2
0
 public ActionResult DetailPartialParams(long warehouseId, long customerId, long customerSiteId, long orderId)
 {
     SessionHelper.Shipment.OrderShipments = ShipmentHelper.GetShipment(warehouseId, customerId, customerSiteId, orderId).OrderShipments;
     return(PartialView("_Detail", SessionHelper.Shipment.OrderShipments));
 }