示例#1
0
        //批量添加人员权限
        public ActionResult addUserQXMany()
        {
            string canSee    = Request["CanSeeNum"];
            string userIDstr = Request["uidStr"];

            string[] userArray = userIDstr.Split(',');
            int      a         = 0;

            foreach (var u in userArray)
            {
                a = Convert.ToInt32(u);
                var temp = WXXBaoJiaQuanXianService.LoadEntities(x => x.UserID == a).FirstOrDefault();
                if (temp != null)//存在数据,修改
                {
                    temp.CanSeeNum = canSee;
                    WXXBaoJiaQuanXianService.EditEntity(temp);
                }
                else //不存在数据,新增
                {
                    WXXBaoJiaQuanXian wbqx = new WXXBaoJiaQuanXian();
                    wbqx.UserID    = a;
                    wbqx.CanSeeNum = canSee;
                    WXXBaoJiaQuanXianService.AddEntity(wbqx);
                }
            }
            return(Json(new { ret = "ok", msg = "添加成功" }, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        //获取登录用户的快捷方式权限
        public ActionResult getMenuList()
        {
            int uid  = Convert.ToInt32(Request["id"]);
            var temp = WXXBaoJiaQuanXianService.LoadEntities(x => x.UserID == uid).FirstOrDefault();

            if (temp != null)
            {
                WXXQX wxx = new WXXQX();
                wxx.ID     = temp.ID;
                wxx.UserID = temp.UserID;
                string[]      CanSeeAry = temp.CanSeeNum.Split(',');
                List <string> CanSee    = new List <string>();
                for (int i = 0; i < CanSeeAry.Length; i++)
                {
                    var thisID = Convert.ToInt32(CanSeeAry[i]);
                    var aMenu  = WXXMenuInfoService.LoadEntities(x => x.ID == thisID).FirstOrDefault();
                    CanSee.Add(aMenu.EngName);
                }
                wxx.CanSee = CanSee;
                return(Json(new { ret = "ok", rows = wxx }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { ret = "no" }, JsonRequestBehavior.AllowGet));
            }
        }
示例#3
0
        public ActionResult getEditUserQX()
        {
            int uid  = Convert.ToInt32(Request["uid"]);
            var temp = WXXBaoJiaQuanXianService.LoadEntities(x => x.UserID == uid).FirstOrDefault();

            if (temp != null)
            {
                STUBuMen sbm = new STUBuMen();
                sbm.ID   = temp.ID;
                sbm.Name = temp.CanSeeNum;
                return(Json(sbm, JsonRequestBehavior.AllowGet));
            }
            return(Json(null, JsonRequestBehavior.AllowGet));
        }
示例#4
0
        //获取所有成员的权限信息
        public ActionResult getAllUserQXInfo()
        {
            var temp     = WXXBaoJiaQuanXianService.LoadEntities(x => x.ID > 0).DefaultIfEmpty().ToList();
            var menuInfo = WXXMenuInfoService.LoadEntities(x => x.ID > 0).DefaultIfEmpty().ToList();

            if (temp[0] != null)
            {
                foreach (var a in temp)
                {
                    string[] cansee = a.CanSeeNum.Split(',');
                    string   s      = "";
                    for (int i = 0; i < cansee.Length; i++)
                    {
                        for (int j = 0; j < menuInfo.Count; j++)
                        {
                            if (Convert.ToInt32(cansee[i]) == menuInfo[j].ID)
                            {
                                if (i == cansee.Length - 1)
                                {
                                    s = s + menuInfo[j].Name;
                                }
                                else
                                {
                                    s = s + menuInfo[j].Name + ",";
                                }
                            }
                            continue;
                        }
                    }
                    a.CanSeeNum = s;
                }
                var rtmp = from a in temp
                           select new
                {
                    ID       = a.ID,
                    UserID   = a.UserID,
                    UserName = a.UserInfo.PerSonName + "【" + a.UserInfo.BumenInfoSet.Name + "】",
                    QXInfo   = a.CanSeeNum
                };
                return(Json(new { ret = "ok", rows = rtmp }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { ret = "no", msg = "无数据,联系管理员" }, JsonRequestBehavior.AllowGet));
        }
示例#5
0
        //添加人员权限
        public ActionResult addUserQX()
        {
            int uid  = Convert.ToInt32(Request["uid"]);
            var temp = WXXBaoJiaQuanXianService.LoadEntities(x => x.UserID == uid).FirstOrDefault();

            if (temp != null)
            {
                temp.CanSeeNum = Request["CanSeeNum"];
                if (WXXBaoJiaQuanXianService.EditEntity(temp))
                {
                    return(Json(new { ret = "ok", msg = "修改成功" }, JsonRequestBehavior.AllowGet));
                }
                return(Json(new { ret = "no", msg = "修改失败,联系管理员" }, JsonRequestBehavior.AllowGet));
            }
            WXXBaoJiaQuanXian qx = new WXXBaoJiaQuanXian();

            qx.UserID    = uid;
            qx.CanSeeNum = Request["CanSeeNum"];
            WXXBaoJiaQuanXianService.AddEntity(qx);
            return(Json(new { ret = "ok", msg = "添加成功" }, JsonRequestBehavior.AllowGet));
        }