Esempio n. 1
0
        public List<DataObjectAttendees> GetAllAttendees(string sortData)
        {
            var conn = new SqlConnection(connectionString);
            conn.Open();
            var DataTemplateODSList = new List<DataObjectAttendees>();
            SqlDataReader reader = null;
            const string sqlSelectString = "SELECT Username,ApplicationName,Email,Comment,Password,PasswordQuestion,PasswordAnswer,IsApproved,LastActivityDate,LastLoginDate,CreationDate,IsOnLine,IsLockedOut,LastLockedOutDate,FailedPasswordAttemptCount,FailedPasswordAttemptWindowStart,FailedPasswordAnswerAttemptCount,FailedPasswordAnswerAttemptWindowStart,LastPasswordChangedDate,UserWebsite,UserLocation,UserImage,UserFirstName,UserLastName,UserZipCode,UserBio,UserShareInfo,ReferralGUID,ConfirmedDate,VistaSlotsId,FullNameUsernameZipcode,VistaOnly,SaturdayClasses,SundayClasses,DesktopOrLaptopForVista,SaturdayDinner,PKID FROM [dbo].[Attendees] ORDER BY UserLastName,UserFirstName ";
            var cmd = new SqlCommand(sqlSelectString, conn);
            reader = cmd.ExecuteReader();
            try
            {
                while (reader.Read())
                {
                    string username = reader.IsDBNull(0) ? "" : reader.GetString(0);
                    string applicationname = reader.IsDBNull(1) ? "" : reader.GetString(1);
                    string email = reader.IsDBNull(2) ? "" : reader.GetString(2);
                    string comment = reader.IsDBNull(3) ? "" : reader.GetString(3);
                    string password = reader.IsDBNull(4) ? "" : reader.GetString(4);
                    string passwordquestion = reader.IsDBNull(5) ? "" : reader.GetString(5);
                    string passwordanswer = reader.IsDBNull(6) ? "" : reader.GetString(6);
                    bool isapproved = reader.IsDBNull(7) ? false : reader.GetBoolean(7);
                    DateTime lastactivitydate = reader.IsDBNull(8) ? DateTime.Now : reader.GetDateTime(8);
                    DateTime lastlogindate = reader.IsDBNull(9) ? DateTime.Now : reader.GetDateTime(9);
                    DateTime creationdate = reader.IsDBNull(10) ? DateTime.Now : reader.GetDateTime(10);
                    bool isonline = reader.IsDBNull(11) ? false : reader.GetBoolean(11);
                    bool islockedout = reader.IsDBNull(12) ? false : reader.GetBoolean(12);
                    DateTime lastlockedoutdate = reader.IsDBNull(13) ? DateTime.Now : reader.GetDateTime(13);
                    int failedpasswordattemptcount = reader.IsDBNull(14) ? 0 : reader.GetInt32(14);
                    DateTime failedpasswordattemptwindowstart = reader.IsDBNull(15)
                                                                    ? DateTime.Now
                                                                    : reader.GetDateTime(15);
                    int failedpasswordanswerattemptcount = reader.IsDBNull(16) ? 0 : reader.GetInt32(16);
                    DateTime failedpasswordanswerattemptwindowstart = reader.IsDBNull(17)
                                                                          ? DateTime.Now
                                                                          : reader.GetDateTime(17);
                    DateTime lastpasswordchangeddate = reader.IsDBNull(18) ? DateTime.Now : reader.GetDateTime(18);
                    string userwebsite = reader.IsDBNull(19) ? "" : reader.GetString(19);
                    string userlocation = reader.IsDBNull(20) ? "" : reader.GetString(20);
                    SqlBytes userimage = reader.IsDBNull(21) ? new SqlBytes() : reader.GetSqlBytes(21);
                    string userfirstname = reader.IsDBNull(22) ? "" : reader.GetString(22);
                    string userlastname = reader.IsDBNull(23) ? "" : reader.GetString(23);
                    string userzipcode = reader.IsDBNull(24) ? "" : reader.GetString(24);
                    string userbio = reader.IsDBNull(25) ? "" : reader.GetString(25);
                    bool usershareinfo = reader.IsDBNull(26) ? false : reader.GetBoolean(26);
                    Guid referralguid = reader.IsDBNull(27) ? Guid.NewGuid() : reader.GetGuid(27);
                    DateTime confirmeddate = reader.IsDBNull(28) ? DateTime.Now : reader.GetDateTime(28);
                    int vistaslotsid = reader.IsDBNull(29) ? 0 : reader.GetInt32(29);
                    string fullnameusernamezipcode = reader.IsDBNull(30) ? "" : reader.GetString(30);
                    bool vistaonly = reader.IsDBNull(31) ? false : reader.GetBoolean(31);
                    bool saturdayclasses = reader.IsDBNull(32) ? false : reader.GetBoolean(32);
                    bool sundayclasses = reader.IsDBNull(33) ? false : reader.GetBoolean(33);
                    string desktoporlaptopforvista = reader.IsDBNull(34) ? "" : reader.GetString(34);
                    bool saturdaydinner = reader.IsDBNull(35) ? false : reader.GetBoolean(35);
                    Guid pkid = reader.IsDBNull(36) ? Guid.NewGuid() : reader.GetGuid(36);
                    var td = new DataObjectAttendees(username, applicationname, email, comment, password,
                                                     passwordquestion, passwordanswer, isapproved, lastactivitydate,
                                                     lastlogindate, creationdate, isonline, islockedout,
                                                     lastlockedoutdate, failedpasswordattemptcount,
                                                     failedpasswordattemptwindowstart, failedpasswordanswerattemptcount,
                                                     failedpasswordanswerattemptwindowstart, lastpasswordchangeddate,
                                                     userwebsite, userlocation, userimage, userfirstname, userlastname,
                                                     userzipcode, userbio, usershareinfo, referralguid, confirmeddate,
                                                     vistaslotsid, fullnameusernamezipcode, vistaonly, saturdaydinner,
                                                     saturdayclasses, sundayclasses, desktoporlaptopforvista, pkid);
                    DataTemplateODSList.Add(td);
                }
            }
            finally
            {
                if (reader != null) reader.Close();
            }
            conn.Close();

            if (sortData == null)
            {
                sortData = "Pkid";
            }
            if (sortData.Length == 0)
            {
                sortData = "Pkid";
            }
            string sortDataBase = sortData;
            string descString = " DESC";
            if (sortData.EndsWith(descString))
            {
                sortDataBase = sortData.Substring(0, sortData.Length - descString.Length);
            }
            Comparison<DataObjectAttendees> comparison = null;
            switch (sortDataBase)
            {
                case "Username":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Username.CompareTo(rhs.Username); };
                    break;
                case "Applicationname":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Applicationname.CompareTo(rhs.Applicationname); };
                    break;
                case "Email":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Email.CompareTo(rhs.Email); };
                    break;
                case "Comment":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Comment.CompareTo(rhs.Comment); };
                    break;
                case "Password":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Password.CompareTo(rhs.Password); };
                    break;
                case "Passwordquestion":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Passwordquestion.CompareTo(rhs.Passwordquestion); };
                    break;
                case "Passwordanswer":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Passwordanswer.CompareTo(rhs.Passwordanswer); };
                    break;
                case "Isapproved":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Isapproved.CompareTo(rhs.Isapproved); };
                    break;
                case "Lastactivitydate":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Lastactivitydate.CompareTo(rhs.Lastactivitydate); };
                    break;
                case "Lastlogindate":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Lastlogindate.CompareTo(rhs.Lastlogindate); };
                    break;
                case "Creationdate":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Creationdate.CompareTo(rhs.Creationdate); };
                    break;
                case "Isonline":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Isonline.CompareTo(rhs.Isonline); };
                    break;
                case "Islockedout":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Islockedout.CompareTo(rhs.Islockedout); };
                    break;
                case "Lastlockedoutdate":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Lastlockedoutdate.CompareTo(rhs.Lastlockedoutdate); };
                    break;
                case "Failedpasswordattemptcount":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Failedpasswordattemptcount.CompareTo(rhs.Failedpasswordattemptcount); };
                    break;
                case "Failedpasswordattemptwindowstart":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs)
                            {
                                return
                                    lhs.Failedpasswordattemptwindowstart.CompareTo(rhs.Failedpasswordattemptwindowstart);
                            };
                    break;
                case "Failedpasswordanswerattemptcount":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs)
                            {
                                return
                                    lhs.Failedpasswordanswerattemptcount.CompareTo(rhs.Failedpasswordanswerattemptcount);
                            };
                    break;
                case "Failedpasswordanswerattemptwindowstart":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs)
                            {
                                return
                                    lhs.Failedpasswordanswerattemptwindowstart.CompareTo(
                                        rhs.Failedpasswordanswerattemptwindowstart);
                            };
                    break;
                case "Lastpasswordchangeddate":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Lastpasswordchangeddate.CompareTo(rhs.Lastpasswordchangeddate); };
                    break;
                case "Userwebsite":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Userwebsite.CompareTo(rhs.Userwebsite); };
                    break;
                case "Userlocation":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Userlocation.CompareTo(rhs.Userlocation); };
                    break;
                case "Userfirstname":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Userfirstname.CompareTo(rhs.Userfirstname); };
                    break;
                case "Userlastname":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Userlastname.CompareTo(rhs.Userlastname); };
                    break;
                case "Userzipcode":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Userzipcode.CompareTo(rhs.Userzipcode); };
                    break;
                case "Userbio":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Userbio.CompareTo(rhs.Userbio); };
                    break;
                case "Usershareinfo":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Usershareinfo.CompareTo(rhs.Usershareinfo); };
                    break;
                case "Confirmeddate":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Confirmeddate.CompareTo(rhs.Confirmeddate); };
                    break;
                case "Vistaslotsid":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Vistaslotsid.CompareTo(rhs.Vistaslotsid); };
                    break;
                case "Fullnameusernamezipcode":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Fullnameusernamezipcode.CompareTo(rhs.Fullnameusernamezipcode); };
                    break;
                case "Vistaonly":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Vistaonly.CompareTo(rhs.Vistaonly); };
                    break;
                case "Saturdayclasses":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Saturdayclasses.CompareTo(rhs.Saturdayclasses); };
                    break;
                case "Sundayclasses":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Sundayclasses.CompareTo(rhs.Sundayclasses); };
                    break;
                case "Desktoporlaptopforvista":
                    comparison =
                        delegate(DataObjectAttendees lhs, DataObjectAttendees rhs) { return lhs.Desktoporlaptopforvista.CompareTo(rhs.Desktoporlaptopforvista); };
                    break;
            }
            if (comparison != null)
            {
                DataTemplateODSList.Sort(comparison);
                if (sortData.ToLower().EndsWith("desc"))
                {
                    DataTemplateODSList.Reverse();
                }
            }
            return DataTemplateODSList;
        }
