Ejemplo n.º 1
0
 public static List<Group> GetAllGroups()
 {
     List<Group> result = new List<Group>();
     NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);
     var dbGroups = from g in newAppsCnn.Sec_Groups select g;
     foreach (var dbGroup in dbGroups)
     {
         Group group = new Group();
         group.FromDbGroup(dbGroup);
         result.Add(group);
     }
     return result;
 }
Ejemplo n.º 2
0
 public void LoadDbUserGroups(Sec_Users _dbUser)
 {
     Groups.Clear();
     foreach (var dbGroup in _dbUser.Sec_Groups)
     {
         Group group = new Group();
         group.FromDbGroup(dbGroup);
         this.Groups.Add(group);
     }
 }
Ejemplo n.º 3
0
 public static Group GetGroup(MoveCommandEnum _moveCommand,Group _crGroup)
 {
     Sec_Groups dbGroup = null;
     NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);
     switch (_moveCommand)
     {
         case MoveCommandEnum.MoveFirst:
             dbGroup = newAppsCnn.Sec_Groups.FirstOrDefault();
             break;
         case MoveCommandEnum.MovePrev:
             if (_crGroup != null)
                 dbGroup = (from g in newAppsCnn.Sec_Groups where g.GroupID.CompareTo(_crGroup.GroupID) < 0 orderby g.GroupID descending select g).FirstOrDefault();
             break;
         case MoveCommandEnum.MoveNext:
             if (_crGroup != null)
                 dbGroup = (from g in newAppsCnn.Sec_Groups where g.GroupID.CompareTo(_crGroup.GroupID) > 0 orderby g.GroupID ascending select g).FirstOrDefault();
             break;
         case MoveCommandEnum.MoveLast:
             dbGroup = (from g in newAppsCnn.Sec_Groups orderby g.GroupID descending select g).FirstOrDefault();
             break;
         case MoveCommandEnum.Refresh:
             if (_crGroup != null)
                 dbGroup = (from g in newAppsCnn.Sec_Groups where g.GroupID == _crGroup.GroupID select g).FirstOrDefault();
             break;
     }
     if (dbGroup != null)
     {
         Group group = new Group();
         group.FromDbGroup(dbGroup);
         group.LoadGroupUsers(dbGroup);
         return group;
     }
     else
         return null;
 }
Ejemplo n.º 4
0
 public static Group GetGroupByID(string groupID)
 {
     NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);
     var dbGroup = (from g in newAppsCnn.Sec_Groups where g.GroupID == groupID select g).FirstOrDefault();
     if (dbGroup != null)
     {
         Group group = new Group();
         group.FromDbGroup(dbGroup);
         group.LoadGroupUsers(dbGroup);
         return group;
     }
     else
         return null;
 }