// 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); }
public ActionResult DeleteConfirmed(int id, string returnUrl) { PoPlan poPlan = db.PoPlans.Find(id); db.PoPlans.Remove(poPlan); db.SaveChanges(); LogDeletePoPlanActivity(poPlan); return(Redirect(returnUrl)); }
//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); }
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); }
//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()); }
// 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)); }
// 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)); }