Пример #1
0
 /// <summary>
 /// Constructor for the Group Edit view
 /// </summary>
 /// <param name="user"></param>
 /// <param name="groupId"></param>
 /// <param name="groupName"></param>
 /// <param name="adding"></param>
 public GroupsModel(MxUser user, string groupId, string groupName, bool adding)
 {
     Usr           = user;
     GroupSections = new List <GroupSection>();
     GroupRoles    = BLL.Groups.RolesForGroupList(new Guid(groupId));
     GroupName     = groupName;
     GroupId       = groupId;
     Adding        = adding;
     foreach (BLL.GroupRole role in GroupRoles)
     {
         string []    names = role.RoleName.Split('_');
         GroupSection gs    = new GroupSection();
         if (GroupSectionCreated(names[0], out gs))
         {
             gs.Add(role);
         }
         else
         {
             gs.Name        = names[0];
             gs.Description = role.Description;
             gs.Add(role);
             gs.Id = Guid.NewGuid().ToString();
             GroupSections.Add(gs);
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Determines if a GroupSection has been created yet
 /// </summary>
 /// <param name="name">The GroupSection that we are looking for</param>
 /// <param name="section">out parameter - returns the GroupSection if it exists</param>
 /// <returns>true if the GroupSection exists, false if not</returns>
 public bool GroupSectionCreated(string name, out GroupSection section)
 {
     section = new GroupSection();
     foreach (GroupSection gs in GroupSections)
     {
         if (gs.Name == name)
         {
             section = gs;
             return(true);
         }
     }
     return(false);
 }
Пример #3
0
 /// <summary>
 /// Determines if a GroupSection has been created yet
 /// </summary>
 /// <param name="name">The GroupSection that we are looking for</param>
 /// <param name="section">out parameter - returns the GroupSection if it exists</param>
 /// <returns>true if the GroupSection exists, false if not</returns>
 public bool GroupSectionCreated(string name, out GroupSection section)
 {
     section = new GroupSection();
     foreach (GroupSection gs in GroupSections)
     {
         if (gs.Name == name)
         {
             section = gs;
             return true;
         }
     }
     return false;
 }
Пример #4
0
 /// <summary>
 /// Constructor for the Group Edit view
 /// </summary>
 /// <param name="user"></param>
 /// <param name="groupId"></param>
 /// <param name="groupName"></param>
 /// <param name="adding"></param>
 public GroupsModel(MxUser user, string groupId, string groupName, bool adding)
 {
     Usr = user;
     GroupSections = new List<GroupSection>();
     GroupRoles = BLL.Groups.RolesForGroupList(new Guid(groupId));
     GroupName = groupName;
     GroupId = groupId;
     Adding = adding;
     foreach (BLL.GroupRole role in GroupRoles)
     {
         string [] names = role.RoleName.Split('_');
         GroupSection gs = new GroupSection();
         if (GroupSectionCreated(names[0], out gs))
         {
             gs.Add(role);
         }
         else
         {
             gs.Name = names[0];
             gs.Description = role.Description;
             gs.Add(role);
             gs.Id = Guid.NewGuid().ToString();
             GroupSections.Add(gs);
         }
     }
 }