Beispiel #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));
        }
Beispiel #2
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));
        }