Example #1
0
        // GET: PoPlans/Edit/5
        public ActionResult Edit(int?id)
        {
            ViewBag.ReturnUrl = Request.UrlReferrer;
            var poplans = db.PoPlans.SingleOrDefault(c => c.PoPlanId == id);

            var statuses          = db.PoOrderStatuses.ToList();
            var customers         = db.Customers.ToList();
            var customerdivisions = db.CustomerDivisions.ToList();
            var mlsdivisions      = db.MlsDivisions.ToList();
            var suppliers         = db.Suppliers.ToList();

            var viewModel = new SavePoPlanViewModel()
            {
                PoPlan            = poplans,
                Customers         = customers,
                CustomerDivisions = customerdivisions,
                MlsDivisions      = mlsdivisions,
                PoOrderStatuses   = statuses,
                Suppliers         = suppliers
            };

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PoPlan poPlan = db.PoPlans.Find(id);

            if (poPlan == null)
            {
                return(HttpNotFound());
            }
            return(View("Edit", viewModel));
            //return View(poPlan);
        }
Example #2
0
        public ActionResult DeleteConfirmed(int id, string returnUrl)
        {
            PoPlan poPlan = db.PoPlans.Find(id);

            db.PoPlans.Remove(poPlan);
            db.SaveChanges();
            LogDeletePoPlanActivity(poPlan);
            return(Redirect(returnUrl));
        }
Example #3
0
 //public ActionResult Edit([Bind(Include = "PoPlanId,PoNumber,PoLine,SupplierId,CustomerOrderNumber,SoNumber,OrderDateTime,CustomerId,CustomerDivisionId,MlsDivisionId,CustomerPn,UhPn,PartDescription,OrderQty,ReceivedQty,RequestedDateTime,PromiseDateTime,ReceiptDateTime,PoOrderStatusId,Notes")] PoPlan poPlan)
 public ActionResult Edit(PoPlan poPlan, string returnUrl)
 {
     if (ModelState.IsValid)
     {
         db.Entry(poPlan).State = EntityState.Modified;
         db.SaveChanges();
         LogEditPoPlanActivity(poPlan);
         return(Redirect(returnUrl));
         //return RedirectToAction("PoPlanStatus");
     }
     return(View());
     //return View(poPlan);
 }
Example #4
0
        public ActionResult LogDeletePoPlanActivity(PoPlan poPlan)
        {
            var currentUser = User.Identity.GetUserName();
            var logDateTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"));
            var eventType   = "Delete";

            PoPlanLog poPlanLog = new PoPlanLog();

            poPlanLog.User                = currentUser;
            poPlanLog.EventDateTime       = logDateTime;
            poPlanLog.EventType           = eventType;
            poPlanLog.PoPlanId            = poPlan.PoPlanId;
            poPlanLog.PoNumber            = poPlan.PoNumber;
            poPlanLog.PoLine              = poPlan.PoLine;
            poPlanLog.CustomerId          = poPlan.CustomerId;
            poPlanLog.CustomerDivisionId  = poPlan.CustomerDivisionId;
            poPlanLog.MlsDivisionId       = poPlan.MlsDivisionId;
            poPlanLog.CustomerPn          = poPlan.CustomerPn;
            poPlanLog.UhPn                = poPlan.UhPn;
            poPlanLog.SupplierId          = poPlan.SupplierId;
            poPlanLog.CustomerOrderNumber = poPlan.CustomerOrderNumber;
            poPlanLog.SoNumber            = poPlan.SoNumber;
            poPlanLog.OrderQty            = poPlan.OrderQty;
            poPlanLog.ReceivedQty         = poPlan.ReceivedQty;
            poPlanLog.ContainerId         = poPlan.ContainerId;
            poPlanLog.OrderDateTime       = poPlan.OrderDateTime;
            poPlanLog.ContainerUh         = poPlan.ContainerUh;
            poPlanLog.AMS                 = poPlan.AMS;
            poPlanLog.ArrivalWk           = poPlan.ArrivalWk;
            poPlanLog.BOL                 = poPlan.BOL;
            poPlanLog.Destination         = poPlan.Destination;
            poPlanLog.Etadate             = poPlan.Etadate;
            poPlanLog.FreightFowarder     = poPlan.FreightFowarder;
            poPlanLog.Invoice             = poPlan.Invoice;
            poPlanLog.Pallet              = poPlan.Pallet;
            poPlanLog.PartDescription     = poPlan.PartDescription;
            poPlanLog.PoConfirmedBy       = poPlan.PoConfirmedBy;
            poPlanLog.RequestedDateTime   = poPlan.RequestedDateTime;
            poPlanLog.ReceiptDateTime     = poPlan.ReceiptDateTime;
            poPlanLog.Shipdate            = poPlan.Shipdate;
            poPlanLog.PromiseDateTime     = poPlan.PromiseDateTime;
            poPlanLog.PoSentDateTime      = poPlan.PoSentDateTime;
            poPlanLog.PoSentBy            = poPlan.PoSentBy;
            poPlanLog.PoOrderStatusId     = poPlan.PoOrderStatusId;
            poPlanLog.PoConfirmedDateTime = poPlan.PoConfirmedDateTime;
            poPlanLog.Notes               = poPlan.Notes;

            db.PoPlanLogs.Add(poPlanLog);
            db.SaveChanges();
            return(null);
        }
Example #5
0
        //public ActionResult Create([Bind(Include = "PoPlanId,PoNumber,PoLine,SupplierId,CustomerOrderNumber,SoNumber,OrderDateTime,CustomerId,CustomerDivisionId,MlsDivisionId,CustomerPn,UhPn,PartDescription,OrderQty,ReceivedQty,RequestedDateTime,PromiseDateTime,ReceiptDateTime,PoOrderStatusId,Notes")] PoPlan poPlan)
        public ActionResult Create(PoPlan poPlan, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                db.PoPlans.Add(poPlan);
                db.SaveChanges();
                LogCreatePoPlanActivity(poPlan);
                return(Redirect(returnUrl));
                //return RedirectToAction("PoPlanStatus");
            }

            //return View(poPlan);
            return(View());
        }
Example #6
0
        // GET: PoPlans/Details/5
        public ActionResult RoDetails(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PoPlan poPlan = db.PoPlans.Find(id);

            if (poPlan == null)
            {
                return(HttpNotFound());
            }
            return(View(poPlan));
        }
Example #7
0
        // GET: PoPlans/Delete/5
        public ActionResult Delete(int?id)
        {
            ViewBag.ReturnUrl = Request.UrlReferrer;
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PoPlan poPlan = db.PoPlans.Find(id);

            if (poPlan == null)
            {
                return(HttpNotFound());
            }
            return(View(poPlan));
        }