Example #1
0
 public ActionResult Create(FormCollection fc, CSF_RoleFunction obj)
 {
     try
     {
         //if (!this.HasPermission) return RedirectToAction("Unauthorized", "Home");
         if (ModelState.IsValid)
         {
             CSF_RoleFunction_DAO objRFDAO = new CSF_RoleFunction_DAO();
             if (objRFDAO.CheckExist_RF(obj))
             {
                 SetAlert("Nhóm - Chức năng đã tồn tại!", AlertType.Error);
             }
             else
             {
                 int ReturnID = objRFDAO.Insert(obj);
                 if (ReturnID > 0)
                 {
                     SetAlert("Thêm Nhóm - Chức năng thành công", AlertType.Success);
                     return(RedirectToAction("Index", "QT_RoleFunction"));
                 }
                 else
                 {
                     SetAlert("Thêm Nhóm - Chức năng không thành công", AlertType.Error);
                 }
             }
         }
         return(View());
     }
     catch (Exception ex)
     {
         SetAlert("Lỗi" + ex.Message.ToString(), AlertType.Error);
         Logs.WriteLog(ex);
         return(View());
     }
 }
Example #2
0
 public ActionResult Create()
 {
     try
     {
         CSF_RoleFunction_DAO objFunctionsDAO = new CSF_RoleFunction_DAO();
         DT_WebGISEntities    MyContext       = new DT_WebGISEntities();
         TempData["nhomNguoiDung"] = MyContext.CSF_Roles.OrderBy(x => x.Name).ToList();
         TempData.Keep("nhomNguoiDung");
         TempData["chucNang"] = MyContext.CSF_Functions_LayTatCa().ToList().OrderBy(x => x.Name).ToList();
         TempData.Keep("chucNang");
         return(View());
     }
     catch (Exception ex)
     {
         SetAlert("Lỗi" + ex.Message.ToString(), AlertType.Error);
         Logs.WriteLog(ex);
         return(View());
     }
 }
Example #3
0
 //[CheckPermission]
 public JsonResult SaveRoleFunction(string RoleID, string ModuleID, string FuncIDs)
 {
     try
     {
         int ROLEID               = Convert.ToInt32(RoleID);
         int MODULEID             = Convert.ToInt32(ModuleID);
         CSF_RoleFunction_DAO dao = new CSF_RoleFunction_DAO();
         int result               = dao.AddPermission(ROLEID, MODULEID, FuncIDs);
         if (result > 0)
         {
             return(Json(new { state = true, message = "Gán quyền chức năng thành công" }, JsonRequestBehavior.AllowGet));
         }
         return(Json(new { state = false, message = "Lỗi gán quyền chức năng" }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { state = false, message = ex }, JsonRequestBehavior.AllowGet));
     }
 }
Example #4
0
 public ActionResult Index(string search, int?page)
 {
     try
     {
         CSF_RoleFunction_DAO objR_FDAO = new CSF_RoleFunction_DAO();
         List <CSF_RoleFunction_LayTatCa_Result> lRF = objR_FDAO.Search(search);
         ViewBag.search = search;
         int pageSize   = 10;
         int pageNumber = (page ?? 1);
         //functions = functions.OrderBy(s => s.ID);
         var test = lRF.ToPagedList(pageNumber, pageSize);
         int a    = test.Count();
         return(View(test));
     }
     catch (Exception ex)
     {
         SetAlert("Lỗi" + ex.Message.ToString(), "error");
         Logs.WriteLog(ex);
         return(View());
     }
 }
Example #5
0
 public JsonResult Delete(int id)
 {
     try
     {
         //if (!this.HasPermission) return RedirectToAction("Unauthorized", "Home");
         CSF_RoleFunction_DAO objRF = new CSF_RoleFunction_DAO();
         if (objRF.Delete(id))
         {
             SetAlert("Xóa Nhóm - Chức năng thành công", AlertType.Success);
             return(Json(new { status = true, message = "" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { status = false, message = "Lỗi xóa Nhóm - Chức năng" }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         Logs.WriteLog(ex);
         return(Json(new { status = false, message = "Lỗi: " + ex }, JsonRequestBehavior.AllowGet));
     }
 }