Esempio n. 2
0
        public List<DataObjectAttendees> GetByUsername(string sortData, string searchusername, bool cacheResultSet)
        {
            List<DataObjectAttendees> DataTemplateODSList;
            string cacheName = Utils.CacheAttendeeByUserName + "_" + searchusername;

            if (!cacheResultSet)
            {
                HttpContext.Current.Cache.Remove(cacheName);
            }

            if (HttpContext.Current.Cache[cacheName] == null)
            {
                var conn = new SqlConnection(connectionString);
                conn.Open();
                DataTemplateODSList = new List<DataObjectAttendees>();
                SqlDataReader reader = null;
                // PGK modified search to not be crazy isnull stuff
                string sqlSelectString =
                    @"SELECT Username,
                       ApplicationName,
                       Email,
                       Comment,
                       Password,
                       PasswordQuestion,
                       PasswordAnswer,
                       IsApproved,
                       LastActivityDate,
                       LastLoginDate,
                       CreationDate,
                       IsOnLine,
                       IsLockedOut,
                       LastLockedOutDate,
                       FailedPasswordAttemptCount,
                       FailedPasswordAttemptWindowStart,
                       FailedPasswordAnswerAttemptCount,
                       FailedPasswordAnswerAttemptWindowStart,
                       LastPasswordChangedDate,
                       UserWebsite,
                       UserLocation,
                       UserImage,
                       UserFirstName,
                       UserLastName,
                       UserZipCode,
                       UserBio,
                       UserShareInfo,
                       ReferralGUID,
                       ConfirmedDate,
                       VistaSlotsId,
                       FullNameUsernameZipcode,
                       VistaOnly,
                       SaturdayClasses,
                       SundayClasses,
                       DesktopOrLaptopForVista,
                       SaturdayDinner,
                       PKID
                FROM [dbo].[Attendees]
                WHERE username = @searchusername";
                var cmd = new SqlCommand(sqlSelectString, conn);
                cmd.Parameters.Add("@searchusername", SqlDbType.VarChar).Value = searchusername ?? string.Empty;
                reader = cmd.ExecuteReader();
                try
                {
                    while (reader.Read())
                    {
                        string username = reader.IsDBNull(0) ? "" : reader.GetString(0);
                        string applicationname = reader.IsDBNull(1) ? "" : reader.GetString(1);
                        string email = reader.IsDBNull(2) ? "" : reader.GetString(2);
                        string comment = reader.IsDBNull(3) ? "" : reader.GetString(3);
                        string password = reader.IsDBNull(4) ? "" : reader.GetString(4);
                        string passwordquestion = reader.IsDBNull(5) ? "" : reader.GetString(5);
                        string passwordanswer = reader.IsDBNull(6) ? "" : reader.GetString(6);
                        bool isapproved = reader.IsDBNull(7) ? false : reader.GetBoolean(7);
                        DateTime lastactivitydate = reader.IsDBNull(8) ? DateTime.Now : reader.GetDateTime(8);
                        DateTime lastlogindate = reader.IsDBNull(9) ? DateTime.Now : reader.GetDateTime(9);
                        DateTime creationdate = reader.IsDBNull(10) ? DateTime.Now : reader.GetDateTime(10);
                        bool isonline = reader.IsDBNull(11) ? false : reader.GetBoolean(11);
                        bool islockedout = reader.IsDBNull(12) ? false : reader.GetBoolean(12);
                        DateTime lastlockedoutdate = reader.IsDBNull(13) ? DateTime.Now : reader.GetDateTime(13);
                        int failedpasswordattemptcount = reader.IsDBNull(14) ? 0 : reader.GetInt32(14);
                        DateTime failedpasswordattemptwindowstart = reader.IsDBNull(15)
                                                                        ? DateTime.Now
                                                                        : reader.GetDateTime(15);
                        int failedpasswordanswerattemptcount = reader.IsDBNull(16) ? 0 : reader.GetInt32(16);
                        DateTime failedpasswordanswerattemptwindowstart = reader.IsDBNull(17)
                                                                              ? DateTime.Now
                                                                              : reader.GetDateTime(17);
                        DateTime lastpasswordchangeddate = reader.IsDBNull(18) ? DateTime.Now : reader.GetDateTime(18);
                        string userwebsite = reader.IsDBNull(19) ? "" : reader.GetString(19);
                        string userlocation = reader.IsDBNull(20) ? "" : reader.GetString(20);
                        SqlBytes userimage = reader.IsDBNull(21) ? new SqlBytes() : reader.GetSqlBytes(21);
                        string userfirstname = reader.IsDBNull(22) ? "" : reader.GetString(22);
                        string userlastname = reader.IsDBNull(23) ? "" : reader.GetString(23);
                        string userzipcode = reader.IsDBNull(24) ? "" : reader.GetString(24);
                        string userbio = reader.IsDBNull(25) ? "" : reader.GetString(25);
                        bool usershareinfo = reader.IsDBNull(26) ? false : reader.GetBoolean(26);
                        Guid referralguid = reader.IsDBNull(27) ? Guid.NewGuid() : reader.GetGuid(27);
                        DateTime confirmeddate = reader.IsDBNull(28) ? DateTime.Now : reader.GetDateTime(28);
                        int vistaslotsid = reader.IsDBNull(29) ? 0 : reader.GetInt32(29);
                        string fullnameusernamezipcode = reader.IsDBNull(30) ? "" : reader.GetString(30);
                        bool vistaonly = reader.IsDBNull(31) ? false : reader.GetBoolean(31);
                        bool saturdayclasses = reader.IsDBNull(32) ? false : reader.GetBoolean(32);
                        bool sundayclasses = reader.IsDBNull(33) ? false : reader.GetBoolean(33);
                        string desktoporlaptopforvista = reader.IsDBNull(34) ? "" : reader.GetString(34);
                        bool saturdaydinner = reader.IsDBNull(35) ? false : reader.GetBoolean(35);
                        Guid pkid = reader.IsDBNull(36) ? Guid.NewGuid() : reader.GetGuid(36);
                        var td = new DataObjectAttendees(username, applicationname, email, comment, password,
                                                         passwordquestion, passwordanswer, isapproved, lastactivitydate,
                                                         lastlogindate, creationdate, isonline, islockedout,
                                                         lastlockedoutdate, failedpasswordattemptcount,
                                                         failedpasswordattemptwindowstart,
                                                         failedpasswordanswerattemptcount,
                                                         failedpasswordanswerattemptwindowstart, lastpasswordchangeddate,
                                                         userwebsite, userlocation, userimage, userfirstname,
                                                         userlastname, userzipcode, userbio, usershareinfo, referralguid,
                                                         confirmeddate, vistaslotsid, fullnameusernamezipcode, vistaonly,
                                                         saturdaydinner, saturdayclasses, sundayclasses,
                                                         desktoporlaptopforvista, pkid);
                        DataTemplateODSList.Add(td);
                    }
                }
                finally
                {
                    if (reader != null) reader.Close();
                }
                conn.Close();
                conn.Dispose();

                if (cacheResultSet)
                {
                    HttpContext.Current.Cache.Insert(cacheName, DataTemplateODSList,
                                                     null, DateTime.Now.Add(new TimeSpan(0, 0, Utils.RetrieveSecondsForSessionCacheTimeout())), TimeSpan.Zero);
                }
            }
            else
            {
                DataTemplateODSList = (List<DataObjectAttendees>) HttpContext.Current.Cache[cacheName];
            }

            return DataTemplateODSList;
        }
