コード例 #1
0
        public ActionResult Edit(int id)
        {
            MemberGroupInfo info = MemberGroupBLL.GetList(p => p.ID == id).FirstOrDefault();

            ViewBag.listSort = Common.GetListOrderID();
            return(View(info));
        }
コード例 #2
0
        public ActionResult SelectUser(int ID)
        {
            var info = ResearchPlanBLL.GetList(a => a.ID == ID).FirstOrDefault();

            ViewBag.listMemberGroup = MemberGroupBLL.GetList(a => a.Enable).OrderByDescending(a => a.SortID).ThenByDescending(a => a.ID)
                                      .Select(a => new SelectListItem()
            {
                Text = a.Name, Value = a.ID.ToString()
            }).ToList();
            ViewBag.listSubject = SubjectBLL.GetList(a => true).ToList().Where(a => info.DepartmentInfo.DepartmentTypeInfo.Contains(a.DepartmentTypeInfo))
                                  .Select(a => new SelectListItem()
            {
                Text = a.Name, Value = a.ID.ToString()
            }).ToList();


            WechatHeaderInfo infoHead = new WechatHeaderInfo();

            infoHead.HeadText        = "人员选择";
            infoHead.LeftURL         = Url == null ? "" : Url.Action("Detail", new { ID = ID });
            ViewBag.WechatHeaderInfo = infoHead;

            ViewBag.SelectedUserJSON = Newtonsoft.Json.JsonConvert.SerializeObject(info.ResearchPlanUserInfo.Select(u => new
            {
                u.ID,
                u.UserID,
                Name = u.UserInfo.Name,
                u.IsConfirmed,
                subjectName    = string.Join(",", u.UserInfo.SubjectInfo.Select(s => s.Name)),
                DepartmentName = u.UserInfo.DepartmentInfo.Name
            }));
            ViewBag.info = info;

            int    MemberGroupID = Function.GetRequestInt("MemberGroupID");
            int    SubjectID     = Function.GetRequestInt("SubjectID");
            string Name          = Function.GetRequestString("Name");
            var    listUser      = UserBLL.GetList(a => a.Enable && a.RuleInfo.Any(r => r.PowerActionInfo.Any(p => p.NewID == PowerInfo.P_评课管理.PP组织调研.PPP听评课管理.添加)));

            if (MemberGroupID > 0)
            {
                listUser = listUser.Where(a => a.MemberGroupInfo.Any(mg => mg.ID == MemberGroupID));
                ViewBag.DdlMemberGroup = MemberGroupID;
            }
            if (SubjectID > 0)
            {
                listUser           = listUser.Where(a => a.SubjectInfo.Any(s => s.ID == SubjectID));
                ViewBag.DdlSubject = SubjectID;
            }
            if (!string.IsNullOrEmpty(Name))
            {
                listUser        = listUser.Where(a => (a.Name.Contains(Name) || a.Tel.Contains(Name) || a.Code.Contains(Name)));
                ViewBag.TxtName = Name;
            }

            listUser = listUser.OrderBy(a => a.Name);
            return(View(listUser));
        }
コード例 #3
0
        public ActionResult Delete(int id)
        {
            var info = MemberGroupBLL.GetList(p => p.ID == id).FirstOrDefault();

            if (null == info)
            {
                return(Json(new APIJson(-1, "删除失败,参数有误", info)));
            }
            if (MemberGroupBLL.Delete(info))
            {
                return(Json(new APIJson(0, "删除成功", info)));
            }
            return(Json(new APIJson(-1, "删除失败,请重试", info)));
        }
コード例 #4
0
        public ActionResult SelectUser(int ID)
        {
            var info = MemberGroupBLL.GetList(a => a.ID == ID).FirstOrDefault();

            ViewBag.SelectedUserJSON = Newtonsoft.Json.JsonConvert.SerializeObject(info.UserInfo.Select(u => new {
                u.ID,
                u.Name,
                subjectName    = string.Join(",", u.SubjectInfo.Select(s => s.Name)),
                DepartmentName = u.DepartmentInfo.Name
            }));
            ViewBag.info = info;
            var listUser = UserBLL.GetList(a => a.Enable).OrderBy(a => a.Name);

            return(View(listUser));
        }
