/// <summary>
        /// Save all Revenue Costing Sheet
        /// </summary>
        /// <param name="companyId">companyId</param>
        /// <param name="costingSheetId">costingSheetId</param>
        public void Save(int companyId, int costingSheetId)
        {
            ProjectCostingSheetAddTDS informationChanges = (ProjectCostingSheetAddTDS)Data.GetChanges();

            if (informationChanges.CombinedRevenueInformation.Rows.Count > 0)
            {
                foreach (ProjectCostingSheetAddTDS.CombinedRevenueInformationRow row in (ProjectCostingSheetAddTDS.CombinedRevenueInformationDataTable)informationChanges.CombinedRevenueInformation)
                {
                    // Insert new costing sheet Revenue
                    if ((!row.Deleted) && (!row.InDatabase))
                    {
                        ProjectCombinedCostingSheetRevenue projectCostingSheetRevenue = new ProjectCombinedCostingSheetRevenue(null);
                        projectCostingSheetRevenue.InsertDirect(costingSheetId, row.RefIDRevenue, row.Revenue, row.Deleted, row.COMPANY_ID, row.StartDate, row.EndDate, row.Comment, row.ProjectID);
                    }
                }
            }
        }
        /// <summary>
        /// Save all Revenue Costing Sheets
        /// </summary>
        /// <param name="companyId">companyId</param>
        /// <param name="costingSheetId">costingSheetId</param>
        public void Save(int companyId, int costingSheetId)
        {
            ProjectCostingSheetInformationTDS subcontractorsInformationChanges = (ProjectCostingSheetInformationTDS)Data.GetChanges();

            if (subcontractorsInformationChanges.CombinedRevenueInformation.Rows.Count > 0)
            {
                projectCombinedCostingSheetInformationRevenueInformationGateway projectCombinedCostingSheetInformationRevenueInformationGateway = new projectCombinedCostingSheetInformationRevenueInformationGateway(subcontractorsInformationChanges);

                foreach (ProjectCostingSheetInformationTDS.CombinedRevenueInformationRow row in (ProjectCostingSheetInformationTDS.CombinedRevenueInformationDataTable)subcontractorsInformationChanges.CombinedRevenueInformation)
                {
                    // Insert new costing sheet Revenue
                    if ((!row.Deleted) && (!row.InDatabase))
                    {
                        ProjectCombinedCostingSheetRevenue subcontractors = new ProjectCombinedCostingSheetRevenue(null);
                        subcontractors.InsertDirect(costingSheetId, row.RefIDRevenue, row.Revenue, false, row.COMPANY_ID, row.StartDate, row.EndDate, row.Comment, row.ProjectID);
                    }

                    // Update costing sheet Revenue
                    if ((!row.Deleted) && (row.InDatabase))
                    {
                        //int subcontractorId = row.SubcontractorID;
                        //int refId = row.RefID;
                        //bool deleted = false;

                        ////original values
                        //string originalUnitOfMeasurement = projectCombinedCostingSheetInformationRevenueInformationGateway.GetUnitOfMeasurementOriginal(costingSheetId, subcontractorId, refId);
                        //double originalQuantity = projectCostingSheetInformationRevenueInformationGateway.GetQuantityOriginal(costingSheetId, subcontractorId, refId);
                        //decimal originalCostCad = projectCostingSheetInformationRevenueInformationGateway.GetCostCadOriginal(costingSheetId, subcontractorId, refId);
                        //decimal originalTotalCostCad = projectCostingSheetInformationRevenueInformationGateway.GetTotalCostCadOriginal(costingSheetId, subcontractorId, refId);
                        //decimal originalCostUsd = projectCostingSheetInformationRevenueInformationGateway.GetCostUsdOriginal(costingSheetId, subcontractorId, refId);
                        //decimal originalTotalCostUsd = projectCostingSheetInformationRevenueInformationGateway.GetTotalCostUsdOriginal(costingSheetId, subcontractorId, refId);
                        //DateTime originalStartDate = projectCostingSheetInformationRevenueInformationGateway.GetStartDateOriginal(costingSheetId, subcontractorId, refId);
                        //DateTime originalEndDate = projectCostingSheetInformationRevenueInformationGateway.GetEndDateOriginal(costingSheetId, subcontractorId, refId);

                        ////original values
                        //string newUnitOfMeasurement = projectCostingSheetInformationRevenueInformationGateway.GetUnitOfMeasurement(costingSheetId, subcontractorId, refId);
                        //double newQuantity = projectCostingSheetInformationRevenueInformationGateway.GetQuantity(costingSheetId, subcontractorId, refId);
                        //decimal newCostCad = projectCostingSheetInformationRevenueInformationGateway.GetCostCad(costingSheetId, subcontractorId, refId);
                        //decimal newTotalCostCad = projectCostingSheetInformationRevenueInformationGateway.GetTotalCostCad(costingSheetId, subcontractorId, refId);
                        //decimal newCostUsd = projectCostingSheetInformationRevenueInformationGateway.GetCostUsd(costingSheetId, subcontractorId, refId);
                        //decimal newTotalCostUsd = projectCostingSheetInformationRevenueInformationGateway.GetTotalCostUsd(costingSheetId, subcontractorId, refId);
                        //DateTime newStartDate = projectCostingSheetInformationRevenueInformationGateway.GetStartDate(costingSheetId, subcontractorId, refId);
                        //DateTime newEndDate = projectCostingSheetInformationRevenueInformationGateway.GetEndDate(costingSheetId, subcontractorId, refId);

                        //ProjectCombinedCostingSheetRevenue subcontractors = new ProjectCombinedCostingSheetRevenue(null);
                        //subcontractors.UpdateDirect(costingSheetId, subcontractorId, refId, originalUnitOfMeasurement, originalQuantity, originalCostCad, originalTotalCostCad, originalCostUsd, originalTotalCostUsd, deleted, companyId, originalStartDate, originalEndDate, newUnitOfMeasurement, newQuantity, newCostCad, newTotalCostCad, newCostUsd, newTotalCostUsd, deleted, companyId, newStartDate, newEndDate);
                    }

                    // Delete costing sheet Revenue
                    if ((row.Deleted) && (row.InDatabase))
                    {
                        ProjectCombinedCostingSheetRevenue subcontractors = new ProjectCombinedCostingSheetRevenue(null);
                        subcontractors.DeleteDirect(row.CostingSheetID, row.RefIDRevenue, row.COMPANY_ID);
                    }
                }
            }
        }