Beispiel #1
0
        public ActionResult OperateList(int moduleid)
        {
            ModuleOperateBll     Bll  = new ModuleOperateBll();
            List <ModuleOperate> list = Bll.GetModuleOperateListByModuleId(moduleid);

            return(View(list));
        }
Beispiel #2
0
        public ActionResult OperateAdd()
        {
            ModuleOperateBll Bll   = new ModuleOperateBll();
            ModuleOperate    model = new ModuleOperate();

            if (Request.QueryString["operateid"] != null)
            {
                model = Bll.GetModel(int.Parse(Request.QueryString["operateid"].ToString()));
            }
            else
            {
                model.ModuleId = int.Parse(Request.QueryString["moduleid"]);
                model.Enabled  = 1;
            }

            return(View(model));
        }
        public Dictionary <string, object> GetAllOperate()
        {
            IDatabase                   database         = DataFactory.Database();
            var                         context          = (HttpContextBase)Request.Properties["MS_HttpContext"];
            var                         request          = context.Request;
            string                      roleid           = request.Form["roleid"];
            ModuleBll                   ModuleBll        = new ModuleBll();
            ModuleOperateBll            ModuleOperateBll = new ModuleOperateBll();
            List <Module>               listmodel        = ModuleBll.GetModuleList();
            List <ModuleOperate>        moduleoperate    = ModuleOperateBll.GetList();
            Dictionary <string, object> dic            = new Dictionary <string, object>();
            OpeateModuleView            model          = new OpeateModuleView();
            List <ModuleView>           listModuleView = new List <ModuleView>();

            List <ModuleRole>        listmodulerole        = database.FindList <ModuleRole>(" and RoleId=" + roleid);
            List <ModuleOperateRole> listmoduleoperaterole = database.FindList <ModuleOperateRole>(" and RoleId = " + roleid);

            foreach (var item in listmodel)
            {
                ModuleView ModuleView = new ModuleView();
                ModuleView.ModuleId   = item.ModuleId;
                ModuleView.ModuleName = item.ModuleName;
                ModuleView.ParentId   = item.ParentId;
                int flag = 0;
                if (listmodulerole.Where(a => a.ModuleId == item.ModuleId).ToList().Count > 0)
                {
                    flag = 1;
                    ModuleView.ischecked = true;
                }
                else
                {
                    ModuleView.ischecked = false;
                }


                ModuleView.id = item.ModuleId;
                List <ModuleOperateView> listModuleOperateView = new List <ModuleOperateView>();
                foreach (var item1 in moduleoperate)
                {
                    ModuleOperateView moduleOperateView = new ModuleOperateView();
                    if (item.ModuleId == item1.ModuleId)
                    {
                        if (flag == 0)
                        {
                            moduleOperateView.IsCheck = false;
                        }
                        else
                        {
                            if (listmoduleoperaterole.Where(a => a.ModuleOperateId == item1.ModuleOperateId).ToList().Count > 0)
                            {
                                moduleOperateView.IsCheck = true;
                            }
                            else
                            {
                                moduleOperateView.IsCheck = false;
                            }
                        }
                        moduleOperateView.OperateId   = item1.ModuleOperateId;
                        moduleOperateView.OperateName = item1.ModuleOperateName;
                        listModuleOperateView.Add(moduleOperateView);
                    }
                }
                ModuleView.List = listModuleOperateView;
                listModuleView.Add(ModuleView);
            }

            model.ModuleList = listModuleView;
            dic.Add("module", model);
            return(dic);
        }