Example #1
0
        private static List <EmailInfo> FillEmailCollection(IDataReader reader, out int totalRecords)
        {
            List <EmailInfo> retVal;

            totalRecords = 0;
            try
            {
                retVal = ObjectHelper.FillCollection <EmailInfo>(reader, false);

                //Get the next result (containing the total)
                reader.NextResult();

                //Get the total no of records from the second result
                if (reader.Read())
                {
                    totalRecords = Convert.ToInt32(reader[0]);
                }
            }
            finally
            {
                //close datareader
                ObjectHelper.CloseDataReader(reader, true);
            }
            return(retVal);
        }
Example #2
0
        public static List <LevelInfo> Search(string keyword, int pageIndex, int pageSize, out int totalRecord)
        {
            var reader = DataProvider.Instance().Levels_Search(keyword, pageIndex, pageSize);
            var val    = ObjectHelper.FillCollection <LevelInfo>(reader, false);

            totalRecord = 0;
            try
            {
                reader.NextResult();

                //Get the total no of records from the second result
                if (reader.Read())
                {
                    totalRecord = Convert.ToInt32(reader[0]);
                }
            }
            catch (Exception)
            {
                //DotNetNuke.Services.Exceptions.Exceptions.LogException(exc);
            }
            finally
            {
                //close datareader
                ObjectHelper.CloseDataReader(reader, true);
            }
            return(val);
        }
Example #3
0
        private static List <GroupInfo> FillGroupCollection(IDataReader reader, out int totalRecords)
        {
            var retVal = ObjectHelper.FillCollection <GroupInfo>(reader, false);

            totalRecords = 0;
            try
            {
                //Get the next result (containing the total)
                reader.NextResult();

                //Get the total no of records from the second result
                if (reader.Read())
                {
                    totalRecords = Convert.ToInt32(reader[0]);
                }
            }
            catch
            {
                //DotNetNuke.Services.Exceptions.Exceptions.LogException(exc);
            }
            finally
            {
                //close datareader
                ObjectHelper.CloseDataReader(reader, true);
            }
            return(retVal);
        }
Example #4
0
        private static List <BranchInfo> FillBranchCollection(IDataReader reader, out int totalRecords)
        {
            var retVal = new List <BranchInfo>();

            totalRecords = 0;
            try
            {
                while (reader.Read())
                {
                    //fill business object
                    var info = new BranchInfo();

                    info.BranchId = ConvertHelper.ToInt32(reader["BranchId"]);

                    info.Code = ConvertHelper.ToString(reader["Code"]);

                    info.Name = ConvertHelper.ToString(reader["Name"]);

                    info.LocationID = ConvertHelper.ToInt32(reader["LocationID"]);

                    info.Description = ConvertHelper.ToString(reader["Description"]);

                    info.Status = ConvertHelper.ToInt32(reader["Status"]);

                    info.CreatedBy = ConvertHelper.ToInt32(reader["CreatedBy"]);

                    info.ChangedBy = ConvertHelper.ToInt32(reader["ChangedBy"]);

                    info.CreatedDate = ConvertHelper.ToDateTime(reader["CreatedDate"]);

                    info.ChangedDate = ConvertHelper.ToDateTime(reader["ChangedDate"]);

                    retVal.Add(info);
                }
                //Get the next result (containing the total)
                reader.NextResult();

                //Get the total no of records from the second result
                if (reader.Read())
                {
                    totalRecords = Convert.ToInt32(reader[0]);
                }
            }
            catch (Exception exc)
            {
                //DotNetNuke.Services.Exceptions.Exceptions.LogException(exc);
            }
            finally
            {
                //close datareader
                ObjectHelper.CloseDataReader(reader, true);
            }
            return(retVal);
        }
