private ActionResult WBlod() { var model = new WBill(); model.EntityWBill = new WayBill(); model.WRNs = new SelectList(new List <WarehouseRelease>(), "Id", "RefNumber"); model.Warehouses = new SelectList(SessionData.CurrentSession.WarehouseList, "Id", "Name"); model.Staff = new SelectList(staffService.GetStaffByCountryProgramme(countryProg.Id), "StaffId", "StaffName"); model.IssuingOffice = new SelectList(WBService.GetSubOffices(countryProg.Id), "Id", "Name"); model.EntityWBill.RefNumber = string.Format("--{0}--", Resources.Global_String_NewWB); return(View("LoadWB", model)); }
public ActionResult SaveWBill(WBill modelEntity) { if (this.IsWRNAdded(modelEntity.EntityWBill.WRNId)) { modelEntity.EntityWBill.IsReceived = false; modelEntity.EntityWBill.Id = Guid.NewGuid(); modelEntity.EntityWBill.CountryProgrammeId = countryProg.Id; modelEntity.EntityWBill.PreparedBy = currentStaff.Id; modelEntity.EntityWBill.PreparedOn = DateTime.Now; modelEntity.EntityWBill.RefNumber = WBService.GenerateUniquNumber(countryProg); if (WBService.SaveWB(modelEntity.EntityWBill)) { ViewBag.Response = 1; ViewBag.msg = Resources.Global_String_ProcessCompleted; } ModelState.Clear(); } else { ViewBag.Response = 0; ViewBag.msg = Resources.WayBillController_String_WayBillAreadyCreated; return(WBlod()); } return(LoadWBindex()); }