Example #1
0
        public ActionResult Create(EntityMenuModel menu)
        {
            if (null == Session[this.SESSION_NAME_USERID])
            {
                return(RedirectToAction("Login", "Home"));
            }

            if (Session["IsAdmin"] is false)
            {
                return(RedirectToAction("Logout", "Home"));
            }
            this.SetConnectionDB();


            int          output       = 0;
            MenuServices menuServices = new MenuServices(this.DBConnection);

            output = menuServices.CreateMenu(menu);

            /****************************************RESPONSE FAILE OR SUCCESS******************************************/

            this.GetLanguage();
            BlockCreateMenuLangModel blockLang = new BlockCreateMenuLangModel();

            blockLang.BlockName = "block_menu_create";
            blockLang.SetLanguage(this.LANGUAGE_OBJECT);
            Session["msg_text"] = blockLang.GetMessage(output);
            Session["msg_code"] = output;

            if (menuServices.ERROR != null)
            {
                BI_Project.Helpers.FileHelper.SaveFile(menuServices.ERROR, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + BI_Project.Helpers.Utility.APIStringHelper.GenerateFileId() + ".txt");
            }

            if (menu.MenuId > 0 && output > 0)
            {
                Session["msg_text"] = blockLang.GetLangByPath("messages.block_menu_create.success_edit", this.LANGUAGE_OBJECT);
            }
            if (output == 0)
            {
                Session["msg_text"] = blockLang.GetLangByPath("messages.block_menu_create.error_business_1", this.LANGUAGE_OBJECT);
                //return RedirectToAction("Create?roleid=" + model.RoleId);
            }
            if (output > 0)
            {
                return(RedirectToAction("List"));
            }


            TempData["data"] = menu;
            return(RedirectToAction("Create"));
        }
Example #2
0
        public EntityMenuModel Clone()
        {
            EntityMenuModel output = new EntityMenuModel();

            output.FilterCommand = this.FilterCommand;
            output.DeptID        = this.DeptID;
            output.FilterValue   = this.FilterValue;
            output.LevelTree     = this.LevelTree;
            output.MenuId        = this.MenuId;
            output.MenuLevel     = this.MenuLevel;
            output.Name          = this.Name;
            output.ParentId      = this.ParentId;
            output.Path          = this.Path;
            output.Priority      = this.Priority;
            output.Status        = this.Status;
            return(output);
        }
