Ejemplo n.º 1
0
        public static List <User> createListOfUsersFromReader(SqlDataReader reader, List <Role> roles, List <Application> applications)
        {
            List <User> list = new List <User>();

            while (reader.Read())
            {
                int    id                 = reader.GetInt32(0);
                String login              = reader.GetString(1),
                       password           = reader.GetString(2);
                Boolean  activeFlag       = reader.GetBoolean(3);
                DateTime createdDate      = reader.GetDateTime(4);
                int      createdBy        = reader.GetInt32(5);
                int      lastModifiedBy   = reader.GetInt32(6);
                DateTime lastModifiedDate = reader.GetDateTime(7);

                List <int> supportedAppId = ApplicationDAO.getAppIdForThisUser(id);
                List <int> userRole       = RoleDAO.getRoleIdForThisUser(id);

                List <Role> role = getRoleFromList(roles, userRole);

                User user = new User(id, login, password, supportedAppId, role, activeFlag, createdDate, lastModifiedDate, createdBy, lastModifiedBy);
                list.Add(user);
            }

            return(list);
        }
        private static List <Application> convertReaderToList(SqlDataReader reader)
        {
            List <Application> list = new List <Application>();

            while (reader.Read())
            {
                int      id             = reader.GetInt32(0);
                String   name           = reader.GetString(1);
                Boolean  isActive       = reader.GetByte(2) == 1;
                DateTime creationDate   = reader.GetDateTime(3);
                int      createdBy      = reader.GetInt32(4);
                int      lastModifiedBy = reader.GetInt32(5);
                DateTime lastModifiedOn = reader.GetDateTime(6);

                List <Role> roles = RoleDAO.getAllRolesForApplication(id);

                Application app = new Application(id, name, roles, isActive, creationDate, lastModifiedOn, createdBy, lastModifiedBy);
                list.Add(app);
            }

            return(list);
        }
Ejemplo n.º 3
0
        private static List <User> makeUsersOutOfReader(SqlDataReader reader)
        {
            List <User> user = new List <User>();

            while (reader.Read())
            {
                int    id                 = reader.GetInt32(0);
                String login              = reader.GetString(1),
                       password           = reader.GetString(2);
                Boolean  activeFlag       = reader.GetByte(3) == 1;
                DateTime createdDate      = reader.GetDateTime(4);
                int      createdBy        = reader.GetInt32(5);
                int      lastModifiedBy   = reader.GetInt32(6);
                DateTime lastModifiedDate = reader.GetDateTime(7);

                List <int>  supportedAppId = ApplicationDAO.getAppIdForThisUser(id);
                List <Role> role           = RoleDAO.getAllRolesForThisUser(id);

                user.Add(new User(id, login, password, supportedAppId, role, activeFlag, createdDate, lastModifiedDate, createdBy, lastModifiedBy));
            }

            return(user);
        }