/// <summary> /// Save all OtherCategorys Costing Sheet /// </summary> /// <param name="companyId">companyId</param> /// <param name="costingSheetId">costingSheetId</param> public void Save(int companyId, int costingSheetId) { ProjectCostingSheetAddTDS changes = (ProjectCostingSheetAddTDS)Data.GetChanges(); if (changes.OtherCategoryInformation.Rows.Count > 0) { foreach (ProjectCostingSheetAddTDS.OtherCategoryInformationRow row in (ProjectCostingSheetAddTDS.OtherCategoryInformationDataTable)changes.OtherCategoryInformation) { // Insert new costing sheet OtherCategorys if ((!row.Deleted) && (!row.InDatabase)) { ProjectCostingSheetOtherCategory projectCostingSheetOtherCategorys = new ProjectCostingSheetOtherCategory(null); projectCostingSheetOtherCategorys.InsertDirect(costingSheetId, row.Category, row.RefID, row.Rate, row.Deleted, row.COMPANY_ID, row.StartDate, row.EndDate, row.Comment); } } } }
/// <summary> /// Save all Other Category Costing Sheets /// </summary> /// <param name="companyId">companyId</param> /// <param name="costingSheetId">costingSheetId</param> public void Save(int companyId, int costingSheetId) { ProjectCostingSheetInformationTDS otherCategoryInformationChanges = (ProjectCostingSheetInformationTDS)Data.GetChanges(); if (otherCategoryInformationChanges.OtherCategoryInformation.Rows.Count > 0) { ProjectCostingSheetInformationOtherCategoryInformationGateway projectCostingSheetInformationOtherCategoryInformationGateway = new ProjectCostingSheetInformationOtherCategoryInformationGateway(otherCategoryInformationChanges); foreach (ProjectCostingSheetInformationTDS.OtherCategoryInformationRow row in (ProjectCostingSheetInformationTDS.OtherCategoryInformationDataTable)otherCategoryInformationChanges.OtherCategoryInformation) { // Insert new costing sheet Other Category if ((!row.Deleted) && (!row.InDatabase)) { ProjectCostingSheetOtherCategory otherCategory = new ProjectCostingSheetOtherCategory(null); otherCategory.InsertDirect(costingSheetId, row.Category, row.RefID, row.Rate, row.Deleted, row.COMPANY_ID, row.StartDate, row.EndDate, row.Comment); } // Update costing sheet Other Category if ((!row.Deleted) && (row.InDatabase)) { string category = row.Category; int refId = row.RefID; bool deleted = false; //original values decimal originalRate = projectCostingSheetInformationOtherCategoryInformationGateway.GetRateOriginal(costingSheetId, category, refId); DateTime originalStartDate = projectCostingSheetInformationOtherCategoryInformationGateway.GetStartDateOriginal(costingSheetId, category, refId); DateTime originalEndDate = projectCostingSheetInformationOtherCategoryInformationGateway.GetEndDateOriginal(costingSheetId, category, refId); //original values decimal newRate = projectCostingSheetInformationOtherCategoryInformationGateway.GetRate(costingSheetId, category, refId); DateTime newStartDate = projectCostingSheetInformationOtherCategoryInformationGateway.GetStartDate(costingSheetId, category, refId); DateTime newEndDate = projectCostingSheetInformationOtherCategoryInformationGateway.GetEndDate(costingSheetId, category, refId); ProjectCostingSheetOtherCategory otherCategory = new ProjectCostingSheetOtherCategory(null); //otherCategory.UpdateDirect(costingSheetId, category, refId, originalRate, deleted, companyId, originalStartDate, originalEndDate, newRate, deleted, companyId, newStartDate, newEndDate); } // Delete costing sheet Other Category if ((row.Deleted) && (row.InDatabase)) { /*ProjectCostingSheetOtherCategory otherCategory = new ProjectCostingSheetOtherCategory(null); otherCategory.DeleteDirect(row.CostingSheetID, row.Category, row.RefID, row.COMPANY_ID);*/ } } } }