internal static bool IsHeadquartersAddress(IDataReader reader)
 {
     return(DataHelper.GetBoolean(reader[FieldNames.IsHeadquarters]));
 }
        protected override void PersistUpdateItem(Company item)
        {
            StringBuilder builder = new StringBuilder(100);

            builder.Append("UPDATE Company SET ");
            builder.Append(string.Format("{0} = '{1}'", CompanyFactory.FieldNames.Name, DataHelper.GetSqlValue(item.Name)));
            builder.Append(string.Format(", {0} = '{1}'", CompanyFactory.FieldNames.ShortName, DataHelper.GetSqlValue(item.Abbreviation)));
            builder.Append(string.Format(", {0} = '{1}'", CompanyFactory.FieldNames.Phone, DataHelper.GetSqlValue(item.PhoneNumber)));
            builder.Append(string.Format(", {0} = '{1}'", CompanyFactory.FieldNames.Fax, DataHelper.GetSqlValue(item.FaxNumber)));
            builder.Append(string.Format(", {0} = '{1}'", CompanyFactory.FieldNames.Url, DataHelper.GetSqlValue(item.Url)));
            builder.Append(string.Format(", {0} = '{1}'", CompanyFactory.FieldNames.Remarks, DataHelper.GetSqlValue(item.Remarks)));
            builder.Append(" ");
            builder.Append(this.BuildBaseWhereClause(item.Key));
            this.Database.ExecuteNonQuery(this.Database.GetSqlStringCommand(builder.ToString()));

            this.DeleteAddresses(item);
            this.InsertAddresses(item);
        }
        protected override void PersistUpdatedItem(ProposalRequest item)
        {
            StringBuilder builder = new StringBuilder(100);

            builder.Append("UPDATE ProposalRequest SET ");

            builder.Append(string.Format("{0} = {1}",
                                         ProposalRequestFactory.FieldNames.ProposalRequestNumber,
                                         DataHelper.GetSqlValue(item.Number)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.TransmittalDate,
                                         DataHelper.GetSqlValue(item.TransmittalDate)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProjectFactory.FieldNames.ProjectContactId,
                                         DataHelper.GetSqlValue(item.To.Key)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.EmployeeId,
                                         DataHelper.GetSqlValue(item.From.Key)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.TotalPages,
                                         DataHelper.GetSqlValue(item.TotalPages)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.DeliveryMethod,
                                         DataHelper.GetSqlValue(item.DeliveryMethod)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.OtherDeliveryMethod,
                                         DataHelper.GetSqlValue(item.OtherDeliveryMethod)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.PhaseNumber,
                                         DataHelper.GetSqlValue(item.PhaseNumber)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.Reimbursable,
                                         DataHelper.GetSqlValue(item.Reimbursable)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.Final,
                                         DataHelper.GetSqlValue(item.Final)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.IssueDate,
                                         DataHelper.GetSqlValue(item.IssueDate)));

            builder.Append(string.Format(",{0} = {1}",
                                         CompanyFactory.FieldNames.CompanyId,
                                         DataHelper.GetSqlValue(item.Contractor.Key)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.Description,
                                         DataHelper.GetSqlValue(item.Description)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.Attachment,
                                         DataHelper.GetSqlValue(item.Attachment)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.Reason,
                                         DataHelper.GetSqlValue(item.Reason)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.Initiator,
                                         DataHelper.GetSqlValue(item.Initiator)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.Cause,
                                         DataHelper.GetSqlValue(item.Cause)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.Origin,
                                         DataHelper.GetSqlValue(item.Origin)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.Remarks,
                                         DataHelper.GetSqlValue(item.Remarks)));

            builder.Append(string.Format(",{0} = {1}",
                                         ProposalRequestFactory.FieldNames.TransmittalRemarks,
                                         DataHelper.GetSqlValue(item.TransmittalRemarks)));

            builder.Append(" ");
            builder.Append(this.BuildBaseWhereClause(item.Key));

            this.Database.ExecuteNonQuery(
                this.Database.GetSqlStringCommand(builder.ToString()));

            // Now do the child objects

            // First, delete the existing ones
            this.DeleteCopyToList(item);

            // Now, add the current ones
            this.InsertCopyToList(item);
        }