public List <Sys_ModuleModel> GetMenuList(string roleId)
        {
            Sys_ModuleBLL        mbll  = new Sys_ModuleBLL();
            Sys_RoleAuthorizeBLL rhbll = new Sys_RoleAuthorizeBLL();
            var data = new List <Sys_ModuleModel>();

            if (OperatorProvider.Provider.GetCurrent().IsSystem)
            {
                data = mbll.GetModelList("");
            }
            else
            {
                var moduledata    = mbll.GetModelList("");
                var authorizedata = rhbll.GetModelList("F_ObjectId = '" + roleId + "'  and F_ItemType = 1");

                foreach (var item in authorizedata)
                {
                    Sys_ModuleModel moduleEntity = mbll.GetModel(item.F_ItemId);
                    if (moduleEntity != null)
                    {
                        data.Add(moduleEntity);
                    }
                }
            }
            return(data.OrderBy(t => t.F_SortCode).ToList());
        }
Exemple #2
0
        /// <summary>
        /// 加载绑定页面数据
        /// </summary>
        private void ShowBind()
        {
            string id = Request.QueryString["id"];
            IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,默认是ISO8601格式

            timeConverter.DateTimeFormat = "yyyy-MM-dd";                     //设置时间格式
            if (!string.IsNullOrEmpty(id))
            {
                string method = WebUtil.Get("method");//复制表单数据(json格式)
                if (method == "get")
                {
                    string     jsonPerson2 = string.Empty;
                    string     jsonPerson6 = string.Empty;
                    Sys_Module ModuleInfo  = new Sys_ModuleBLL().Get(p => p.Id == id);

                    string jsonPerson = JsonConvert.SerializeObject(ModuleInfo, timeConverter);

                    Response.Write(jsonPerson);
                    Response.End();
                }
                else
                {
                }
            }
            else
            {
            }
        }
        private object GetMenuList()
        {
            Sys_ModuleBLL mbll   = new Sys_ModuleBLL();
            var           roleId = OperatorProvider.Provider.GetCurrent().RoleId;

            return(ToMenuJson(GetMenuList(roleId), "0"));
        }
Exemple #4
0
        /// <summary>
        /// ajax 调用按钮方法
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        //[WebMethod]
        public void Save()
        {
            string id = WebUtil.Get("id");                                     //唯一编号
            string ActionDefinitionID   = WebUtil.Get("ActionDefinitionID");   //按钮动作ID
            string ActionDefinitionName = WebUtil.Get("ActionDefinitionName"); //按钮动作名称
            string content = WebUtil.GetForm("Content").HtmlEncode();          //防止跨站脚本注入

            bool IsStartWF = WebUtil.Get("IsStartWF", false);                  //按钮动作名称
            bool IsExists  = true;

            Sys_Module    ModuleInfo = new Sys_Module();
            Sys_ModuleBLL ModuleBLL  = new Sys_ModuleBLL();
            DateTime      dt         = DateTime.Now;

            if (id.IsNullOrEmpty())
            {
                IsExists   = false;
                ModuleInfo = FormToModelHelper <Sys_Module> .ConvertToModel(HttpContext.Current);

                ModuleInfo.Id        = Guid.NewGuid().ToString();
                ModuleInfo.AddUserId = CurrUserInfo().UserID;
                ModuleInfo.AddTime   = dt;
                //ModuleInfo.EditUserId = CurrUserInfo().UserID;
                //ModuleInfo.EditTime = dt;
                //ModuleInfo.IsDelete = false;
                //ModuleInfo.IsShow = true;
            }
            else
            {
                ModuleInfo = ModuleBLL.Get(p => p.Id == id);
                //复制
                ModuleInfo = FormToModelHelper <Sys_Module> .ConvertToModel(HttpContext.Current, ModuleInfo);
            }


            #region 流程与数据交换方法
            //流程启动正常
            if (IsExists)
            {
                IsExists = new Sys_ModuleBLL().Update(ModuleInfo);
            }
            else
            {
                ModuleInfo = new Sys_ModuleBLL().AddEntity(ModuleInfo);
                IsExists   = ModuleInfo.IsNotNull() ? true : false;
            }

            if (IsExists)
            {
                Result.SetData(ModuleInfo);
                Result.SetError(false).SetMsg(ActionDefinitionName + "成功").Output();
            }
            else
            {
                Result.SetError(true).SetMsg("保存出错,请重试").Output();
            }
            #endregion
        }
Exemple #5
0
        private bool ActionValidate(string roleId, string moduleId, string action)
        {
            Sys_ModuleBLL        modulebll        = new Sys_ModuleBLL();
            Sys_ModuleButtonBLL  moduleButtonbll  = new Sys_ModuleButtonBLL();
            Sys_RoleAuthorizeBLL roleAuthorizebll = new Sys_RoleAuthorizeBLL();
            var authorizeurldata = new List <AuthorizeActionModel>();
            var cachedata        = CacheFactory.Cache().GetCache <List <AuthorizeActionModel> >("authorizeurldata_" + roleId);

            if (cachedata == null)
            {
                var moduledata    = modulebll.GetModelList("");
                var buttondata    = moduleButtonbll.GetModelList("");
                var authorizedata = roleAuthorizebll.GetModelList("F_ObjectId ='" + roleId + "'");
                foreach (var item in authorizedata)
                {
                    if (item.F_ItemType == 1)
                    {
                        var moduleEntity = moduledata.Find(t => t.F_Id == item.F_ItemId);
                        authorizeurldata.Add(new AuthorizeActionModel {
                            F_Id = moduleEntity.F_Id, F_UrlAddress = moduleEntity.F_UrlAddress
                        });
                    }
                    else if (item.F_ItemType == 2)
                    {
                        var moduleButtonEntity = buttondata.Find(t => t.F_Id == item.F_ItemId);
                        authorizeurldata.Add(new AuthorizeActionModel {
                            F_Id = moduleButtonEntity.F_ModuleId, F_UrlAddress = moduleButtonEntity.F_UrlAddress
                        });
                    }
                }
                CacheFactory.Cache().WriteCache(authorizeurldata, "authorizeurldata_" + roleId, DateTime.Now.AddMinutes(5));
            }
            else
            {
                authorizeurldata = cachedata;
            }
            authorizeurldata = authorizeurldata.FindAll(t => t.F_Id.Equals(moduleId));
            foreach (var item in authorizeurldata)
            {
                if (!string.IsNullOrEmpty(item.F_UrlAddress))
                {
                    string[] url = item.F_UrlAddress.Split('?');
                    if (item.F_Id == moduleId && url[0] == action)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }