Exemplo n.º 1
0
        protected void ModulesDropDownList()
        {
            CSF_Modules_DAO objModulesDAO = new CSF_Modules_DAO();
            var             listModules   = objModulesDAO.GetAll();

            TempData["ddlModules"] = new SelectList(listModules, "ID", "Name");
            TempData.Keep("ddlModules");
        }
Exemplo n.º 2
0
        public ActionResult Create()
        {
            try
            {
                //if (!this.HasPermission) return RedirectToAction("Unauthorized", "Home");
                TempData["listController"] = GetControllerNames();
                TempData.Keep("listController");
                DT_WebGISEntities   MyContext = new DT_WebGISEntities();
                List <SubSelectBox> listTree  = new List <SubSelectBox>();
                SubSelectBox        sc;
                var listData = MyContext.CSF_Functions
                               .Join(MyContext.CSF_Modules,
                                     fc => fc.ModuleID,
                                     md => md.ID,
                                     (fc, md) => new { CSF_Functions = fc, CSF_Modules = md })
                               .Where(md => md.CSF_Modules.IsActive == true)
                               .Select(mdp => mdp.CSF_Functions).ToList();
                var    listData0 = listData.Where(x => x.ParentID == 0).OrderBy(x => x.Name).ToList();
                string tag       = "";
                foreach (var item in listData0)
                {
                    sc      = new SubSelectBox();
                    sc.id   = item.ID;
                    sc.name = item.Name;
                    listTree.Add(sc);
                    BuildSubTree(listTree, item.ID, listData, tag);
                }
                TempData["functions"] = listTree.ToList();
                TempData.Keep("functions");

                CSF_Modules_DAO objModulesDAO = new CSF_Modules_DAO();
                var             modules       = objModulesDAO.GetAll();
                TempData["modules"] = modules.ToList();
                TempData.Keep("modules");

                //ParentFunctionDropDownList();
                ModulesDropDownList();

                return(View());
            }
            catch (Exception ex)
            {
                SetAlert("Lỗi" + ex.Message.ToString(), AlertType.Error);
                Logs.WriteLog(ex);
                return(View());
            }
        }