コード例 #5
0
 public ActionResult Create(MemberGroupInfo info)
 {
     if (string.IsNullOrEmpty(info.Name))
     {
         return(Json("请填写名称"));
     }
     if (string.IsNullOrEmpty(info.Description))
     {
         info.Description = string.Empty;
     }
     if (MemberGroupBLL.Create(info).ID > 0)
     {
         return(Json(new APIJson(0, "提交成功", new { info.ID })));
     }
     return(Json(new APIJson(-1, "提交失败,请重试")));
 }
コード例 #6
0
        public ActionResult Index(int page = 1)
        {
            WechatHeaderInfo infoHead = new WechatHeaderInfo();

            infoHead.HeadText        = "用户群组管理";
            ViewBag.WechatHeaderInfo = infoHead;
            //  GetSelectList();


            var list = MemberGroupBLL.GetList(p => true);

            list = list.OrderByDescending(p => p.SortID).ThenByDescending(a => a.ID);
            IPagedList <MemberGroupInfo> result = list.ToPagedList(page, PageSize);

            return(View(result));
        }
コード例 #7
0
        public ActionResult SelectUser(int UserID, bool IsAdd, int MemberGroupID)
        {
            var info     = MemberGroupBLL.GetList(a => a.ID == MemberGroupID).FirstOrDefault();
            var infoUser = info.UserInfo.FirstOrDefault(a => a.ID == UserID);
            var result   = true;

            if (!IsAdd)
            {
                if (null != infoUser)
                {
                    info.UserInfo.Remove(infoUser);
                    result = true;
                }
            }
            else
            {
                if (null == infoUser)
                {
                    infoUser = UserBLL.GetList(a => a.ID == UserID).FirstOrDefault();
                    if (null == infoUser)
                    {
                        result = false;
                    }
                    else
                    {
                        info.UserInfo.Add(infoUser);
                        result = true;
                    }
                }
            }
            if (result)
            {
                result = MemberGroupBLL.Edit(info);
            }
            if (result)
            {
                var SelectedUserJSON = info.UserInfo.ToList().Select(u => new
                {
                    u.ID,
                    u.Name,
                    subjectName = string.Join(",", u.SubjectInfo.Select(s => s.Name))
                });
                return(Json(new APIJson(0, "处理成功", SelectedUserJSON)));
            }
            return(Json(new APIJson(-1, "处理失败,请重试")));
        }
コード例 #8
0
        private void GetSelectList()
        {
            ViewBag.listRule = RuleBLL.GetList(a => a.Enable).Select(p => new SelectListItem()
            {
                Text = p.Name, Value = p.ID.ToString()
            }).ToList();
            ViewBag.listMemberGroup = MemberGroupBLL.GetList(a => a.Enable).Select(p => new SelectListItem()
            {
                Text = p.Name, Value = p.ID.ToString()
            }).ToList();
            IEnumerable <SelectListItem> listDepartmentID = DepartmentBLL.GetList(p => p.Enable == true).Select(p => new SelectListItem {
                Text = p.Name, Value = p.ID.ToString()
            }).ToList();

            if (!PowerActionBLL.PowerCheck(PowerInfo.P_系统管理.PP系统帐户管理.PPP用户管理.查看所有帐户))
            {
                listDepartmentID = listDepartmentID.Where(a => a.Value == CurrentUser.ToString());
            }
            ViewBag.listDepartment = listDepartmentID;
        }
コード例 #9
0
        public ActionResult Edit(MemberGroupInfo info)
        {
            MemberGroupInfo infoExist = MemberGroupBLL.GetList(p => p.ID == info.ID).FirstOrDefault();

            if (string.IsNullOrEmpty(info.Name))
            {
                return(Json("请填写名称"));
            }
            if (string.IsNullOrEmpty(info.Description))
            {
                info.Description = string.Empty;
            }
            infoExist.Name        = info.Name;
            infoExist.Description = info.Description;
            infoExist.SortID      = info.SortID;
            infoExist.Enable      = info.Enable;

            if (MemberGroupBLL.Edit(infoExist))
            {
                return(Json(new APIJson(0, "提交成功")));
            }
            return(Json(new APIJson(-1, "提交失败,请重试")));
        }
コード例 #10
0
        public ActionResult Detail(int id)
        {
            MemberGroupInfo info = MemberGroupBLL.GetList(p => p.ID == id).FirstOrDefault();

            return(View(info));
        }