Ejemplo n.º 1
0
        public ActionResult GetViewToEditFunction(int functionId)
        {
            var functionInfo = new FunctionInfo();

            try
            {
                functionInfo = FunctionBL.GetFunctionById(functionId);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(PartialView("~/Areas/ModuleUsersAndRoles/Views/Function/_PartialEditFunction.cshtml", functionInfo));
        }
Ejemplo n.º 2
0
        public ActionResult DoAddNewFunction(FunctionInfo functionInfo)
        {
            var result = new ActionBusinessResult();

            try
            {
                var functionBL = new FunctionBL();
                result = functionBL.AddFunction(functionInfo);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(Json(new { result = result.ToJson() }));
        }
Ejemplo n.º 3
0
        public ActionResult DoDeleteFunction(int functionId)
        {
            var result = new ActionBusinessResult();

            try
            {
                var functionBL = new FunctionBL();
                result = functionBL.DeleteFunction(functionId);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(Json(new { result = result.ToJson() }));
        }
Ejemplo n.º 4
0
        public ActionResult FindFunction(string keysSearch, string options)
        {
            var lstFunctions = new List <FunctionInfo>();

            try
            {
                var functionBL = new FunctionBL();
                lstFunctions   = functionBL.FindFunction(keysSearch, options);
                ViewBag.Paging = functionBL.GetPagingHtml();
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(PartialView("~/Areas/ModuleUsersAndRoles/Views/Function/_PartialTableListFunctions.cshtml", lstFunctions));
        }
Ejemplo n.º 5
0
        public ActionResult ListFunctions()
        {
            var lstFunctions = new List <FunctionInfo>();

            try
            {
                var functionBL = new FunctionBL();
                lstFunctions   = functionBL.FindFunction();
                ViewBag.Paging = functionBL.GetPagingHtml();
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(View("~/Areas/ModuleUsersAndRoles/Views/Function/ListFunctions.cshtml", lstFunctions));
        }
Ejemplo n.º 6
0
        public ActionResult ViewAllInnerFunction(int functionId)
        {
            var lstFunctionInfo = new List <FunctionInfo>();

            try
            {
                var functionInfo = FunctionBL.GetFunctionById(functionId);
                ViewBag.CurrentFunction = functionInfo;
                lstFunctionInfo         = FunctionBL.GetAllInnerFunctions(functionId);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(PartialView("~/Areas/ModuleUsersAndRoles/Views/Function/_PartialViewAllInnerFunctions.cshtml", lstFunctionInfo));
        }
Ejemplo n.º 7
0
        public static void LoadAllMemoryData()
        {
            try
            {
                // dangtq thêm thông tin fee tĩnh theo đơn
                LoadSys_App_Fee_Fix();

                // DANGTQ load fee cho seach
                LoadSys_Search_Fee_Fix();

                LoadTemplate();

                AppDocumentBL _AppDocumentBL = new AppDocumentBL();
                c_lstSys_Document = _AppDocumentBL.Sys_Document_GetAll();

                #region Allcode
                c_hs_Allcode.Clear();
                AllCodeBL          _AllCodeBL = new AllCodeBL();
                List <AllCodeInfo> _lst_al    = _AllCodeBL.AllCode_Gets_List();

                if (_lst_al.Count > 0)
                {
                    foreach (AllCodeInfo item in _lst_al)
                    {
                        if (c_hs_Allcode.ContainsKey(item.CdName + "|" + item.CdType) == false)
                        {
                            List <AllCodeInfo> _lst = new List <AllCodeInfo>
                            {
                                item
                            };
                            c_hs_Allcode[item.CdName + "|" + item.CdType] = _lst;
                        }
                        else
                        {
                            List <AllCodeInfo> _lst = (List <AllCodeInfo>)c_hs_Allcode[item.CdName + "|" + item.CdType];
                            _lst.Add(item);
                        }
                    }
                }

                AllCodeBL.LoadAllCodeToMemory();


                #endregion

                List <Injection_Info> _lst_injection = AllCodeBL.Get_All_Injection();
                foreach (var item in _lst_injection)
                {
                    Common.c_dic_Injection[item.Key.ToUpper()] = item.Key;
                }

                ReloadGroup();

                ReloadCountry();
                MenuBL.LoadAllMenuToMemory();
                FunctionBL.LoadFunctionCollectionsToMemory();
                SysApplicationBL.SysApplicationAllOnMem();
                //Load lên mem
                clstAppClass = AppClassInfoBL.AppClassGetOnMem();

                foreach (var item in clstAppClass)
                {
                    CustomerSuggestInfo pinfo = new CustomerSuggestInfo();

                    pinfo.label = item.Name_Vi;
                    pinfo.name  = item.Name_Vi;

                    pinfo.label_en = item.Name_En;
                    pinfo.name_en  = item.Name_En;
                    if (!string.IsNullOrEmpty(item.Code))
                    {
                        if (item.Code.Length > 2)
                        {
                            //pinfo.value = item.Code.Substring(0, 2);
                            pinfo.value = item.Group_Code;
                        }
                        else
                        {
                            pinfo.value = item.Code;
                        }
                    }
                    clstAppClassSuggest.Add(pinfo);
                }
                //lấy toàn bộ thông tin đơn lên mem, đang đọc toàn bộ cả anh cả việt.
                GetCacheCustomerInfo();

                GetCache_represent();

                GetCacheDDSHCN();

                // load thông tin page
                Load_Sys_page();

                Logger.LogInfo("Load memory sucess MemoryData.c_dic_FeeByApp_Fix count " + MemoryData.c_dic_FeeByApp_Fix.Count);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
        }
Ejemplo n.º 8
0
        public void Identity(HttpRequest req)
        {
            try
            {
                var reqAppRelativePath = req?.AppRelativeCurrentExecutionFilePath?.Replace("~", string.Empty);
                this._requestMethod = req?.HttpMethod;
                if (req != null)
                {
                    this._isRequestTypeAjax = new HttpRequestWrapper(req).IsAjaxRequest();
                }

                if (SessionData.CurrentUser != null)
                {
                    var isAccountSessionValid = AccountManagerBL.ValidAccountSession(SessionData.CurrentUser);
                    if (!isAccountSessionValid)
                    {
                        SessionData.CurrentUser  = null;
                        this._isRequestIdentity  = false;
                        this._responeRedirectUrl = RouteConfig.KnAccountSessionInvalid;
                        return;
                    }
                }

                if (FunctionBL.GetAllFunctionsNoRequiredLogin().Any(
                        t => t.HrefGet == reqAppRelativePath || t.HrefPost == reqAppRelativePath))
                {
                    this._isRequestIdentity = true;
                    return;
                }

                if (FunctionBL.GetAllFunctionsRequiredLogin().Any(
                        t => t.HrefGet == reqAppRelativePath || t.HrefPost == reqAppRelativePath))
                {
                    if (SessionData.CurrentUser == null)
                    {
                        this._isRequestIdentity  = false;
                        this._responeRedirectUrl = RouteConfig.KnLogin;
                        this._returnUrl          = reqAppRelativePath;
                        return;
                    }

                    if (AccountManagerBL.IsAccountRoleDataChanged(SessionData.CurrentUser.Id))
                    {
                        this._isRequestIdentity  = false;
                        this._responeRedirectUrl = RouteConfig.KnReLoginWhenAccountDataChanged;
                        return;
                    }

                    if (SessionData.CurrentUser.AllAccountRoles.Any(
                            t => t.HrefGet == reqAppRelativePath || t.HrefPost == reqAppRelativePath))
                    {
                        this._isRequestIdentity = true;
                    }
                    else
                    {
                        this._isRequestIdentity  = false;
                        this._responeRedirectUrl = RouteConfig.KnAccessDenied;
                    }

                    return;
                }
            }
            catch (Exception)
            {
                // Since handle exception here make no sense cause we treat exception to fail identity
                // Exception Inorged
            }

            this._isRequestIdentity  = false;
            this._responeRedirectUrl = RouteConfig.KnHttpNotFound;
        }