public ActionResult ImportEdit(long id) { var accDoc = new AccDocDao().GetByID(id); ViewBag.ListDetail = new AccDocDetailDao().ListDetail(accDoc.DocCode, accDoc.DocNo); return(View(accDoc)); }
////Display, create, edit, delete Inventory //Index page of Inventory management public ActionResult ImportIndex(string searchString, string docCode = "IM", int page = 1, int pageSize = 10) { var dao = new AccDocDao(); var model = dao.ListAllPaging(docCode, searchString, page, pageSize); ViewBag.SearchString = searchString; ViewBag.PageSize = pageSize; return(View(model)); }
public ActionResult Delete(long id) { var accDoc = new AccDocDao().GetByID(id); new AccDocDetailDao().RemoveDetail(accDoc.DocNo); new InventoryDao().RemoveDetail(accDoc.DocNo); new AccDocDao().Delete(id); return(RedirectToAction("ImportIndex")); }
public ActionResult ImportCreate(AccDoc accDoc) { if (ModelState.IsValid) { var dao = new AccDocDao(); long id = dao.Insert(accDoc); accDoc.DocNo = dao.UpdateDocNo(accDoc.DocCode, id); if (accDoc.ID > 0) { SetAlert("Create a new AccDoc successfully.", "success"); } else { ModelState.AddModelError("", "Create a new AccDoc failed."); return(RedirectToAction("ImportCreate", "Inventory")); } } else { SetAlert("Please verify all fields", "error"); } ViewBag.DocNo = accDoc.DocNo; return(View(accDoc)); }
public ActionResult ImportEdit(AccDoc accDoc) { if (ModelState.IsValid) { var dao = new AccDocDao(); bool result = dao.Update(accDoc); accDoc.DocNo = dao.UpdateDocNo(accDoc.DocCode, accDoc.ID); if (result) { SetAlert("Update the AccDoc successfully.", "success"); } else { ModelState.AddModelError("", "Update the AccDoc failed."); return(RedirectToAction("ImportEdit", "Inventory")); } } else { SetAlert("Please verify all fields", "error"); } ViewBag.ListDetail = new AccDocDetailDao().ListDetail(accDoc.DocCode, accDoc.DocNo); return(View(accDoc)); }