Пример #1
0
        public string GetUserRole(HttpContext context)
        {
            string roleID = context.Request.QueryString["id"];
            //List<Sys_RolePurview> list = new BLL.BLLSys_RolePurview().FindWhere(" RolePurview_RoleID ='" + roleID + "'");
            List <Sys_RolePurview> list = new BLL.Sys_RolePurviewBLL().GetList(p => p.RolePurview_RoleID == roleID).ToList();
            string roleList             = list.ToJson <Sys_RolePurview>();//JosnHandler.GetJson<List<Sys_RolePurview>>(list);

            return(roleList);
        }
Пример #2
0
        /// <summary>
        /// 保存部门查看范围
        /// </summary>
        /// <param name="context"></param>
        public string SaveDep(HttpContext context)
        {
            string st        = "0";
            string codes     = context.Request.QueryString["code"];
            string roleId    = context.Request.QueryString["roleId"];
            string menucode  = context.Request.QueryString["menucode"];
            string seeCharge = context.Request.QueryString["seeCharge"];
            string seeType   = context.Request.QueryString["type"];
            string showType  = context.Request.QueryString["showType"];
            string see       = "";

            if (!string.IsNullOrEmpty(seeCharge))
            {
                var ds = seeCharge.Split(',');
                for (int i = 0; i < ds.Count(); i++)
                {
                    if (ds[i].Contains("_"))
                    {
                        see += ds[i].Split('_')[0] + "_";

                        //Sys_SeeCharge ses = bllSee.Find(ds[i].Split('_')[1]);
                        string        ids = ds[i].Split('_')[1];
                        Sys_SeeCharge ses = bllSee.Get(p => p.SeeChargeID == ids);
                        if (ses != null)
                        {
                            see += ses.SeeCharge_Name + ",";
                        }
                    }
                    else
                    {
                        // see += ds[i].Split('_')[0] + "_";

                        //Sys_SeeCharge ses = bllSee.Find(ds[i]);
                        string        ids = ds[i];
                        Sys_SeeCharge ses = bllSee.Get(p => p.SeeChargeID == ids);
                        if (ses != null)
                        {
                            see += ses.SeeCharge_Name + ",";
                        }
                    }
                }
            }
            if (see.Length > 0)
            {
                see = see.Substring(0, see.Length - 1);
                var    da  = codes.Split(',');
                string str = "";
                for (int i = 0; i < da.Count(); i++)
                {
                    str += "'" + da[i] + "',";
                }
                if (str.Length > 0)
                {
                    string msg = string.Empty;
                    str = str.Substring(0, str.Length - 1);
                    Sys_RolePurviewBLL bllRP = new BLL.Sys_RolePurviewBLL();
                    //List<Sys_RolePurview> list = bllRP.FindWhere(" RolePurview_RoleID ='" + roleId + "' and RolePurview_MenuCode='" + menucode + "'");
                    List <Sys_RolePurview> list = bllRP.GetList(p => p.RolePurview_RoleID == roleId && p.RolePurview_MenuCode == menucode).ToList();

                    if (list.Count == 1)
                    {
                        Sys_RolePurview p = list[0];
                        p.RolePurview_SeeDepCode = str;
                        p.RolePurview_SeeCharge  = see;
                        p.RolePurview_SeeType    = seeType;
                        if (bllRP.Update(p))
                        {
                            st = "1";
                        }
                    }
                    else
                    {
                        Sys_RolePurview p = new Sys_RolePurview();
                        p.RolePurviewID          = Guid.NewGuid().ToString();
                        p.RolePurview_RoleID     = roleId;
                        p.RolePurview_MenuCode   = menucode;
                        p.RolePurview_SeeDepCode = str;
                        p.RolePurview_SeeCharge  = see;
                        p.RolePurview_SeeType    = seeType;
                        if (bllRP.Add(p))
                        {
                            st = "1";
                        }
                    }
                }
            }
            else
            {
                st = "0";
            }


            return(st);
        }