Example #1
0
        public ActionResult CompleteProvisionalPo()
        {
            int id = Convert.ToInt32(Session["Provisional_POId"]);

            Session["Provisional_POId"] = null;

            //TODO: Save Provisional Po Data


            ProvisionalPurchaseOrder provisionalPurchaseOrder = new ProvisionalPurchaseOrder()
            {
                POItemsDetail = new List <ProvisionalPOItemsDetail>()
            };

            return(PartialView("~/Areas/Procurement/Views/ProcurementPurchase/_AcceptProvisionalPOLst.cshtml", provisionalPurchaseOrder));
        }
Example #2
0
        public ActionResult AddProvisionalPo()
        {
            if (Session["ProvisionalPurchaseOrderId"] != null)
            {
                int id = (int)Session["ProvisionalPurchaseOrderId"];

                ProvisionalPurchaseOrder provisionalPurchaseOrder = db.ProvisionalPurchaseOrder
                                                                    .Where(p => p.Id == id)
                                                                    .Include(p => p.POItemsDetail)
                                                                    .Include(p => p.Suppliers)
                                                                    .FirstOrDefault();
                //perform explicit loading
                foreach (var item in provisionalPurchaseOrder.POItemsDetail)
                {
                    db.Entry(item).Reference(x => x.Drug).Load();
                }

                ProvisionalPurchaseOrderViewModel model = new ProvisionalPurchaseOrderViewModel()
                {
                    Suppliers = db.supplier.ToList(),
                    ProvisionalPOItemsDetail = provisionalPurchaseOrder.POItemsDetail
                };


                return(View(model));
            }
            else
            {
                ProvisionalPurchaseOrderViewModel model = new ProvisionalPurchaseOrderViewModel()
                {
                    Suppliers = db.supplier.ToList(),
                    ProvisionalPOItemsDetail = new List <ProvisionalPOItemsDetail>()
                };

                return(View(model));
            }
        }