public ActionResult _CreateOrUpdate(CongThongTinDienTu_Huyen obj) { return View(obj); }
public async Task<ActionResult> Edit(CongThongTinDienTu_Huyen congThongTinDienTuHuyen) { var user = S4T_HaTinhBase.GetUserSession(); if (user == null) return RedirectToAction("Login", "Account", new { returnUrl = Request.Url.PathAndQuery }); var per = S4T_HaTinhBase.CheckPermission(Request.RequestContext.RouteData.GetRequiredString("controller")); if (per != PermissionType.Write) return Content(ExceptionViewer.GetMessage("UPDATE_NOT_PERMISSION")); if (ModelState.IsValid) { var mess = CheckReportStatus(user, TrangThaiNhapLieu.Sua); if (String.IsNullOrEmpty(mess)) { try { using (var context = new S4T_HaTinhEntities()) { congThongTinDienTuHuyen.Success = (byte)TrangThaiNhapLieu.DaGui; //haTangNhanLucCNTT.TruongNhapLai = string.Empty; // Xóa hết các yêu cầu nhập lại dữ liệu context.Entry(congThongTinDienTuHuyen).State = EntityState.Modified; await context.SaveChangesAsync(); } // Đổi trạng thái nhập liệu trong bảng lịch nhập liệu var objLichNhap = db.Ht_LichNhapLieu.FirstOrDefault(o => o.TrangThai == TrangThai.HoatDong && o.DonVi_ID == congThongTinDienTuHuyen.DonVi_ID && o.PhanHe_ID == objChucNang.PhanHeChucNang_ID && o.ChucNang_ID != TrangThaiNhapLieu.PheDuyet); objLichNhap.ChucNang_ID = TrangThaiNhapLieu.DaGui; db.Entry(objLichNhap).State = EntityState.Modified; await db.SaveChangesAsync(); return RedirectToAction("Index"); } catch (Exception ex) { var exv = new ExceptionViewer(ex); return Json(new { //msg = exv.GetErrorMessage(ex.Message) msg = exv.GetErrorMessage("Có lỗi dữ liệu xảy ra") }); } } return Content(mess); } GetViewBag(user.DonVi_ID); return View(congThongTinDienTuHuyen); }
// GET: CongThongTinDienTu_Huyen/Create public ActionResult Create() { var user = S4T_HaTinhBase.GetUserSession(); if (user == null) return RedirectToAction("Login", "Account", new { returnUrl = Request.Url.PathAndQuery }); var per = S4T_HaTinhBase.CheckPermission(Request.RequestContext.RouteData.GetRequiredString("controller")); if (per != PermissionType.Write) return Content(ExceptionViewer.GetMessage("UPDATE_NOT_PERMISSION")); GetViewBag(user.DonVi_ID); var mess = CheckReportStatus(user, TrangThaiNhapLieu.ThemMoi); if (String.IsNullOrEmpty(mess)) { CongThongTinDienTu_Huyen obj = new CongThongTinDienTu_Huyen(); obj.Success = (byte)TrangThaiNhapLieu.ThemMoi; obj.DonVi_ID = user.DonVi_ID; return View(obj); } return Content(mess); }
public async Task<ActionResult> Create(CongThongTinDienTu_Huyen congThongTinDienTu_Huyen) { var user = S4T_HaTinhBase.GetUserSession(); if (user == null) return RedirectToAction("Login", "Account", new { returnUrl = Request.Url.PathAndQuery }); var per = S4T_HaTinhBase.CheckPermission(Request.RequestContext.RouteData.GetRequiredString("controller")); if (per != PermissionType.Write) return Content(ExceptionViewer.GetMessage("UPDATE_NOT_PERMISSION")); if (ModelState.IsValid) { var mess = CheckReportStatus(user, TrangThaiNhapLieu.ThemMoi); if (String.IsNullOrEmpty(mess)) { var objLichNhap = db.Ht_LichNhapLieu.FirstOrDefault(o => o.TrangThai == TrangThai.HoatDong && o.DonVi_ID == congThongTinDienTu_Huyen.DonVi_ID && o.PhanHe_ID == objChucNang.PhanHeChucNang_ID && o.ChucNang_ID != TrangThaiNhapLieu.PheDuyet); // Đổi trạng thái nhập liệu congThongTinDienTu_Huyen.Success = (byte)TrangThaiNhapLieu.DaGui; congThongTinDienTu_Huyen.LichNhap_ID = objLichNhap.LichNhap_ID; // Add LichNhap_ID vào báo cáo db.CongThongTinDienTu_Huyen.Add(congThongTinDienTu_Huyen); // Đổi trạng thái nhập liệu trong bảng lịch nhập liệu //objLichNhap.BaoCao_ID = congThongTinDienTu.CongThongTinDienTu_ID; objLichNhap.ChucNang_ID = TrangThaiNhapLieu.DaGui; db.Entry(objLichNhap).State = EntityState.Modified; await db.SaveChangesAsync(); return RedirectToAction("Index"); } return Content(mess); } GetViewBag(user.DonVi_ID); return View(congThongTinDienTu_Huyen); }
// GET: CongThongTinDienTu_Huyen/Details/5 public async Task<ActionResult> Details(int? id, int? donVi_ID, int? lichNhap_ID) { var returnUrl = Request.UrlReferrer; if (returnUrl != null) ViewBag.returnUrl = returnUrl.ToString(); var user = S4T_HaTinhBase.GetUserSession(); if (user == null) if (user == null) return RedirectToAction("Login", "Account", new { returnUrl = Request.Url.PathAndQuery }); var per = S4T_HaTinhBase.CheckPermission(Request.RequestContext.RouteData.GetRequiredString("controller")); if (per == PermissionType.Deny) { // Kiểm tra thêm quyền là Thẩm định báo cáo ? per = S4T_HaTinhBase.CheckPermissionAdmin(LoaiBaoCao.UngDungCNTT); if (per == PermissionType.Deny) return Content(ExceptionViewer.GetMessage("VIEW_NOT_PERMISSION")); } var congThongTinDienTu_Huyen = new CongThongTinDienTu_Huyen(); if (id == null) { if (lichNhap_ID == null) return new HttpStatusCodeResult(HttpStatusCode.BadRequest); else congThongTinDienTu_Huyen = await db.CongThongTinDienTu_Huyen.FirstOrDefaultAsync(o => o.LichNhap_ID == lichNhap_ID && o.DonVi_ID == donVi_ID); } else congThongTinDienTu_Huyen = await db.CongThongTinDienTu_Huyen.FindAsync(id); GetViewBag(congThongTinDienTu_Huyen.DonVi_ID); if (congThongTinDienTu_Huyen == null) { return HttpNotFound(); } return View(congThongTinDienTu_Huyen); }