Ejemplo n.º 1
0
 bool IUserGroupDeleteCheck.CanBeDeleted(UserGroup group)
 {
     using (UserGroupRepository repository = new UserGroupRepository())
     {
         return repository.IsUserGroupContainsUser(group);
     }
 }
Ejemplo n.º 2
0
 public string Add(string title) {
     UserGroup ug = new UserGroup();
     ug.Title = title;
     UserGroupService ugs = new UserGroupService();
     ugs.Add(ug);
     List<UserGroup> list = ugs.FindAll();
     UserGroupViewModel ugv = new UserGroupViewModel(list[list.Count-1]);
     string result = JsonConvert.SerializeObject(ugv);
     return result;
 }
Ejemplo n.º 3
0
 public static void TestAddUserGroup()
 {
     UserGroup group = new UserGroup
     {
         CreateTime=DateTime.Now,
         Description="",
         Title="R2Team"
     };
     UserGroupRepository context = new UserGroupRepository();
     context.Add(group);
 }
Ejemplo n.º 4
0
 public string Rename(string id,string name) {
     UserGroupService ugs = new UserGroupService();
     List<UserGroup> list = ugs.FindAll();
     UserGroup ug = new UserGroup();
     for (int i = 0; i < list.Count; i++)
     {
         if (id == list[i].Id + "")
         {
             ug = list[i];
         }
     }
     ug.Title = name;
     ugs.Update(ug);
     return null;
 }
Ejemplo n.º 5
0
 public UserGroupViewModel(UserGroup userGroup) {
     this.Id = userGroup.Id;
     this.Title = userGroup.Title;
 }
Ejemplo n.º 6
0
        public ActionResult SearchPorformUser(string key)
        {
            int groupId = 0;
            string newkey = System.Web.HttpUtility.UrlDecode(key).ToLower().Trim();
            R2.RRDL.BusinessModel.UserService us = new UserService();
            UserGroupService ugs = new UserGroupService();

            List<User> lists = new List<User>();
            List<UserGroup> listsgroup = new List<UserGroup>();
            listsgroup = ugs.FindAll();
            lists = us.FindAll();

            List<UserViewModel> listuvm = new List<UserViewModel>();
            for (int i = 0; i < listsgroup.Count; i++)
            {
                UserGroup ug = new UserGroup();
                ug = listsgroup[i];
                if (ug.Title.ToLower().Contains(newkey))
                {
                    groupId = ug.Id;
                    for (int j = 0; j < lists.Count; j++)
                    {
                        UserViewModel uvm = new UserViewModel();
                        uvm.Id = lists[j].Id;
                        uvm.ApproveStatus = lists[j].ApproveStatus;
                        uvm.RealName = lists[j].RealName;
                        uvm.RegisterName = lists[j].RegisterName;
                        uvm.ReplyContent = lists[j].ReplyContent;
                        uvm.NickName = lists[j].NickName;
                        uvm.Gender = lists[j].Gender;
                        uvm.AuthorityCategory = lists[j].AuthorityCategory;
                        uvm.PersonalDescription = lists[j].PersonalDescription;

                        if ((R2.RRDL.Models.EnumAriticleApproveStatus)uvm.ApproveStatus == R2.RRDL.Models.EnumAriticleApproveStatus.Approved && lists[j].ContentGroupId == groupId)
                        {
                            if (!isExtence(listuvm, uvm))
                            {
                                listuvm.Add(uvm);
                            }
                        }
                    }
                }
            }
            if (listuvm.Count <= 0)
            {
                for (int j = 0; j < lists.Count; j++)
                {
                    UserViewModel uvm1 = new UserViewModel();
                    uvm1.Id = lists[j].Id;
                    uvm1.ApproveStatus = lists[j].ApproveStatus;
                    uvm1.RealName = lists[j].RealName;
                    uvm1.RegisterName = lists[j].RegisterName;
                    uvm1.ReplyContent = lists[j].ReplyContent;
                    uvm1.NickName = lists[j].NickName;
                    uvm1.Gender = lists[j].Gender;
                    uvm1.AuthorityCategory = lists[j].AuthorityCategory;
                    uvm1.PersonalDescription = lists[j].PersonalDescription;

                    if ((R2.RRDL.Models.EnumAriticleApproveStatus)uvm1.ApproveStatus == R2.RRDL.Models.EnumAriticleApproveStatus.Approved && uvm1.RealName.Contains(newkey))
                    {
                        if (!isExtence(listuvm, uvm1))
                        {
                            listuvm.Add(uvm1);
                        }
                    }
                }
            }
            if (newkey.ToLower().Contains("管理员") || newkey.ToLower().Contains("管理") || newkey.ToLower().Contains("管") || newkey.ToLower().Contains("理"))
            {
                for (int k = 0; k < lists.Count; k++)
                {
                    UserViewModel uvm2 = new UserViewModel();
                    uvm2.Id = lists[k].Id;
                    uvm2.ApproveStatus = lists[k].ApproveStatus;
                    uvm2.RealName = lists[k].RealName;
                    uvm2.RegisterName = lists[k].RegisterName;
                    uvm2.ReplyContent = lists[k].ReplyContent;
                    uvm2.NickName = lists[k].NickName;
                    uvm2.Gender = lists[k].Gender;
                    uvm2.AuthorityCategory = lists[k].AuthorityCategory;
                    uvm2.PersonalDescription = lists[k].PersonalDescription;

                    if ((R2.RRDL.Models.EnumAriticleApproveStatus)uvm2.ApproveStatus == R2.RRDL.Models.EnumAriticleApproveStatus.Approved && uvm2.AuthorityCategory == R2.RRDL.Models.EnumUserCategory.Administrator)
                    {
                        if (!isExtence(listuvm, uvm2))
                        {
                            listuvm.Add(uvm2);
                        }
                    }
                }
            }

            string result = JsonConvert.SerializeObject(listuvm);
            result = result + "ContentAndCount" + listuvm.Count.ToString();
            return Content(result);
        }