// ////////////////////////////////////////////////////////////////////////
 // PRIVATE METHODS
 //
 /// <summary>
 /// UpdateCostingSheet
 /// </summary>
 /// <param name="costingSheetId">costingSheetId</param>
 /// <param name="originalProjectId">originalProjectId</param>
 /// <param name="originalName">originalName</param>
 /// <param name="originalStartDate">originalStartDate</param>
 /// <param name="originalEndDate">originalEndDate</param>
 /// <param name="originalTotalLabourHoursCad">originalTotalLabourHoursCad</param>
 /// <param name="originalTotalLabourHoursUsd">originalTotalLabourHoursUsd</param>
 /// <param name="originalTotalMaterialsCad">originalTotalMaterialsCad</param>
 /// <param name="originalTotalMaterialsUsd">originalTotalMaterialsUsd</param>
 /// <param name="originalTotalUnitsCad">originalTotalUnitsCad</param>
 /// <param name="originalTotalUnitsUsd">originalTotalUnitsUsd</param>
 /// <param name="originalTotalOtherCostsCad">originalTotalOtherCostsCad</param>
 /// <param name="originalTotalOtherCostsUsd">originalTotalOtherCostsUsd</param>
 /// <param name="originalGrandTotalCad">originalGrandTotalCad</param>
 /// <param name="originalGrandTotalUsd">originalGrandTotalUsd</param>
 /// <param name="originalState">originalState</param>
 /// <param name="originalDeleted">originalDeleted</param>
 /// <param name="originalCompanyId">originalCompanyId</param>
 /// 
 /// <param name="newProjectId">newProjectId</param>
 /// <param name="newName">newName</param>
 /// <param name="newStartDate">newStartDate</param>
 /// <param name="newEndDate">newEndDate</param>
 /// <param name="newTotalLabourHoursCad">newTotalLabourHoursCad</param>
 /// <param name="newTotalLabourHoursUsd">newTotalLabourHoursUsd</param>
 /// <param name="newTotalMaterialsCad">newTotalMaterialsCad</param>
 /// <param name="newTotalMaterialsUsd">newTotalMaterialsUsd</param>
 /// <param name="newTotalUnitsCad">newTotalUnitsCad</param>
 /// <param name="newTotalUnitsUsd">newTotalUnitsUsd</param>
 /// <param name="newTotalOtherCostsCad">newTotalOtherCostsCad</param>
 /// <param name="newTotalOtherCostsUsd">newTotalOtherCostsUsd</param>
 /// <param name="newGrandTotalCad">newGrandTotalCad</param>
 /// <param name="newGrandTotalUsd">newGrandTotalUsd</param>
 /// <param name="newState">newState</param>
 /// <param name="newDeleted">newDeleted</param>
 /// <param name="newCompanyId">newCompanyId</param>
 private void UpdateCostingSheet(int costingSheetId, int originalProjectId, string originalName, DateTime originalStartDate, DateTime originalEndDate, decimal originalTotalLabourHoursCad, decimal originalTotalLabourHoursUsd, decimal originalTotalMaterialsCad, decimal originalTotalMaterialsUsd, decimal originalTotalUnitsCad, decimal originalTotalUnitsUsd, decimal originalTotalOtherCostsCad, decimal originalTotalOtherCostsUsd, decimal originalGrandTotalCad, decimal originalGrandTotalUsd, string originalState, bool originalDeleted, int originalCompanyId, decimal originalTotalSubcontractorsCad, decimal originalTotalSubcontractorsUsd, decimal originalGrandRevenue, decimal originalGrandProfit, decimal originalGrandGrossMargin, int newProjectId, string newName, DateTime newStartDate, DateTime newEndDate, decimal newTotalLabourHoursCad, decimal newTotalLabourHoursUsd, decimal newTotalMaterialsCad, decimal newTotalMaterialsUsd, decimal newTotalUnitsCad, decimal newTotalUnitsUsd, decimal newTotalOtherCostsCad, decimal newTotalOtherCostsUsd, decimal newGrandTotalCad, decimal newGrandTotalUsd, string newState, bool newDeleted, int newCompanyId, decimal newTotalSubcontractorsCad, decimal newTotalSubcontractorsUsd, decimal newGrandRevenue, decimal newGrandProfit, decimal newGrandGrossMargin)
 {
     ProjectCombinedCostingSheet projectCostingSheet = new ProjectCombinedCostingSheet(null);
     projectCostingSheet.UpdateDirect(costingSheetId, originalProjectId, originalName, originalStartDate, originalEndDate, originalTotalLabourHoursCad, originalTotalLabourHoursUsd, originalTotalMaterialsCad, originalTotalMaterialsUsd, originalTotalUnitsCad, originalTotalUnitsUsd, originalTotalOtherCostsCad, originalTotalOtherCostsUsd, originalGrandTotalCad, originalGrandTotalUsd, originalState, originalDeleted, originalCompanyId, originalTotalSubcontractorsCad, originalTotalSubcontractorsUsd, originalGrandRevenue, originalGrandProfit, originalGrandGrossMargin, newProjectId, newName, newStartDate, newEndDate, newTotalLabourHoursCad, newTotalLabourHoursUsd, newTotalMaterialsCad, newTotalMaterialsUsd, newTotalUnitsCad, newTotalUnitsUsd, newTotalOtherCostsCad, newTotalOtherCostsUsd, newGrandTotalCad, newGrandTotalUsd, newState, newDeleted, newCompanyId, newTotalSubcontractorsCad, newTotalSubcontractorsUsd, newGrandRevenue, newGrandProfit, newGrandGrossMargin, "", "");
 }
 /// <summary>
 /// DeleteDirect
 /// </summary>
 /// <param name="costingSheetId">costingSheetId</param>
 /// <param name="companyId">companyId</param>
 public void DeleteDirect(int costingSheetId, int companyId)
 {
     // Delete costing sheet
     ProjectCombinedCostingSheet projectCostingSheet = new ProjectCombinedCostingSheet(null);
     projectCostingSheet.DeleteDirect(costingSheetId, companyId);
 }
        /// <summary>
        /// Save Costing Sheet
        /// </summary>
        /// <param name="companyId">companyId</param>
        public int Save(int companyId)
        {
            int costingSheetId = 0;
            ProjectCostingSheetAddTDS basicInformationChanges = (ProjectCostingSheetAddTDS)Data.GetChanges();

            if (basicInformationChanges.CombinedBasicInformation.Rows.Count > 0)
            {
                foreach (ProjectCostingSheetAddTDS.CombinedBasicInformationRow row in (ProjectCostingSheetAddTDS.CombinedBasicInformationDataTable)basicInformationChanges.CombinedBasicInformation)
                {
                    // Insert new costing sheet
                    if (!row.Deleted)
                    {
                        ProjectCombinedCostingSheet costingSheet = new ProjectCombinedCostingSheet(null);
                        costingSheetId = costingSheet.InsertDirect(row.ClientID, row.Name, row.StartDate, row.EndDate, row.TotalLabourHoursCad, row.TotalLabourHoursUsd, row.TotalMaterialsCad, row.TotalMaterialsUsd, row.TotalUnitsCad, row.TotalUnitsUsd, row.TotalOtherCostsCad, row.TotalOtherCostsUsd, row.GrantTotalCostCad, row.GrantTotalCostUsd, row.State, false, row.COMPANY_ID, row.TotalSubcontractorsCad, row.TotalSubcontractorsUsd, row.GrandRevenue, row.GrandProfit, row.GrandGrossMargin, row.CombinedProjects);
                    }
                }
            }

            return costingSheetId;
        }