//suwar ham FunctionInGroupsGetAll 10.28.08 public ActionResult FunctionOfGroupList() { try { ViewBag.tabFocus = 2; GroupFunctionBL _funcg = new GroupFunctionBL(); GroupsBL _groups = new GroupsBL(); //KIỂM TRA QUYỀN TRUY CẬP VÀ SESSION string _ip = Request.UserHostAddress; string _url = "/ModuleUser/GroupsUser/GroupUserList"; string _ok = CommonFunc.Nvs_Redirect_QuyenTruyCapUser(_url, _ip); if (_ok != "") { return(Redirect(_ok)); } if (!RouteData.Values.ContainsKey("id")) { return(View(new List <Functions_Info>())); } int idGroup = Convert.ToInt32(RouteData.Values["id"]); CommonData.gLstGroups = _groups.GroupsGetAll(); foreach (var item in CommonData.gLstGroups) { if (item.Group_Id == idGroup) { ViewBag.GroupInfo = item; break; } } //Kieemr tra xem nếu là nhóm nó được phân thì chỉ có quyền xem kod dc sửa nếu nó tạo thì đc phép sửa ViewBag.Created = true; int CreateOwner = 1; //nếu là nhóm nó tạo thì hiển thị hết lên để hiệu chỉnh phan quyền //còn ko phải thì chỉ lấy danh sách các nhóm thuộc nó đc phân thôi Hashtable _HSFuncInGroup = new Hashtable(); _HSFuncInGroup = _funcg.FunctionInGroupsGetAll(idGroup); ViewBag.FuncInGroup = _HSFuncInGroup; SessionData.CurrentUser.User_Id = -99; //hungtd-12/11/2015:lấy ứng dụng ViewBag.FuncNotInGroup = _funcg.FunctionNotInGroupsByAppGetAll(idGroup, SessionData.CurrentUser.User_Id, CreateOwner); //end HUNGTD ViewBag.IDGroup = idGroup; string keyFuncInGroup = "FuncInGroup" + idGroup.ToString(); string keyFuncNotInGroup = "FuncNotInGroup" + idGroup.ToString(); Session[keyFuncNotInGroup] = ViewBag.FuncNotInGroup; Session[keyFuncInGroup] = ViewBag.FuncInGroup; return(View()); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(View(new List <GroupFunction_Info>())); } }
public ActionResult SearchGroups(string p_name) { try { //ViewBag.tabFocus = 2; GroupsBL _group = new GroupsBL(); if (p_name == "") { return(PartialView("PartialTableListGroups", CommonData.gLstGroups)); } List <Groups_Info> _lst_result_search = new List <Groups_Info>(); if (p_name != "") { foreach (Groups_Info item in CommonData.gLstGroups) { if (item.Group_Name.ToLower().Contains(p_name.ToLower())) { _lst_result_search.Add(item); } } } return(PartialView("PartialTableListGroups", _lst_result_search)); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(Json(new { success = false, status = -3 })); } }
/// <summary> /// DANH SACH NHÓM QUYỀN /// </summary> /// <returns></returns> public ActionResult GroupUserList() { try { //string _url = "/VSD/USER/USERLIST"; string _url = Request.RawUrl; string _ip = Request.UserHostAddress; string _ok = CommonFunc.Nvs_Redirect_QuyenTruyCapUser(_url, _ip); if (_ok != "") { return(Redirect(_ok)); } ViewBag.tabFocus = 2; GroupsBL _group = new GroupsBL(); CommonData.gLstGroups = _group.GroupsGetAll(); CommonData.GetlstUserOfGroupAll(); Session["lstGroups"] = CommonData.gLstGroups; return(View(CommonData.gLstGroups)); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(View(new List <Groups_Info>())); } }
//hma get public static List <Groups_Info> GetLstGroups() { try { GroupsBL _groups = new GroupsBL(); gLstGroups = _groups.GroupsGetAll(); return(gLstGroups); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(new List <Groups_Info>()); } }
public ActionResult GroupUserAddNew(string p_name, string p_note) { try { GroupsBL _group = new GroupsBL(); decimal pretun = _group.GroupsInsert(p_name, p_note, SessionData.CurrentUser.User_Name, DateTime.Now, SessionData.CurrentUser.User_Id); return(Json(new { success = pretun })); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(Json(new { success = -1 })); } }
public ActionResult GroupUserEdit(int p_id, string p_name, string p_note) { try { //ViewBag.tabFocus = 2; GroupsBL _group = new GroupsBL(); decimal preturn = _group.GroupsUpdate(p_id, p_name, p_note, SessionData.CurrentUser.User_Name, DateTime.Now); return(Json(new { success = preturn })); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(Json(new { success = -1 })); } }
public ActionResult GroupsDelete(int pId) { try { ViewBag.tabFocus = 2; GroupsBL _groups = new GroupsBL(); decimal preturn = _groups.GroupsDelete(pId); string purl = "/ModuleUser/GroupsUser/GroupUserList"; return(Json(new { success = preturn, url = purl })); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(View()); } }
public ActionResult FunctionOfGroupListByUser() { try { ViewBag.tabFocus = 2; GroupFunctionBL _funcg = new GroupFunctionBL(); GroupsBL _groups = new GroupsBL(); //KIỂM TRA QUYỀN TRUY CẬP CHỈ ĐẢY VÀO CÁC HÀM GET KO ĐẨY VÀO HAM POST string _ip = Request.UserHostAddress; string _url = "/ModuleUser/FunctionOfGroups/FunctionOfGroupList"; string _ok = CommonFunc.Nvs_Redirect_QuyenTruyCapUser(_url, _ip); if (_ok != "") { return(Redirect(_ok)); } if (!RouteData.Values.ContainsKey("id")) { return(View(new List <Functions_Info>())); } int idGroup = Convert.ToInt32(RouteData.Values["id"]); foreach (var item in CommonData.GetLstGroups()) { if (item.Group_Id == idGroup) { ViewBag.GroupInfo = item; break; } } //danh sach chuc nang thuoc nhom 10:28.08.2015 ViewBag.LstFuncInGroup = _funcg.FunctionInGroupsGetAll(idGroup); ViewBag.IDGroup = idGroup; string keyFuncInGroup = "FuncInGroup" + idGroup.ToString(); Session[keyFuncInGroup] = ViewBag.LstFuncInGroup; return(View()); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(View(new List <GroupFunction_Info>())); } }
public ActionResult GroupUserEdit() { try { ViewBag.tabFocus = 2; if (SessionData.CurrentUser == null) { return(Redirect("~/Home/Voting")); } if (!RouteData.Values.ContainsKey("id")) { return(View(new Groups_Info())); } int idGroups = Convert.ToInt32(RouteData.Values["id"].ToString()); List <Groups_Info> lstGroups = new List <Groups_Info>(); if (Session["lstGroups"] == null) { GroupsBL _group = new GroupsBL(); lstGroups = _group.GroupsGetAll(); Session["lstGroups"] = lstGroups; } else { lstGroups = (List <Groups_Info>)Session["lstGroups"]; } foreach (var item in lstGroups) { if (item.Group_Id == idGroups) { return(View(item)); } } return(View(new Groups_Info())); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(View()); } }
/// <summary> /// Hiệu chỉnh danh Danh sách chức năng của user /// </summary> /// <returns></returns> public ActionResult FunctionGroupOfUserList() { try { ViewBag.tabFocus = 2; GroupsBL _groups = new GroupsBL(); GroupFunctionBL _funcg = new GroupFunctionBL(); UserFunctionBL _userFunc = new UserFunctionBL(); string _ip = Request.UserHostAddress; //string _url = "/ModuleUserRoles/FunctionOfGroups/FunctionOfGroupList"; string _url = "/ModuleUser/GroupsUser/GroupUserList"; string _ok = CommonFunc.Nvs_Redirect_QuyenTruyCapUser(_url, _ip); if (_ok != "") { return(Redirect(_ok)); } if (!RouteData.Values.ContainsKey("id")) { return(View(new List <Functions_Info>())); } int idUserFun = 0; int idGroup = 0; if (RouteData.Values["id"] != null) { string pidgroupiduser = RouteData.Values["id"].ToString(); if (pidgroupiduser.Contains('-')) { string[] arr = pidgroupiduser.Split('-'); if (arr.Length == 2) { idUserFun = Convert.ToInt32(arr[0]); idGroup = Convert.ToInt32(arr[1]); } else { return(View(new List <Functions_Info>())); } } else { return(View(new List <Functions_Info>())); } } ViewBag.IDGroup = idGroup; ViewBag.CreateGroupOwner = true; //nếu nhóm chính người dùng tạo thì chuyển về true if (SessionData.CurrentUser.User_Id < 0) { ViewBag.CreateGroupOwner = false; } List <Groups_Info> lstGroup = _groups.GroupsGetAll(); CommonData.gLstGroups = lstGroup; foreach (var item in lstGroup) { if (item.Group_Id == idGroup) { //nếu là nhóm người khác tạo xong phân quyền thì Có tổng 46/58 quyền được chọn. //hiển thị số đc chọn / tổng là = nhau để người đc phân ko biết rõ là các quyền đc phân thiếu if (item.Created_By.ToUpper() == SessionData.CurrentUser.User_Name.ToUpper()) { ViewBag.CreateGroupOwner = true; } else { ViewBag.CreateGroupOwner = false; } ViewBag.GroupInfoUser = item; break; } } ViewBag.IdUserFunc = idUserFun; //danh sach chuc nang thuoc user ViewBag.FunctionInUser = _userFunc.UserFunctionGetAll(idUserFun, idGroup); ViewBag.FunctionInUserMans = _userFunc.UserFunctionGetAll(SessionData.CurrentUser.User_Id, idGroup); //dang xem chinh no ViewBag.CurrentUser = 0; if (idUserFun == SessionData.CurrentUser.User_Id) { ViewBag.CurrentUser = 1; } //danh sach chuc nang thuoc nhom 10:28.08.2015 ViewBag.FuncInGroup = _funcg.FunctionInGroupsGetAllToList(idGroup); ViewBag.IDGroupUser = idGroup.ToString() + idUserFun.ToString(); string FunctionInUser = "******" + ViewBag.IDGroupUser.ToString(); string FuncInGroup = "FuncInGroup" + ViewBag.IDGroupUser.ToString(); Session[FunctionInUser] = ViewBag.FunctionInUser; Session[FuncInGroup] = ViewBag.FuncInGroup; return(View()); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(View()); } }