Example #1
0
        public Project BuildEntity(IDataReader reader)
        {
            Project project = new Project(reader[FieldNames.ProjectId],
                                          reader[FieldNames.ProjectNumber].ToString(),
                                          reader[FieldNames.ProjectName].ToString());

            project.Address                    = AddressFactory.BuildAddress(reader);
            project.ContractDate               = DataHelper.GetNullableDateTime(reader[FieldNames.ContractDate]);
            project.EstimatedStartDate         = DataHelper.GetNullableDateTime(reader[FieldNames.EstimatedStartDate]);
            project.EstimatedCompletionDate    = DataHelper.GetNullableDateTime(reader[FieldNames.EstimatedCompletionDate]);
            project.CurrentCompletionDate      = DataHelper.GetNullableDateTime(reader[FieldNames.CurrentCompletionDate]);
            project.ActualCompletionDate       = DataHelper.GetNullableDateTime(reader[FieldNames.ActualCompletionDate]);
            project.ContingencyAllowanceAmount = DataHelper.GetDecimal(reader[FieldNames.ContingencyAllowanceAmount]);
            project.TestingAllowanceAmount     = DataHelper.GetDecimal(reader[FieldNames.TestingAllowanceAmount]);
            project.UtilityAllowanceAmount     = DataHelper.GetDecimal(reader[FieldNames.UtilityAllowanceAmount]);
            project.OriginalConstructionCost   = DataHelper.GetDecimal(reader[FieldNames.OriginalConstructionCost]);
            project.TotalSquareFeet            = DataHelper.GetInteger(reader[FieldNames.TotalSquareFeet]);
            project.PercentComplete            = DataHelper.GetInteger(reader[FieldNames.PercentComplete]);
            project.Remarks                    = reader[FieldNames.Remarks].ToString();
            project.AeChangeOrderAmount        = DataHelper.GetDecimal(reader[FieldNames.AeChangeOrderAmount]);
            project.ContractReason             = reader[FieldNames.ContractReason].ToString();
            project.AgencyApplicationNumber    = reader[FieldNames.AgencyApplicationNumber].ToString();
            project.AgencyFileNumber           = reader[FieldNames.AgencyFileNumber].ToString();
            project.Segment                    = new MarketSegment(reader[FieldNames.MarketSegmentId],
                                                                   null,
                                                                   reader[FieldNames.MarketSegmentCode].ToString(),
                                                                   reader[FieldNames.MarketSegmentName].ToString());
            return(project);
        }
        public Project BuildEntity(IDataReader reader)
        {
            Project project = new Project(
                reader[FieldNames.ProjectId]
                , reader[FieldNames.ProjectNumber].ToString()
                , reader[FieldNames.ProjectName].ToString());

            project.Address = AddressFactory.BuildAddress(reader);

            return(project);
        }
        private void AppendAddresses(Contact contact)
        {
            string sql =
                string.Format("SELECT * FROM ContactAddress WHERE ContactID = '{0}'", contact.Key);

            using (IDataReader reader = this.ExecuteReader(sql))
            {
                while (reader.Read())
                {
                    contact.Addresses.Add(AddressFactory.BuildAddress(reader));
                }
            }
        }
        private void AppendAddresses(Company company)
        {
            string sql = string.Format("SELECT * FROM CompanyAddress WHERE CompanyID = '{0}'", company.Key);

            using (IDataReader reader = this.ExecuteReader(sql))
            {
                Address address = null;
                while (reader.Read())
                {
                    address = AddressFactory.BuildAddress(reader);
                    company.Addresses.Add(address);
                    if (CompanyFactory.IsHeadquartersAddress(reader))
                    {
                        company.HeadquartersAddress = address;
                    }
                }
            }
        }