/// <summary>
        /// Save all costs to database (direct)
        /// </summary>
        /// <param name="companyId">companyId</param>
        public void Save(int companyId)
        {
            ServiceInformationTDS serviceInformationChanges = (ServiceInformationTDS)Data.GetChanges();

            if (serviceInformationChanges.CostInformation.Rows.Count > 0)
            {
                ServiceInformationServiceCostGateway serviceInformationServiceCostGateway = new ServiceInformationServiceCostGateway(serviceInformationChanges);

                foreach (ServiceInformationTDS.CostInformationRow row in (ServiceInformationTDS.CostInformationDataTable)serviceInformationChanges.CostInformation)
                {
                    // Insert new costs
                    if ((!row.Deleted) && (!row.InServiceCostDatabase))
                    {
                        // new values
                        int serviceId = row.ServiceID;
                        int refId = row.RefID;

                        string newPartNumber = serviceInformationServiceCostGateway.GetPartNumber(serviceId, refId);
                        string newPartName = serviceInformationServiceCostGateway.GetPartName(serviceId, refId);
                        string newVendor = serviceInformationServiceCostGateway.GetVendor(serviceId, refId);
                        decimal newCost = serviceInformationServiceCostGateway.GetCost(serviceId, refId);
                        int? noteId = serviceInformationServiceCostGateway.GetNoteID(serviceId, refId);

                        ServicesCost servicesCost = new ServicesCost(null);
                        servicesCost.InsertDirect(serviceId, refId, newPartNumber, newPartName, newVendor, newCost, row.Deleted, row.COMPANY_ID, noteId);
                    }

                    // Update costs
                    if ((!row.Deleted) && (row.InServiceCostDatabase))
                    {
                        int serviceId = row.ServiceID;
                        int refId = row.RefID;
                        bool originalDeleted = false;
                        int originalCompanyId = companyId;

                        // original values
                        string originalPartNumber = serviceInformationServiceCostGateway.GetPartNumberOriginal(serviceId, refId);
                        string originalPartName = serviceInformationServiceCostGateway.GetPartNameOriginal(serviceId, refId);
                        string originalVendor = serviceInformationServiceCostGateway.GetVendorOriginal(serviceId, refId);
                        decimal originalCost = serviceInformationServiceCostGateway.GetCostOriginal(serviceId, refId);
                        int? originalNoteId = serviceInformationServiceCostGateway.GetNoteIDOriginal(serviceId, refId);

                        // new values
                        string newPartNumber = serviceInformationServiceCostGateway.GetPartNumber(serviceId, refId);
                        string newPartName = serviceInformationServiceCostGateway.GetPartName(serviceId, refId);
                        string newVendor = serviceInformationServiceCostGateway.GetVendor(serviceId, refId);
                        decimal newCost = serviceInformationServiceCostGateway.GetCost(serviceId, refId);
                        int? newNoteId = serviceInformationServiceCostGateway.GetNoteID(serviceId, refId);

                        ServicesCost servicesCost = new ServicesCost(null);
                        servicesCost.UpdateDirect(serviceId, refId, originalPartNumber, originalPartName, originalVendor, originalCost, originalDeleted, originalCompanyId, originalNoteId, serviceId, refId, newPartNumber, newPartName, newVendor, newCost, originalDeleted, originalCompanyId, newNoteId);
                    }

                    // Deleted costs
                    if ((row.Deleted)  && (row.InServiceCostDatabase))
                    {
                        ServicesCost servicesCost = new ServicesCost(null);
                        servicesCost.DeleteDirect(row.ServiceID, row.RefID, row.COMPANY_ID);
                    }
                }
            }
        }
 // ////////////////////////////////////////////////////////////////////////
 // PUBLIC METHODS
 //
 /// <summary>
 /// LoadByServiceId
 /// </summary>
 /// <param name="serviceId">serviceId</param>              
 /// <param name="companyId">companyId</param>
 public void LoadByServiceId(int serviceId, int companyId)
 {
     ServiceInformationServiceCostGateway serviceInformationServiceCostGateway = new ServiceInformationServiceCostGateway(Data);
     serviceInformationServiceCostGateway.LoadAllByServiceId(serviceId, companyId);
 }