예제 #1
0
        private UserInfo MapUser(IDataReader reader)
        {
            UserInfo s = new UserInfo();
            UserTracks t = new UserTracks();
            Campus c = new Campus();
            int startingIndex = 0;

            s.Id = reader.GetSafeInt32(startingIndex++);
            s.FirstName = reader.GetSafeString(startingIndex++);
            s.LastName = reader.GetSafeString(startingIndex++);
            s.Email = reader.GetSafeString(startingIndex++);
            s.Gender = reader.GetSafeInt32(startingIndex++);
            s.Phone = reader.GetSafeString(startingIndex++);
            s.UserName = reader.GetSafeString(startingIndex++);
            s.UserId = reader.GetSafeString(startingIndex++);

            s.Bio = reader.GetSafeString(startingIndex++);
            s.DesiredTrack = reader.GetSafeInt32(startingIndex++);
            s.DesiredCampusLocation = reader.GetSafeInt32(startingIndex++);
            s.CoverPhotoPath = reader.GetSafeString(startingIndex++);
            s.AvatarPhotoPath = reader.GetSafeString(startingIndex++);
            s.CoverPhotoUrl = _fileService.GetFullUrl(s.CoverPhotoPath);
            s.AvatarPhotoUrl = _fileService.GetFullUrl(s.AvatarPhotoPath);
            t.Name = reader.GetSafeString(startingIndex++);
            c.Id = reader.GetSafeInt32(startingIndex++);
            c.Name = reader.GetSafeString(startingIndex++);
            s.AddressId = reader.GetSafeInt32(startingIndex++);
            s.Facebook = reader.GetSafeString(startingIndex++);
            s.LinkedIn = reader.GetSafeString(startingIndex++);
            s.Twitter = reader.GetSafeString(startingIndex++);
            s.Webpage = reader.GetSafeString(startingIndex++);

            s.Campuses = c;
            s.UserTracks = t;

            return s;
        }
예제 #2
0
        public List<UserInfo> GetsList()
        {
            List<UserInfo> list = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.Users_Select"
               , inputParamMapper: null
               , map: delegate (IDataReader reader, short set)
               {
                   UserInfo s = new UserInfo();
                   int startingIndex = 0;

                   s.Id = reader.GetSafeInt32(startingIndex++);
                   s.FirstName = reader.GetSafeString(startingIndex++);
                   s.LastName = reader.GetSafeString(startingIndex++);
                   s.Email = reader.GetSafeString(startingIndex++);
                   s.Gender = reader.GetSafeInt32(startingIndex++);
                   s.Phone = reader.GetSafeString(startingIndex++);
                   s.UserName = reader.GetSafeString(startingIndex++);
                   s.Bio = reader.GetSafeString(startingIndex++);
                   s.DesiredTrack = reader.GetSafeInt32(startingIndex++);
                   s.DesiredCampusLocation = reader.GetSafeInt32(startingIndex++);

                   if (list == null)
                   {
                       list = new List<UserInfo>();
                   }

                   list.Add(s);
               }
               );

            return list;
        }