Example #3
0
        //private string x = SESSION_NAME_USERID;

        public ActionResult Create()
        {
            if (null == Session[this.SESSION_NAME_USERID])
            {
                return(RedirectToAction("Login", "Home"));
            }
            if (Session["IsAdmin"] is false)
            {
                return(RedirectToAction("Logout", "Home"));
            }
            this.SetCommonData();
            ViewData["pagename"]     = "menu_create";
            ViewData["action_block"] = "Menus/block_create_menu";
            ViewData["data-form"]    = TempData["data"];



            string menuId = (Request.QueryString["menuid"] == null ? "0" : Request.QueryString["menuid"].ToString());

            this.SetConnectionDB();
            MenuServices menuServices = new MenuServices(this.DBConnection);

            EntityMenuModel entityMenuModel = new EntityMenuModel();

            entityMenuModel = menuServices.GetMenuModel(menuId);
            Services.Departments.DepartmentServices departmentServices = new Services.Departments.DepartmentServices(this.DBConnection);
            ViewData["CurrentOrgId"]         = entityMenuModel.DeptID;
            ViewData["departments"]          = departmentServices.GetList();
            ViewData["listdepartmentsadmin"] = departmentServices.GetListAdminLogin((string)Session["CodeIsAdmin"]);
            this.GetLanguage();
            ViewData["VIEWDATA_LANGUAGE"] = this.LANGUAGE_OBJECT;


            BlockCreateMenuLangModel blockLang = new BlockCreateMenuLangModel();

            BI_Project.Models.UI.BlockModel blockModel = new Models.UI.BlockModel("block_create_menu", this.LANGUAGE_OBJECT, blockLang);
            blockModel.DataModel  = entityMenuModel;
            ViewData["BlockData"] = blockModel;
            if (menuServices.ERROR != null)
            {
                BI_Project.Helpers.FileHelper.SaveFile(menuServices.ERROR, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + BI_Project.Helpers.Utility.APIStringHelper.GenerateFileId() + ".txt");
            }
            return(View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/index.cshtml"));
        }
Example #4
0
        private void AddMenuItem(EntityMenuModel item)
        {
            if (!MenuTree.ContainsKey(item.ParentId))
            {
                MenuTree.Add(item.ParentId, new List <EntityMenuModel>());
            }

            if (!MenuTree.ContainsKey(item.MenuId))
            {
                MenuTree.Add(item.MenuId, new List <EntityMenuModel>());
            }

            childrenList.Add(item.MenuId);

            RootId = childrenList.Contains(item.ParentId) ? RootId : item.ParentId;

            var list = MenuTree[item.ParentId];

            list.Add(item);
        }
Example #5
0
        public List <EntityMenuModel> GetAllowedMenuAndRoles(int userId)
        {
            List <EntityMenuModel> _listAllowedAndRoles = new List <EntityMenuModel>();

            DBConnection.OpenDBConnect();
            try
            {
                string sqlSelectMenuAndRoles = "select m.Menuid,m.Path,m.Name from UserMenu um,Menu m where um.Userid = @UserId and um.MenuId =m.MenuId " +
                                               "union " +
                                               " select m.MenuId,m.Path,m.Name from userRole ur, RoleMenu rm,Menu m " +
                                               " where ur.UserId = @UserId and ur.RoleId = rm.RoleId and rm.MenuID = m.MenuID  ";

                DBConnection.command.Parameters.Clear();
                DBConnection.command.CommandText = sqlSelectMenuAndRoles;
                DBConnection.command.Parameters.AddWithValue("@UserId", userId);

                using (SqlDataReader reader = DBConnection.command.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            EntityMenuModel entityMenu = new EntityMenuModel();
                            entityMenu.MenuId = reader.GetInt32(reader.GetOrdinal("MenuId"));
                            entityMenu.Path   = reader.IsDBNull(reader.GetOrdinal("Path")) ? "" : "/" + reader.GetString(reader.GetOrdinal("Path")).Trim() + "/" + reader.GetInt32(reader.GetOrdinal("MenuId")).ToString().Trim();
                            entityMenu.Name   = reader.IsDBNull(reader.GetOrdinal("Name")) ? "" : reader.GetString(reader.GetOrdinal("Name")).Trim();
                            _listAllowedAndRoles.Add(entityMenu);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ERROR = ex.ToString();
            }
            finally
            {
                DBConnection.CloseDBConnect();
            }
            return(_listAllowedAndRoles);
        }
Example #6
0
        public MenuTypes Check2Show(EntityMenuModel menu)
        {
            MenuTypes output = MenuTypes.HasAllLinkAndText;

            //CHECK WHETHER THE USER HAS PERMISSION TO ACCESS THIS MENU
            if (this.EntityUserModel.LstSelectedMenu.Contains(menu.MenuId))
            {
                return(output);
            }

            //CHECK WHETHER THE MENU HAS CHILD MENU, THAT BE ACCESSED BY THE USER
            if (CheckMenuHasChild(menu) == true)
            {
                output = MenuTypes.HasOnlyText;
            }
            else
            {
                output = MenuTypes.No2Show;
            }
            return(output);
        }
Example #7
0
        public EntityMenuModel GetMenuModel(string menuId)
        {
            EntityMenuModel output = new EntityMenuModel();

            this.DBConnection.OpenDBConnect();
            try
            {
                string sqlSelectMenu = " select * from Menu where menuid=@menuid";
                this.DBConnection.command.Parameters.Clear();
                this.DBConnection.command.CommandText = sqlSelectMenu;
                this.DBConnection.command.Parameters.AddWithValue("@menuid", int.Parse(menuId));

                using (SqlDataReader reader = DBConnection.command.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            output.ParentId   = reader.GetInt32(reader.GetOrdinal("ParentId"));
                            output.Path       = reader.IsDBNull(reader.GetOrdinal("Path")) ? "" : reader.GetString(reader.GetOrdinal("Path"));
                            output.Name       = reader.IsDBNull(reader.GetOrdinal("Name")) ? "" : reader.GetString(reader.GetOrdinal("Name"));
                            output.Priority   = reader.GetInt32(reader.GetOrdinal("Priority"));
                            output.MenuId     = reader.GetInt32(reader.GetOrdinal("MenuId"));
                            output.TableauUrl = reader.IsDBNull(reader.GetOrdinal("TableauUrl")) ? "" : reader.GetString(reader.GetOrdinal("TableauUrl"));
                            output.DeptID     = reader.GetInt32(reader.GetOrdinal("DeptId"));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                this.ERROR = ex.ToString();
            }
            finally
            {
                this.DBConnection.CloseDBConnect();
            }
            return(output);
        }
Example #8
0
        public bool CheckMenuHasChild(EntityMenuModel menu)
        {
            bool found = false;

            if (EntityUserModel.IsAdmin == true)
            {
                return(true);
            }
            foreach (EntityMenuModel child in LstAllowedMenus)
            {
                if (child.LevelTree.Contains(menu.LevelTree + "@@@"))
                {
                    found = true;
                    break;
                }
                else
                {
                    continue;
                }
            }

            return(found);
        }
        public ActionResult Index(int id)
        {
            //lay url tu menu voi id

            ViewData["pagename"]     = "Embed_Tableau";
            ViewData["action_block"] = "Tableau/TableauView";

            SetCommonData();
            GetLanguage();
            SetConnectionDB();


            BI_Project.Models.UI.PageModel pageModel = new Models.UI.PageModel("Embed_Tableau");
            // BI_Project.Models.UI.BlockModel blockModel = new BlockModel("TableauView");
            pageModel.SetLanguage(this.LANGUAGE_OBJECT);
            //pageModel.H1Title = pageModel.GetElementByPath("page_excel.menu" + id + ".h1");
            pageModel.Title        = pageModel.GetElementByPath("title");
            ViewData["page_model"] = pageModel;

            TableauModel param = new TableauModel();

            ViewData["BlockData"] = param;
            MenuServices _menuServices = new MenuServices(DBConnection);


            EntityMenuModel _entityMenuModel = _menuServices.GetMenuModel(id.ToString());

            UserServices _userServices = new UserServices(DBConnection);

            DepartmentServices _departmentServices = new DepartmentServices(DBConnection);

            EntityDepartmentModel _entityDepartmentModel = new EntityDepartmentModel();

            //param.Site_Root = _entityMenuModel.Site_Root;
            param.Ticket     = Helpers.TableauHelper.GetTicket("");
            param.TableauUrl = _entityMenuModel.TableauUrl;
            param.Hidden     = 1;
            param.username   = Session["UserName"].ToString();
            ViewBag.Id       = id;

            var listFilter01 = _departmentServices.GetList().Select(x => x.Filter01).ToArray();

            StringBuilder builderOrganization = new StringBuilder();

            foreach (var _list in listFilter01)
            {
                builderOrganization.Append(_list).Append(',');
            }


            string _resultListOrganization = builderOrganization.ToString().TrimEnd(',');

            ViewBag.ListDepartment = _resultListOrganization;



            var getUser       = _userServices.GetList();
            var getUserCheck  = getUser.FirstOrDefault(x => x.UserName == param.username);
            var getDepartment = _departmentServices.GetEntityById(getUserCheck.DeptId);


            if (getUserCheck.IsAdmin == false && (getDepartment.Filter01 != "PE" || getDepartment.Filter01 != "PA" || getDepartment.Filter01 != "PB" || getDepartment.Filter01 != "PC" || getDepartment.Filter01 != "PD"))
            {
                param.GetFilter(id);
            }
            //param.GetFilter(id);
            Random rd   = new Random();
            int    item = rd.Next(100, 999);
            string log  = DateTime.Now.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture) + "_" + item;

            if (_menuServices.ERROR != null)
            {
                FileHelper.SaveFile(new { ERROR = _menuServices.ERROR }, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + APIStringHelper.GenerateFileId() + ".txt");
            }

            FileHelper.SaveFile(_entityMenuModel, this.LOG_FOLDER + "/MenuModel_" + log + ".txt");
            FileHelper.SaveFile(param.Ticket, this.LOG_FOLDER + "/Ticket_" + log + ".txt");
            return(View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/index.cshtml"));
        }
Example #10
0
        public int CreateMenu(EntityMenuModel menuModel)
        {
            int output = 0;

            try
            {
                DBConnection.OpenDBConnect();
                //STEP1:  ***************************************************************/


                Dictionary <string, object> dicParas    = new Dictionary <string, object>();
                Dictionary <string, object> dicParaOuts = new Dictionary <string, object>();

                // get filter
                menuModel.FilterCommand = "Select Filter01 from dbo.Department d inner join Users u on d.Id = u.deptID where u.UserName = @USERNAME ";
                menuModel.FilterValue   = "MA_DVIQLY=";

                if (menuModel.Name != null)
                {
                    dicParas.Add("DeptId", menuModel.DeptID);
                    dicParas.Add("Name", menuModel.Name);
                    dicParas.Add("Path", menuModel.Path);
                    dicParas.Add("MenuLevel", menuModel.MenuLevel);
                    dicParas.Add("ParentId", menuModel.ParentId);
                    dicParas.Add("FilterCommand", menuModel.FilterCommand);
                    dicParas.Add("FilterValue", menuModel.FilterValue);
                    dicParas.Add("TableauUrl", menuModel.TableauUrl);
                    dicParas.Add("Status", menuModel.Status);
                    dicParas.Add("Priority", menuModel.Priority);


                    if (menuModel.MenuId == 0)
                    {
                        //dicParas.Add("")
                        output = DBConnection.ExecSPNonQuery("SP_MENU_INSERT", dicParas, ref dicParaOuts, true);
                    }
                    else
                    {
                        dicParas.Add("MenuId", menuModel.MenuId);
                        output = DBConnection.ExecSPNonQuery("SP_MENU_UPDATE", dicParas, ref dicParaOuts, true);
                    }
                }
                //dicParas.Add("Name", menuModel.Name);
                //dicParas.Add("Path", menuModel.Path);
                //dicParas.Add("MenuLevel", menuModel.MenuLevel);
                //dicParas.Add("ParentId", menuModel.ParentId);
                //dicParas.Add("FilterCommand", menuModel.FilterCommand);
                //dicParas.Add("FilterValue", menuModel.FilterValue);
                //dicParas.Add("TableauUrl", menuModel.TableauUrl);
                //dicParas.Add("Status", menuModel.Status);
                //dicParas.Add("Priority", menuModel.Priority);

                //if(menuModel.MenuId==0)
                //    //dicParas.Add("")
                //output=  DBConnection.ExecSPNonQuery("SP_MENU_INSERT", dicParas, ref dicParaOuts, true);
                //else
                //{
                //    dicParas.Add("MenuId", menuModel.MenuId);
                //    output = DBConnection.ExecSPNonQuery("SP_MENU_UPDATE", dicParas, ref dicParaOuts, true);
                //}
                //STEP2:  ***************************************************************/
            }
            catch (Exception ex)
            {
                this.ERROR = ex.ToString();
                output     = -1;
            }
            finally
            {
                DBConnection.CloseDBConnect();
            }


            return(output);
        }
Example #11
0
        public IEnumerable <EntityMenuModel> GetMenusByDepId(int userId, int?deptId = null)
        {
            List <EntityMenuModel> data = new List <EntityMenuModel>();

            var currentUser = _userService.GetEntityById(userId);

            DBConnection.OpenDBConnect();
            DBConnection.command.Parameters.Clear();

            try
            {
                DBConnection.command.CommandType = System.Data.CommandType.StoredProcedure;

                if (currentUser.IsSuperAdmin)
                {
                    DBConnection.command.CommandText = USP_GET_MENUS_BY_ORGID_ADMIN;
                    DBConnection.command.Parameters.AddWithValue("@orgId", (object)deptId ?? DBNull.Value);
                }
                else if (currentUser.IsAdmin)
                {
                    DBConnection.command.CommandText = USP_GET_MENUS_BY_ORGID;
                    DBConnection.command.Parameters.AddWithValue("@orgId", currentUser.DeptId);
                }
                else
                {
                    DBConnection.command.CommandText = USP_GET_MENUS_BY_USERID;
                    DBConnection.command.Parameters.AddWithValue("@userId", userId);
                }
                using (SqlDataReader reader = DBConnection.command.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            EntityMenuModel entityMenuModel = new EntityMenuModel();
                            entityMenuModel.FilterCommand = reader.IsDBNull(reader.GetOrdinal("FilterCommand")) ? "" : reader.GetString(reader.GetOrdinal("FilterCommand"));
                            entityMenuModel.FilterValue   = reader.IsDBNull(reader.GetOrdinal("FilterValue")) ? "" : reader.GetString(reader.GetOrdinal("FilterValue"));
                            entityMenuModel.LevelTree     = reader.IsDBNull(reader.GetOrdinal("LevelTree")) ? "" : reader.GetString(reader.GetOrdinal("LevelTree"));
                            entityMenuModel.MenuId        = reader.IsDBNull(reader.GetOrdinal("MenuId")) ? 0 : reader.GetInt32(reader.GetOrdinal("MenuId"));
                            entityMenuModel.MenuLevel     = reader.IsDBNull(reader.GetOrdinal("MenuLevel")) ? "" : reader.GetString(reader.GetOrdinal("MenuLevel"));
                            entityMenuModel.Name          = reader.IsDBNull(reader.GetOrdinal("Name")) ? "" : reader.GetString(reader.GetOrdinal("Name"));
                            entityMenuModel.ParentId      = reader.IsDBNull(reader.GetOrdinal("ParentId")) ? 0 : reader.GetInt32(reader.GetOrdinal("ParentId"));
                            entityMenuModel.Path          = reader.IsDBNull(reader.GetOrdinal("Path")) ? "" : reader.GetString(reader.GetOrdinal("Path"));
                            entityMenuModel.Status        = reader.IsDBNull(reader.GetOrdinal("Status")) ? false : reader.GetBoolean(reader.GetOrdinal("Status"));
                            entityMenuModel.Priority      = reader.IsDBNull(reader.GetOrdinal("Priority")) ? 0 : reader.GetInt32(reader.GetOrdinal("Priority"));
                            data.Add(entityMenuModel);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                // lỗi
                throw e;
            }
            finally
            {
                DBConnection.CloseDBConnect();
            }
            return(data);
        }
Example #12
0
        public BlockDataMenuLeftModel GetListMenus(EntityUserModel entityUser)
        {
            BlockDataMenuLeftModel output = new BlockDataMenuLeftModel();

            this.DBConnection.OpenDBConnect();
            output.EntityUserModel = entityUser;
            try
            {
                //STEP1: GET ALLOWED MENUID FOR THE CURRENT USER
                string sqlUserMenuIds = " ", sqlRoleMenuIds = "", sqlMenus = "";



                //sqlUserMenuIds = "select distinct * from UserMenu where userid=@userid";
                sqlUserMenuIds = "select MenuId from UserMenu where userid=@userid";
                this.DBConnection.command.Parameters.Clear();
                this.DBConnection.command.CommandText = sqlUserMenuIds;
                this.DBConnection.command.Parameters.AddWithValue("@userid", entityUser.UserId);
                //entityUser.LstSelectedMenu.Clear();
                using (SqlDataReader reader = DBConnection.command.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            int menuid = reader.GetInt32(reader.GetOrdinal("MenuId"));
                            if (!entityUser.LstSelectedMenu.Contains(menuid))
                            {
                                entityUser.LstSelectedMenu.Add(menuid);
                            }
                        }
                    }
                }

                //GET MENUID FROM ROLEMENU

                sqlRoleMenuIds = "select distinct rm.MenuId from Users as u, UserRole as ur, RoleMenu as rm where ( " +
                                 "   u.UserId = @userid and u.UserId = ur.UserId and rm.RoleId = ur.RoleId )";

                this.DBConnection.command.CommandText = sqlRoleMenuIds;

                using (SqlDataReader reader = DBConnection.command.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            int menuid = reader.GetInt32(reader.GetOrdinal("MenuId"));
                            if (!entityUser.LstSelectedMenu.Contains(menuid))
                            {
                                entityUser.LstSelectedMenu.Add(menuid);
                            }
                        }
                    }
                }
                //STEP2: GET ALL MENU ******************************************************
                sqlMenus = "select * from Menu order by leveltree ";
                this.DBConnection.command.Parameters.Clear();
                this.DBConnection.command.CommandText = sqlMenus;
                List <EntityMenuModel> lstMenuTemp = new List <EntityMenuModel>();
                using (SqlDataReader reader = DBConnection.command.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            EntityMenuModel entityMenuModel = new EntityMenuModel();
                            entityMenuModel.FilterCommand = reader.IsDBNull(reader.GetOrdinal("FilterCommand")) ? "" : reader.GetString(reader.GetOrdinal("FilterCommand"));
                            entityMenuModel.FilterValue   = reader.IsDBNull(reader.GetOrdinal("FilterValue")) ? "" : reader.GetString(reader.GetOrdinal("FilterValue"));
                            entityMenuModel.LevelTree     = reader.IsDBNull(reader.GetOrdinal("LevelTree")) ? "" : reader.GetString(reader.GetOrdinal("LevelTree"));
                            entityMenuModel.MenuId        = reader.IsDBNull(reader.GetOrdinal("MenuId")) ? 0 : reader.GetInt32(reader.GetOrdinal("MenuId"));
                            entityMenuModel.MenuLevel     = reader.IsDBNull(reader.GetOrdinal("MenuLevel")) ? "" : reader.GetString(reader.GetOrdinal("MenuLevel"));
                            entityMenuModel.Name          = reader.IsDBNull(reader.GetOrdinal("Name")) ? "" : reader.GetString(reader.GetOrdinal("Name"));
                            entityMenuModel.ParentId      = reader.IsDBNull(reader.GetOrdinal("Name")) ? 0 : reader.GetInt32(reader.GetOrdinal("ParentId"));
                            entityMenuModel.Path          = reader.IsDBNull(reader.GetOrdinal("Path")) ? "" : reader.GetString(reader.GetOrdinal("Path"));
                            entityMenuModel.Status        = reader.IsDBNull(reader.GetOrdinal("Status")) ? false : reader.GetBoolean(reader.GetOrdinal("Status"));

                            lstMenuTemp.Add(entityMenuModel);
                            if (entityUser.IsAdmin == true)
                            {
                                entityUser.LstSelectedMenu.Add(entityMenuModel.MenuId);
                                output.StrAllowedLeveltrees += entityMenuModel.LevelTree + ",";
                                output.StrAllowedMenuIds    += entityMenuModel.MenuId + ",";
                                continue;
                            }
                            if (entityUser.LstSelectedMenu.Contains(entityMenuModel.MenuId))
                            {
                                // output.LstAllowedMenus.Add(entityMenuModel.Clone());
                                output.StrAllowedLeveltrees += entityMenuModel.LevelTree + ",";
                                output.StrAllowedMenuIds    += entityMenuModel.MenuId + ",";
                            }
                        }
                    }
                }
                output.StrAllowedMenuIds    = "," + output.StrAllowedMenuIds;
                output.StrAllowedLeveltrees = "," + output.StrAllowedLeveltrees;
                foreach (EntityMenuModel entity in lstMenuTemp)

                {
                    if (entityUser.LstSelectedMenu.Contains(entity.MenuId))
                    {
                        //output.LstAllowedMenus.Add(entity.Clone());
                        //output.LstAllOfMenus.Add(entity.Clone());
                        continue;
                    }

                    //else
                    //{
                    //    string currentMenuLeveltree = entity.LevelTree + "@@@";
                    //    bool added = false;
                    //    while (currentMenuLeveltree.Length > 0)
                    //    {
                    //        int pos = currentMenuLeveltree.LastIndexOf("@@@");
                    //        if (pos < 0) break;
                    //        currentMenuLeveltree = currentMenuLeveltree.Substring(0, pos);

                    //        //DAY LA TRUONG HOP CO MENU CHA NAM TRONG SO DUOC PHAN QUYEN
                    //        //THI ADD MENU HIEN TAI VAO NHOM
                    //        if (output.StrAllowedLeveltrees.IndexOf("," + currentMenuLeveltree + ",") >= 0)
                    //        {
                    //            output.StrAllowedLeveltrees += entity.LevelTree + ",";
                    //            output.StrAllowedMenuIds += entity.MenuId.ToString() + ",";
                    //            entityUser.LstSelectedMenu.Add(entity.MenuId);
                    //            added = true;
                    //            break;
                    //        }

                    //    }


                    //}
                }

                foreach (EntityMenuModel entity in lstMenuTemp)
                {
                    if (entityUser.IsAdmin == true)
                    {
                        output.LstAllOfMenus.Add(entity.Clone());
                        continue;
                    }

                    if (entityUser.LstSelectedMenu.Contains(entity.MenuId))
                    {
                        output.LstAllOfMenus.Add(entity.Clone());
                    }

                    else
                    {
                        //KIEM TRA MENU HIEN TAI CO LA MENU CHA CUA 1 TRONG SO CAC MENU DA DUOC ADD KO
                        if (output.StrAllowedLeveltrees.Contains("," + entity.LevelTree + "@"))
                        {
                            output.LstAllOfMenus.Add(entity.Clone());
                        }
                    }
                }

                //STEP3: GET LIST OF ALLOWED MENU FOR THE CURRENT USER
            }
            catch (Exception ex)
            {
                this.ERROR = ex.ToString();
            }
            finally
            {
                this.DBConnection.CloseDBConnect();
            }


            return(output);
        }