Example #5
0
        private static List <ImportExcelInfo> FillImportExcelCollection(IDataReader reader, out int totalRecords)
        {
            var retVal = new List <ImportExcelInfo>();

            totalRecords = 0;
            try
            {
                while (reader.Read())
                {
                    //fill business object
                    var info = new ImportExcelInfo();

                    info.ImportId       = ConvertHelper.ToInt32(reader["ImportId"]);
                    info.UserId         = ConvertHelper.ToInt32(reader["UserId"]);
                    info.TypeId         = ConvertHelper.ToInt32(reader["TypeId"]);
                    info.ChannelId      = ConvertHelper.ToInt32(reader["ChannelId"]);
                    info.CollectorId    = ConvertHelper.ToInt32(reader["CollectorId"]);
                    info.BranchId       = ConvertHelper.ToInt32(reader["BranchId"]);
                    info.Status         = ConvertHelper.ToInt32(reader["Status"]);
                    info.FilePath       = ConvertHelper.ToString(reader["FilePath"]);
                    info.TotalRow       = ConvertHelper.ToInt32(reader["TotalRow"]);
                    info.CheckCount     = ConvertHelper.ToInt32(reader["CheckCount"]);
                    info.ErrorCount     = ConvertHelper.ToInt32(reader["ErrorCount"]);
                    info.DuplicateCount = ConvertHelper.ToInt32(reader["DuplicateCount"]);
                    retVal.Add(info);
                }
                //Get the next result (containing the total)
                reader.NextResult();

                //Get the total no of records from the second result
                if (reader.Read())
                {
                    totalRecords = Convert.ToInt32(reader[0]);
                }
            }
            catch (Exception exc)
            {
                //DotNetNuke.Services.Exceptions.Exceptions.LogException(exc);
            }
            finally
            {
                //close datareader
                ObjectHelper.CloseDataReader(reader, true);
            }
            return(retVal);
        }
Example #6
0
        private static List <ContactLevelInfo> FillContactLevelInfoCollection(IDataReader reader, out int totalRecords)
        {
            var retVal = new List <ContactLevelInfo>();

            totalRecords = 0;
            try
            {
                while (reader.Read())
                {
                    //fill business object
                    var info = new ContactLevelInfo
                    {
                        ContactId           = ConvertHelper.ToInt32(reader["ContactId"]),
                        EducationSchoolName = ConvertHelper.ToString(reader["EducationLevelNotes"]),
                        WantStudyEnglish    = ConvertHelper.ToBoolean(reader["WantStudy"]),
                        HasAppointment      = ConvertHelper.ToBoolean(reader["Appointment"]),
                        ApointmentType      = ConvertHelper.ToInt32(reader["ApointmentType"]),
                        ApointmentNotes     = ConvertHelper.ToString(reader["ApointmentNotes"]),
                    };
                    retVal.Add(info);
                }
                //Get the next result (containing the total)
                reader.NextResult();

                //Get the total no of records from the second result
                if (reader.Read())
                {
                    totalRecords = Convert.ToInt32(reader[0]);
                }
            }
            catch
            {
                //DotNetNuke.Services.Exceptions.Exceptions.LogException(exc);
            }
            finally
            {
                //close datareader
                ObjectHelper.CloseDataReader(reader, true);
            }
            return(retVal);
        }
Example #7
0
        private static List <T> FillCollection <T>(IDataReader reader, out int totalRecords)
        {
            List <T> retVal;

            totalRecords = 0;
            try
            {
                retVal = ObjectHelper.FillCollection <T>(reader, false);

                reader.NextResult();
                if (reader.Read())
                {
                    totalRecords = reader[0].ToInt32();
                }
            }
            finally
            {
                ObjectHelper.CloseDataReader(reader, true);
            }
            return(retVal);
        }