Esempio n. 3
0
        public List<DataObjectAttendees> GetBySessionId(int sessionId)
        {
            bool cacheResultSet = true;

            List<DataObjectAttendees> DataTemplateODSList;
            string cacheName = string.Format("{0}-{1}", Utils.CacheAttendeeBySessionId, sessionId);

            if (!cacheResultSet)
            {
                HttpContext.Current.Cache.Remove(cacheName);
            }

            if (HttpContext.Current.Cache[cacheName] == null)
            {
                using (var conn = new SqlConnection(connectionString))
                {
                    conn.Open();

                    var attendeeIdsInOrder = new List<int>();
                    // Get list of attendees by session in correct order
                    const string sqlSel =
                        @"SELECT AttendeeId FROM SessionPresenter WHERE SessionID = @SessionId ORDER BY Id";
                    using (var sqlCommandA = new SqlCommand(sqlSel, conn))
                    {
                        sqlCommandA.Parameters.Add("@SessionId", SqlDbType.Int).Value = sessionId;

                        using (var readerA = sqlCommandA.ExecuteReader())
                        {

                            try
                            {
                                while (readerA != null && readerA.Read())
                                {
                                    attendeeIdsInOrder.Add(readerA.GetInt32(0));
                                }
                            }
                            catch (Exception ee1)
                            {
                                throw new ApplicationException(ee1.ToString());
                            }
                        }
                    }

                    const string sqlSelectString =
                      @"SELECT Username,
                       ApplicationName,
                       Email,
                       Comment,
                       Password,
                       PasswordQuestion,
                       PasswordAnswer,
                       IsApproved,
                       LastActivityDate,
                       LastLoginDate,
                       CreationDate,
                       IsOnLine,
                       IsLockedOut,
                       LastLockedOutDate,
                       FailedPasswordAttemptCount,
                       FailedPasswordAttemptWindowStart,
                       FailedPasswordAnswerAttemptCount,
                       FailedPasswordAnswerAttemptWindowStart,
                       LastPasswordChangedDate,
                       UserWebsite,
                       UserLocation,
                       UserImage,
                       UserFirstName,
                       UserLastName,
                       UserZipCode,
                       UserBio,
                       UserShareInfo,
                       ReferralGUID,
                       ConfirmedDate,
                       VistaSlotsId,
                       FullNameUsernameZipcode,
                       VistaOnly,
                       SaturdayClasses,
                       SundayClasses,
                       DesktopOrLaptopForVista,
                       SaturdayDinner,
                       PKID
                       FROM [dbo].[Attendees]
                       WHERE Id = @Id";

                    DataTemplateODSList = new List<DataObjectAttendees>();
                    foreach (int attendIdForProcessing in attendeeIdsInOrder)
                    {
                        var cmd = new SqlCommand(sqlSelectString, conn);
                        cmd.Parameters.Add("@Id", SqlDbType.Int).Value = attendIdForProcessing;
                        var reader = cmd.ExecuteReader();
                        try
                        {
                            while (reader.Read())
                            {
                                string username = reader.IsDBNull(0) ? "" : reader.GetString(0);
                                string applicationname = reader.IsDBNull(1) ? "" : reader.GetString(1);
                                string email = reader.IsDBNull(2) ? "" : reader.GetString(2);
                                string comment = reader.IsDBNull(3) ? "" : reader.GetString(3);
                                string password = reader.IsDBNull(4) ? "" : reader.GetString(4);
                                string passwordquestion = reader.IsDBNull(5) ? "" : reader.GetString(5);
                                string passwordanswer = reader.IsDBNull(6) ? "" : reader.GetString(6);
                                bool isapproved = reader.IsDBNull(7) ? false : reader.GetBoolean(7);
                                DateTime lastactivitydate = reader.IsDBNull(8) ? DateTime.Now : reader.GetDateTime(8);
                                DateTime lastlogindate = reader.IsDBNull(9) ? DateTime.Now : reader.GetDateTime(9);
                                DateTime creationdate = reader.IsDBNull(10) ? DateTime.Now : reader.GetDateTime(10);
                                bool isonline = reader.IsDBNull(11) ? false : reader.GetBoolean(11);
                                bool islockedout = reader.IsDBNull(12) ? false : reader.GetBoolean(12);
                                DateTime lastlockedoutdate = reader.IsDBNull(13) ? DateTime.Now : reader.GetDateTime(13);
                                int failedpasswordattemptcount = reader.IsDBNull(14) ? 0 : reader.GetInt32(14);
                                DateTime failedpasswordattemptwindowstart = reader.IsDBNull(15)
                                                                                ? DateTime.Now
                                                                                : reader.GetDateTime(15);
                                int failedpasswordanswerattemptcount = reader.IsDBNull(16) ? 0 : reader.GetInt32(16);
                                DateTime failedpasswordanswerattemptwindowstart = reader.IsDBNull(17)
                                                                                      ? DateTime.Now
                                                                                      : reader.GetDateTime(17);
                                DateTime lastpasswordchangeddate = reader.IsDBNull(18)
                                                                       ? DateTime.Now
                                                                       : reader.GetDateTime(18);
                                string userwebsite = reader.IsDBNull(19) ? "" : reader.GetString(19);
                                string userlocation = reader.IsDBNull(20) ? "" : reader.GetString(20);
                                SqlBytes userimage = reader.IsDBNull(21) ? new SqlBytes() : reader.GetSqlBytes(21);
                                string userfirstname = reader.IsDBNull(22) ? "" : reader.GetString(22);
                                string userlastname = reader.IsDBNull(23) ? "" : reader.GetString(23);
                                string userzipcode = reader.IsDBNull(24) ? "" : reader.GetString(24);
                                string userbio = reader.IsDBNull(25) ? "" : reader.GetString(25);
                                bool usershareinfo = reader.IsDBNull(26) ? false : reader.GetBoolean(26);
                                Guid referralguid = reader.IsDBNull(27) ? Guid.NewGuid() : reader.GetGuid(27);
                                DateTime confirmeddate = reader.IsDBNull(28) ? DateTime.Now : reader.GetDateTime(28);
                                int vistaslotsid = reader.IsDBNull(29) ? 0 : reader.GetInt32(29);
                                string fullnameusernamezipcode = reader.IsDBNull(30) ? "" : reader.GetString(30);
                                bool vistaonly = reader.IsDBNull(31) ? false : reader.GetBoolean(31);
                                bool saturdayclasses = reader.IsDBNull(32) ? false : reader.GetBoolean(32);
                                bool sundayclasses = reader.IsDBNull(33) ? false : reader.GetBoolean(33);
                                string desktoporlaptopforvista = reader.IsDBNull(34) ? "" : reader.GetString(34);
                                bool saturdaydinner = reader.IsDBNull(35) ? false : reader.GetBoolean(35);
                                Guid pkid = reader.IsDBNull(36) ? Guid.NewGuid() : reader.GetGuid(36);
                                var td = new DataObjectAttendees(username, applicationname, email, comment, password,
                                                                 passwordquestion, passwordanswer, isapproved,
                                                                 lastactivitydate,
                                                                 lastlogindate, creationdate, isonline, islockedout,
                                                                 lastlockedoutdate, failedpasswordattemptcount,
                                                                 failedpasswordattemptwindowstart,
                                                                 failedpasswordanswerattemptcount,
                                                                 failedpasswordanswerattemptwindowstart,
                                                                 lastpasswordchangeddate,
                                                                 userwebsite, userlocation, userimage, userfirstname,
                                                                 userlastname, userzipcode, userbio, usershareinfo,
                                                                 referralguid,
                                                                 confirmeddate, vistaslotsid, fullnameusernamezipcode,
                                                                 vistaonly,
                                                                 saturdaydinner, saturdayclasses, sundayclasses,
                                                                 desktoporlaptopforvista, pkid);
                                DataTemplateODSList.Add(td);
                            }
                        }
                        finally
                        {
                            if (reader != null) reader.Close();
                        }
                    }
                }
                if (cacheResultSet)
                {
                    HttpContext.Current.Cache.Insert(cacheName, DataTemplateODSList,
                                                     null, DateTime.Now.Add(new TimeSpan(0, 0, Utils.RetrieveSecondsForSessionCacheTimeout())), TimeSpan.Zero);
                }
            }
            else
            {
                DataTemplateODSList = (List<DataObjectAttendees>) HttpContext.Current.Cache[cacheName];
            }
            return DataTemplateODSList;
        }