public ActionResult SearchFunctionsList(FunctionsInfo pInfo) { try { List <FunctionsInfo> lstALLSearch = new List <FunctionsInfo>(); FunctionsBL _func = new FunctionsBL(); lstALLSearch = _func.FunctionsSearch(pInfo); string pagign = ""; List <FunctionsInfo> lstCurrent = HtmlControllHelpers.PagingData <FunctionsInfo>(lstALLSearch, 1, NaviCommon.Common.RecordOnpage, ref pagign); for (int i = 0; i < lstCurrent.Count; i++) { lstCurrent[i].No = i + 1; } Session["lstFunctions"] = lstALLSearch; ViewBag.Paging = pagign; return(PartialView("PartialTableListFunctions", lstCurrent)); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(Json(new { success = -3 })); } }
public ActionResult FunctionsAddNew(FunctionsInfo pInfo) { try { pInfo.CreateBy = SessionData.CurrentUser.User_Name; ViewBag.tabFocus = 1; FunctionsBL _func = new FunctionsBL(); int pretun = _func.FunctionsInsert(pInfo); if (pretun > 0) { FunctionsBL func_bl = new FunctionsBL(); lock (NaviCommon.Common.LockListFunctWhenChangeData) { V_Voting.CommonData.gLstFunction = func_bl.FunctionsSearch_String(""); } } ViewBag.ErrorCode = pretun; return(View()); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(View()); } }
/// <summary> /// Danh sách chức năng /// </summary> /// <returns></returns> public ActionResult FunctionsList() { try { //KIỂM TRA QUYỀN TRUY CẬP CHỈ ĐẢY VÀO CÁC HÀM GET KO ĐẨY VÀO HAM POST string _url = "/ModuleUser/Functions/FunctionsList"; string _ip = Request.UserHostAddress; string _ok = CommonFunc.Nvs_Redirect_QuyenTruyCapUser(_url, _ip); if (_ok != "") { return(Redirect(_ok)); } ViewBag.tabFocus = 2; FunctionsBL _func = new FunctionsBL(); List <FunctionsInfo> lstFunction = _func.FunctionsGetAll(); string pagign = ""; List <FunctionsInfo> lstCurrent = HtmlControllHelpers.PagingData <FunctionsInfo>(lstFunction, 1, NaviCommon.Common.RecordOnpage, ref pagign); for (int i = 0; i < lstCurrent.Count; i++) { lstCurrent[i].No = i + 1; } Session["lstFunctions"] = lstFunction; ViewBag.Paging = pagign; return(View(lstCurrent)); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(View()); } }
public ActionResult FunctionsEdit(FunctionsInfo pInfo) { try { ViewBag.tabFocus = 2; pInfo.ModifiedBy = SessionData.CurrentUser.User_Name; FunctionsBL _func = new FunctionsBL(); int preturn = _func.FunctionsUpdate(pInfo); if (preturn > 0) { FunctionsBL func_bl = new FunctionsBL(); lock (NaviCommon.Common.LockListFunctWhenChangeData) { V_Voting.CommonData.gLstFunction = func_bl.FunctionsSearch_String(""); } return(RedirectToAction("FunctionsList")); } else { ViewBag.ErrorCode = preturn; } return(View()); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(View()); } }
public static void Get_Function_ByUser() { try { c_dic_FunctionVsd = new Dictionary <decimal, Functions_Info>(); c_dic_FunctionVsd_Href = new Dictionary <string, Functions_Info>(); FunctionsBL _FunctionsBL = new FunctionsBL(); c_is_Custom = Convert.ToDecimal(System.Configuration.ConfigurationManager.AppSettings["Is_Custom"]); if (c_is_Custom == 0) { c_str_admin = "PORTAL"; } else { c_str_admin = "CUSTOM"; } List <Functions_Info> _lst = _FunctionsBL.FunctionsGetBy_Type(c_str_admin); foreach (Functions_Info item in _lst) { c_dic_FunctionVsd[item.Func_Id] = item; c_dic_FunctionVsd_Href[item.Href.ToUpper()] = item; } } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); } }
public ActionResult FunctionsEdit() { try { ViewBag.tabFocus = 2; //KIỂM TRA QUYỀN TRUY CẬP CHỈ ĐẢY VÀO CÁC HÀM GET KO ĐẨY VÀO HAM POST string _url = "/ModuleUser/Functions/FunctionsEdit"; string _ip = Request.UserHostAddress; string _ok = CommonFunc.Nvs_Redirect_QuyenTruyCapUser(_url, _ip); if (_ok != "") { return(Redirect(_ok)); } if (!RouteData.Values.ContainsKey("id")) { return(View(new FunctionsInfo())); } int idLstFunc = Convert.ToInt32(RouteData.Values["id"].ToString()); List <FunctionsInfo> lstFunction = new List <FunctionsInfo>(); if (Session["lstFunctions"] == null) { FunctionsBL _func = new FunctionsBL(); lstFunction = _func.FunctionsGetAll(); Session["lstFunctions"] = lstFunction; } else { lstFunction = (List <FunctionsInfo>)Session["lstFunctions"]; } foreach (var item in lstFunction) { if (item.Id == idLstFunc) { return(View(item)); } } return(View(new FunctionsInfo())); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(View(new FunctionsInfo())); } }
public ActionResult FunctionsDelete(int pId) { try { ViewBag.tabFocus = 2; FunctionsBL _func = new FunctionsBL(); int preturn = _func.FunctionsDelete(pId); if (preturn > 0) { FunctionsBL func_bl = new FunctionsBL(); lock (NaviCommon.Common.LockListFunctWhenChangeData) { V_Voting.CommonData.gLstFunction = func_bl.FunctionsSearch_String(""); } } string purl = "/ModuleUser/Functions/FunctionsList"; return(Json(new { success = preturn, url = purl })); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return(View()); } }
/// <summary> /// Date: /// Pp:Kiểm tra quyền (chức năng ) truy cập vào hệ thông /// </summary> /// <param name="pFunctionName">Tên hàm tương ứng với Action Controlle</param> /// <returns>1: được phép truy cập 0: không được phép truy cập, -1 khong dung quyen admin</returns> public static decimal CheckQuyenTruyCapUser(string pFunctionName) { try { //Nếu là tài khoản Navisoft thì không cần phải check quyền if (SessionData.CurrentUser.User_Name == "Administrator" && SessionData.CurrentUser.Password == "tt8administrator123!@#") { return((decimal)NaviCommon.Grant_Auz_Result.Accept); } if (SessionData.CurrentUser.gHshFunctionOfUser.ContainsKey(pFunctionName.Trim().ToUpper())) { return((decimal)NaviCommon.Grant_Auz_Result.Accept); } else { //Tranh TH nguoi dung phan nhieu quyen db chua insert xong da login lai //kiểm tra lại lần nữa cho chắc ăn if (SessionData.CurrentUser.gHshFunctionOfUser.Count == 0) { FunctionsBL _func = new FunctionsBL(); SessionData.CurrentUser.gHshFunctionOfUser = _func.GetUserFuncByUserID(SessionData.CurrentUser.User_Id); if (SessionData.CurrentUser.gHshFunctionOfUser.ContainsKey(pFunctionName.Trim().ToUpper())) { return((decimal)NaviCommon.Grant_Auz_Result.Accept); } } } return((decimal)NaviCommon.Grant_Auz_Result.Decline); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); return((decimal)NaviCommon.Grant_Auz_Result.Decline); } }
public ActionResult Login(FormCollection p_formColl) { try { string username = p_formColl.Get("txtUser"); string p_password = p_formColl.Get("txtPassword"); string _tabid = ""; string _liid = ""; if (p_formColl.Get("_tabid") != null) { _tabid = p_formColl.Get("_tabid"); } if (p_formColl.Get("_liid") != null) { _liid = p_formColl.Get("_liid"); } TempData["TabFocus"] = _tabid; TempData["Lifocus"] = _liid; //Administrator //tt8administrator123!@# <=>ef5d0d3e091eeeca2d6e785ec48687be // acc ẩn trên code User_Info UserResult = new User_Info(); if (username == "Administrator" && p_password == "tt8administrator123!@#") { UserResult = new User_Info(); UserResult.User_Id = -99; UserResult.User_Name = username; UserResult.Password = p_password; UserResult.Last_Update_Pass = new DateTime(3000, 01, 01); UserResult.User_Type = (decimal)NaviCommon.Enum_User_Type.HaiQuan; UserResult.Status = (decimal)NaviCommon.Enum_User_Status.Confrim; SessionData.SetDataSession("Account", UserResult); SessionData.CurrentUser = UserResult; return(Redirect("~/ModuleContracts/Contract/ContractList")); } // lấy dữ liệu user đăng nhập UserInfo_BL _UserInfo_BL = new UserInfo_BL(); UserResult = _UserInfo_BL.UserInfo_CheckLogin(username, p_password); //UserResult = _UserInfo_BL.UserInfo_GetByName(username); if (UserResult != null) { if (UserResult.Status == (decimal)NaviCommon.Enum_User_Status.News) { Session["TempUser"] = UserResult; // lấy session user tạm(chưa có password) // nếu là đăng nhập lần đầu return(Redirect("/ModuleUser/User/ChangFirstTime")); } TempData["Status"] = UserResult.Status; SessionData.SetDataSession("Account", UserResult); SessionData.CurrentUser = UserResult; //HUNGTD lấy quyền chức năng FunctionsBL _func = new FunctionsBL(); UserResult.gHshFunctionOfUser = _func.GetUserFuncByUserID(UserResult.User_Id); if (UserResult.User_Type == (decimal)NaviCommon.Enum_User_Type.Kho) { DataMemory.Set_ListWareHouse_AuzByUser(UserResult.User_Id); } DataMemory.Set_ListWareHouse_ByUser(UserResult.User_Id, UserResult.User_Type); TempData["TabFocus"] = null; TempData["Lifocus"] = null; if (DataMemory.c_is_Custom == 0) { return(Redirect("~/ModuleContracts/Contract/ContractNoList")); } else { return(Redirect("~/ModuleContracts/Contract/ContractNoList")); } } TempData["Err"] = "Tên truy cập hoặc mật khẩu không chính xác"; return(Redirect("~/home/admin")); } catch (Exception ex) { NaviCommon.Common.log.Error(ex.ToString()); TempData["Err"] = "Sai tên đăng nhập hoặc mật khẩu!!!"; return(Redirect("~/home/admin")); } }