Example #8
0
        public static List <RoleInfo> Search(string keyword, int pageIndex, int pageSize, out int totalRecord)
        {
            var reader = DataProvider.Instance().Role_Search(keyword, pageIndex, pageSize);
            var lst    = ObjectHelper.FillCollection <RoleInfo>(reader, false);

            totalRecord = 0;
            try
            {
                reader.NextResult();
                //Get the total no of records from the second result
                if (reader.Read())
                {
                    totalRecord = Convert.ToInt32(reader[0]);
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                ObjectHelper.CloseDataReader(reader, true);
            }
            return(lst);
        }
Example #9
0
        public static IEnumerable <UserInfo> Search(string username, int pageIndex, int pageSize, out int totalrecord)
        {
            var reader = DataProvider.Instance().User_Search(username, pageIndex, pageSize);
            var lst    = ObjectHelper.FillCollection <UserInfo>(reader, false);

            totalrecord = 0;
            try
            {
                reader.NextResult();
                //Get the total no of records from the second result
                if (reader.Read())
                {
                    totalrecord = Convert.ToInt32(reader[0]);
                }
            }
            catch
            {
            }
            finally
            {
                ObjectHelper.CloseDataReader(reader, true);
            }
            return(lst);
        }
Example #10
0
        private static List <PhoneInfo> FillPhonCollection(IDataReader reader, out int totalRecords)
        {
            var retVal = new List <PhoneInfo>();

            totalRecords = 0;
            try
            {
                while (reader.Read())
                {
                    //fill business object
                    var info = new PhoneInfo();

                    /*
                     *
                     *
                     * info.PhoneId = ConvertHelper.ToInt32(reader["PhoneId"]);
                     *
                     *
                     *
                     *
                     * info.ContactId = ConvertHelper.ToInt32(reader["ContactId"]);
                     *
                     *
                     *
                     * info.PhoneType = ConvertHelper.ToString(reader["PhoneType"]);
                     *
                     *
                     *
                     *
                     * info.PhoneNumber = ConvertHelper.ToString(reader["PhoneNumber"]);
                     *
                     *
                     *
                     *
                     *
                     * info.IsPrimary = ConvertHelper.ToInt32(reader["IsPrimary"]);
                     *
                     *
                     *
                     */
                    retVal.Add(info);
                }
                //Get the next result (containing the total)
                reader.NextResult();

                //Get the total no of records from the second result
                if (reader.Read())
                {
                    totalRecords = Convert.ToInt32(reader[0]);
                }
            }
            catch (Exception exc)
            {
                //DotNetNuke.Services.Exceptions.Exceptions.LogException(exc);
            }
            finally
            {
                //close datareader
                ObjectHelper.CloseDataReader(reader, true);
            }
            return(retVal);
        }
        private static List <AppointmentInterviewInfo> FillAppointmentInterviewCollection(IDataReader reader, out int totalRecords)
        {
            var retVal = new List <AppointmentInterviewInfo>();

            totalRecords = 0;
            try
            {
                while (reader.Read())
                {
                    //fill business object
                    var info = new AppointmentInterviewInfo();

                    /*
                     *
                     *
                     * info.ContactId = ConvertHelper.ToInt32(reader["ContactId"]);
                     *
                     *
                     *
                     *
                     * info.UserId = ConvertHelper.ToInt32(reader["UserId"]);
                     *
                     *
                     *
                     *
                     *
                     *
                     *
                     *
                     *
                     * info.TimeSlotId = ConvertHelper.ToInt32(reader["TimeSlotId"]);
                     *
                     *
                     *
                     * info.Notes = ConvertHelper.ToString(reader["Notes"]);
                     *
                     *
                     *
                     *
                     *
                     * info.StatusInterviewId = ConvertHelper.ToInt32(reader["StatusInterviewId"]);
                     *
                     *
                     *
                     *
                     * info.TeacherTypeId = ConvertHelper.ToInt32(reader["TeacherTypeId"]);
                     *
                     *
                     *
                     *
                     * info.CasecAccountId = ConvertHelper.ToInt32(reader["CasecAccountId"]);
                     *
                     *
                     *
                     */
                    retVal.Add(info);
                }
                //Get the next result (containing the total)
                reader.NextResult();

                //Get the total no of records from the second result
                if (reader.Read())
                {
                    totalRecords = Convert.ToInt32(reader[0]);
                }
            }
            finally
            {
                //close datareader
                ObjectHelper.CloseDataReader(reader, true);
            }
            return(retVal);
        }