public ActionResult NewChiTietPartial(EditableCTChungTu chitiet) { var userName = System.Web.HttpContext.Current.User.Identity.Name.ToString(); var Madvql = CCDCDataProvider.GetMadvql_ByUserName(userName); chitiet.STTCT = (int)Session["STTCT"]; chitiet.Madvql = Madvql; chitiet.MaCCDC = chitiet.TenCCDC.Split('-')[0]; chitiet.TenCCDC = chitiet.TenCCDC.Split('-')[1]; if (ModelState.IsValid) { try { CCDCDataProvider.InsertDetail(chitiet); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("CTChungTuNhapPartial", CCDCDataProvider.listCTChungtus(chitiet.STTCT))); }
public ActionResult UpdateNhapPartial(EditableCTChungTu chitiet) { var userName = System.Web.HttpContext.Current.User.Identity.Name; var Madvql = CCDCDataProvider.GetMadvql_ByUserName(userName); var maDonVi = CCDCDataProvider.getMaDonVi_fromChiTietCT(Madvql, (int)Session["STTCT"]); chitiet.Madonvi = maDonVi; chitiet.STTCT = (int)Session["STTCT"]; chitiet.Madvql = Madvql; if (chitiet.NguonVon == "XDCB") { chitiet.MaCCDC = chitiet.TenCCDC.Split('-')[0] + "_XDCB"; } else { chitiet.MaCCDC = chitiet.TenCCDC.Split('-')[0]; } chitiet.TenCCDC = chitiet.TenCCDC.Split('-')[1]; if (ModelState.IsValid) { try { CCDCDataProvider.UpdateDetail(chitiet); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Vui lòng nhập đầy nội dung trong (*)."; } return(PartialView("NhapDetailPartial", CCDCDataProvider.listCTChungtus(chitiet.STTCT))); }
public ActionResult UpdateThuHoiPartial(EditableCTChungTu chitiet) { var userName = System.Web.HttpContext.Current.User.Identity.Name.ToString(); var Madvql = CCDCDataProvider.GetMadvql_ByUserName(userName); var maDonVi = CCDCDataProvider.getMaDonVi_fromChiTietCT(Madvql, (int)Session["STTCT"]); chitiet.Madonvi = maDonVi; chitiet.STTCT = (int)Session["STTCT"]; chitiet.Madvql = Madvql; if (chitiet.NguonVon == "XDCB") { chitiet.MaCCDC = chitiet.TenCCDC.Split('-')[0].Substring(0, 8) + "_XDCB"; } else { chitiet.MaCCDC = chitiet.TenCCDC.Split('-')[0]; } chitiet.TenCCDC = chitiet.TenCCDC.Split('-')[1]; //**// // ViewData["SoLuong"] = chitiet.TenCCDC.Split('-')[0]; //**// int _SL = Convert.ToInt32(Session["newVariable"]); if (chitiet.Soluong > _SL) { ViewData["EditError"] = "Không được nhập quá số lượng hiện có của đơn vị. SL đơn vị hiện có: " + Convert.ToString(Session["newVariable"]); return(PartialView("ThuHoiDetailPartial", CCDCDataProvider.listCTChungtus(chitiet.STTCT))); } if (ModelState.IsValid) { try { CCDCDataProvider.UpdateDetail(chitiet); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Vui lòng nhập đầy nội dung trong (*)."; } return(PartialView("ThuHoiDetailPartial", CCDCDataProvider.listCTChungtus(chitiet.STTCT))); }
public ActionResult NewThanhLyPartial(EditableCTChungTu chitiet) { var userName = System.Web.HttpContext.Current.User.Identity.Name.ToString(); var Madvql = CCDCDataProvider.GetMadvql_ByUserName(userName); var maDonVi = CCDCDataProvider.getMaDonVi_fromChiTietCT(Madvql, (int)Session["STTCT"]); chitiet.Madonvi = maDonVi; chitiet.STTCT = (int)Session["STTCT"]; chitiet.SoCT = CCDCDataProvider.getSoCT(chitiet.STTCT); chitiet.Madvql = Madvql; if (chitiet.NguonVon == "XDCB") { chitiet.MaCCDC = chitiet.TenCCDC.Split('-')[0] + "_XDCB"; } else { chitiet.MaCCDC = chitiet.TenCCDC.Split('-')[0]; } chitiet.TenCCDC = chitiet.TenCCDC.Split('-')[1]; if (ModelState.IsValid) { try { CCDCDataProvider.InsertDetail(chitiet); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("ThanhLyDetailPartial", CCDCDataProvider.listCTChungtus(chitiet.STTCT))); }