private void UpdateDatabase() { int companyId = Int32.Parse(hdfCompanyId.Value); DB.Open(); DB.BeginTransaction(); try { ProjectCostingSheetInformationBasicInformation projectCostingSheetInformationBasicInformation = new ProjectCostingSheetInformationBasicInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationBasicInformation.Save(companyId); DB.CommitTransaction(); // Store datasets projectCostingSheetInformationTDS.AcceptChanges(); Session["projectCostingSheetInformationTDS"] = projectCostingSheetInformationTDS; } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
private void UpdateDatabase() { int companyId = Int32.Parse(hdfCompanyId.Value); int costingSheetId = Int32.Parse(hdfCostingSheetId.Value); DB.Open(); DB.BeginTransaction(); try { ProjectCostingSheetInformationBasicInformation projectCostingSheetInformationBasicInformation = new ProjectCostingSheetInformationBasicInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationBasicInformation.Save(companyId); // Save costs information ProjectCostingSheetInformationLabourHoursInformation projectCostingSheetInformationLabourHoursInformation = new ProjectCostingSheetInformationLabourHoursInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationLabourHoursInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationUnitsInformation projectCostingSheetInformationUnitsInformation = new ProjectCostingSheetInformationUnitsInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationUnitsInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationMaterialsInformation projectCostingSheetInformationMaterialsInformation = new ProjectCostingSheetInformationMaterialsInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationMaterialsInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationOtherCostsInformation projectCostingSheetInformationOtherCostsInformation = new ProjectCostingSheetInformationOtherCostsInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationOtherCostsInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationSubcontractorsInformation projectCostingSheetInformationSubcontractorsInformation = new ProjectCostingSheetInformationSubcontractorsInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationSubcontractorsInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationHotelsInformation projectCostingSheetInformationHotelsInformation = new ProjectCostingSheetInformationHotelsInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationHotelsInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationBondingsInformation projectCostingSheetInformationBondingsInformation = new ProjectCostingSheetInformationBondingsInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationBondingsInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationInsurancesInformation projectCostingSheetInformationInsurancesInformation = new ProjectCostingSheetInformationInsurancesInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationInsurancesInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationOtherCategoryInformation projectCostingSheetInformationOtherCategoryInformation = new ProjectCostingSheetInformationOtherCategoryInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationOtherCategoryInformation.Save(companyId, costingSheetId); DB.CommitTransaction(); // Store datasets projectCostingSheetInformationTDS.AcceptChanges(); Session["lfsProjectTDS"] = projectTDS; Session["projectCostingSheetInformationTDS"] = projectCostingSheetInformationTDS; Session["labourHoursInformation"] = projectCostingSheetInformationTDS.LabourHoursInformation; Session["unitsInformation"] = projectCostingSheetInformationTDS.UnitsInformation; Session["subcontractorsInformation"] = projectCostingSheetInformationTDS.SubcontractorsInformation; Session["materialsInformation"] = projectCostingSheetInformationTDS.MaterialsInformation; Session["otherCostsInformation"] = projectCostingSheetInformationTDS.OtherCostsInformation; Session["hotelssInformation"] = projectCostingSheetInformationTDS.HotelsInformation; Session["bondingsInformation"] = projectCostingSheetInformationTDS.BondingsInformation; Session["insurancesInformation"] = projectCostingSheetInformationTDS.InsurancesInformation; Session["otherCategoryInformation"] = projectCostingSheetInformationTDS.OtherCategoryInformation; } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }