public ActionResult TemplateExternalEditForm(TemplatesWO item) { var model = db.TemplatesWOes; // var selectedBillTo = item.BillTo.Split(','); // var bills = db.Contacts.Where(it => selectedBillTo.Contains(it.ContactID.ToString())).Select(it => it.Company).ToList(); if (ModelState.IsValid) { try { //foreach (var billTo in bills) //{ // item.BillTo = billTo; var modelItem = model.FirstOrDefault(it => it.ID == item.ID); if (modelItem != null) { this.UpdateModel(modelItem); } // } db.SaveChanges(); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(RedirectToAction("Index")); }
public ActionResult Create() { TemplatesWO model = new TemplatesWO(); model.ID = db.TemplatesWOes.Max(itm => itm.ID); model.ID = model.ID + 1; model.DateUpdated = DateTime.Now; model.DateCreated = DateTime.Now; var result1 = WebApiManager.GetRequest <List <string> >(WebApiRequests.BillTo); ViewBag.BillTo = result1; var result2 = WebApiManager.GetRequest <List <string> >(WebApiRequests.Origin); ViewBag.Origin = result2; var result3 = WebApiManager.GetRequest <List <string> >(WebApiRequests.Destination); ViewBag.Destination = result3; var result4 = WebApiManager.GetRequest <List <string> >(WebApiRequests.TypeOfMove); ViewBag.TypeOfMove = result4; var result5 = WebApiManager.GetRequest <List <string> >(WebApiRequests.EquipmentPickup); ViewBag.EquipmentPickup = result5; var result6 = WebApiManager.GetRequest <List <string> >(WebApiRequests.EquipmentProvider); ViewBag.EquipmentProvider = result6; var result7 = WebApiManager.GetRequest <List <string> >(WebApiRequests.EquipmentReturn); ViewBag.EquipmentReturn = result7; var result8 = WebApiManager.GetRequest <List <string> >(WebApiRequests.EquipmentSize); ViewBag.EquipmentSize = result8; var result9 = WebApiManager.GetRequest <List <string> >(WebApiRequests.ChassisProvider); ViewBag.ChassisProvider = result9; var result10 = WebApiManager.GetRequest <List <string> >(WebApiRequests.Broker); ViewBag.Broker = result10; return(View(model)); }
public ActionResult Create([ModelBinder(typeof(DevExpress.Web.Mvc.DevExpressEditorsBinder))] TemplatesWO item) { //item.StreetTurn = true; //item.BOL = true; var model = db.TemplatesWOes; if (ModelState.IsValid) { try { model.Add(item); db.SaveChanges(); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(Redirect("Index")); }
public ActionResult SaveAsTemplate(WorkOrder item) { TemplatesWO item1 = new TemplatesWO(); // item1.WorkOrderID = item.WorkOrderID; // item1.WorkOrderNo = item.WorkOrderNo; // item1.AcceptedByDispatch = item.AcceptedByDispatch; // item1.ApptNumber = item.ApptNumber; //item1.ApptTime = item.ApptTime; //item1.BilledAmount = item.BilledAmount; item1.TemplateName = "A" + item.WorkOrderNo.ToString(); item1.BillTo = item.BillTo; //item1.BOL = item.BOL; // item1.Booking = item.Booking; // item1.Broker = item.Broker; //item1.Chassis = item.Chassis; item1.ChassisProvider = item.ChassisProvider; //item1.Commodity = item.Commodity; //item1.Completed = item.Completed; //item1.Container1 = item.Container1; //item1.Container2 = item.Container2; item1.CreatedBy = item.CreatedBy; //item1.Cutoff = item.Cutoff; // item1.DateCreated = DateTime.Now; // item1.DatePaid = item.DatePaid; // item1.DateUpdated =DateTime.Now; item1.Destination = item.Destination; // item1.Duration = item.Duration; item1.EquipmentPickup = item.EquipmentPickup; item1.EquipmentProvider = item.EquipmentProvider; item1.EquipmentReturn = item.EquipmentReturn; item1.EquipmentSize = item.EquipmentSize; //item1.ETA = item.ETA; //item1.InfoSymbol = item.InfoSymbol; //item1.IngateReceipt = item.IngateReceipt; //item1.InvoicedDate = item.InvoicedDate; //item1.LinkedProNum = item.LinkedProNum; item1.LocationHours = item.LocationHours; //item1.MasterBOL = item.MasterBOL; //item1.NotesInvoice = item.NotesInvoice; //item1.NotesPrivate = item.NotesPrivate; item1.Origin = item.Origin; //item1.OutgateReceipt = item.OutgateReceipt; //item1.PerDiemLFD = item.PerDiemLFD; //item1.PieceCount = item.PieceCount; //item1.PO = item.PO; //item1.POD1 = item.POD1; //item1.POD2 = item.POD2; //item1.Pro = item.Pro; //item1.RejectedByDispatch = item.RejectedByDispatch; //item1.Reference = item.Reference; //item1.ReadyNotification = item.ReadyNotification; //item1.Release = item.Release; //item1.Seal = item.Seal; //item1.Status = item.Status; //item1.StorageLFD = item.StorageLFD; //item1.StreetTurn = item.StreetTurn; item1.TypeOfMove = item.TypeOfMove; item1.UpdatedBy = item.UpdatedBy; //item1.Uploaded = item.Uploaded; //item1.Weight = item.Weight; var model = db.TemplatesWOes; if (ModelState.IsValid) { try { model.Add(item1); db.SaveChanges(); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(View("Index", "Templates")); //return RedirectToAction ("WorkOrderExternalEditForm", item.WorkOrderID); }