private void UpdateDatabase() { DB.Open(); DB.BeginTransaction(); try { // For Subcontractors if ((cbxSubcontractor.Checked) && (hdfNameForSubcontractors .Value !="")) { int companyIdForSubcontractors = Int32.Parse(hdfCompanyIdForSubcontractors.Value); SubcontractorsAddSubcontractors subcontractorsAddSubcontractors = new SubcontractorsAddSubcontractors(subcontractorsAddTDS); subcontractorsAddSubcontractors.Save(companyIdForSubcontractors); // Store datasets subcontractorsAddTDS.AcceptChanges(); Session["subcontractorsAddTDS"] = subcontractorsAddTDS; } // For Hotels if ((cbxHotels.Checked) && (hdfNameForHotels .Value !="")) { int companyIdForHotels = Int32.Parse(hdfCompanyIdForHotels.Value); HotelsAddHotels hotelsAddHotels = new HotelsAddHotels(hotelsAddTDS); hotelsAddHotels.Save(companyIdForHotels); // Store datasets hotelsAddTDS.AcceptChanges(); Session["hotelsAddTDS"] = hotelsAddTDS; } // For bonding Companies if ((cbxBondingCompanies.Checked) && (hdfNameForBondingCompanies .Value !="")) { int companyIdForBondingCompanies = Int32.Parse(hdfCompanyIdForBondingCompanies.Value); BondingCompaniesAddBondingCompanies bondingCompaniesAddBondingCompanies = new BondingCompaniesAddBondingCompanies(bondingCompaniesAddTDS); bondingCompaniesAddBondingCompanies.Save(companyIdForBondingCompanies); // Store datasets bondingCompaniesAddTDS.AcceptChanges(); Session["bondingCompaniesAddTDS"] = bondingCompaniesAddTDS; } // For insurance Companies if ((cbxInsuranceCompanies.Checked) && (hdfNameForInsuranceCompanies .Value !="")) { int companyIdForInsuranceCompanies = Int32.Parse(hdfCompanyIdForInsuranceCompanies.Value); InsuranceCompaniesAddInsuranceCompanies insuranceCompaniesAddInsuranceCompanies = new InsuranceCompaniesAddInsuranceCompanies(insuranceCompaniesAddTDS); insuranceCompaniesAddInsuranceCompanies.Save(companyIdForInsuranceCompanies); // Store datasets insuranceCompaniesAddTDS.AcceptChanges(); Session["insuranceCompaniesAddTDS"] = insuranceCompaniesAddTDS; } DB.CommitTransaction(); } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
private void UpdateDatabase() { DB.Open(); DB.BeginTransaction(); try { int companyId = Int32.Parse(hdfCompanyId.Value); BondingCompaniesAddBondingCompanies bondingCompaniesAddBondingCompanies = new BondingCompaniesAddBondingCompanies(bondingCompaniesAddTDS); bondingCompaniesAddBondingCompanies.Save(companyId); DB.CommitTransaction(); // Store datasets bondingCompaniesAddTDS.AcceptChanges(); Session["bondingCompaniesAddTDS"] = bondingCompaniesAddTDS; } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
private bool StepBondingCompaniesNext() { int selectedCompaniesIdForBondingCompanies = Int32.Parse(ddlCompaniesForBondingCompanies.SelectedValue); int companyIdForBondingCompanies = Int32.Parse(hdfCompanyIdForBondingCompanies.Value); BondingCompaniesAddBondingCompaniesGateway bondingCompaniesAddBondingCompaniesGateway = new BondingCompaniesAddBondingCompaniesGateway(); if (bondingCompaniesAddBondingCompaniesGateway.IsInLfs(selectedCompaniesIdForBondingCompanies, companyIdForBondingCompanies)) { lblUserErrorMessageForBondingCompanies.Visible = true; } else { lblUserErrorMessageForBondingCompanies.Visible = false; // Get name int companiesIdForBondingCompanies = Int32.Parse(ddlCompaniesForBondingCompanies.SelectedValue); DateTime dateForBondingCompanies = DateTime.Now; // Insert subcontractor hdfNameForBondingCompanies.Value = GetCompanyName(companiesIdForBondingCompanies, companyIdForBondingCompanies); BondingCompaniesAddBondingCompanies model = new BondingCompaniesAddBondingCompanies(bondingCompaniesAddTDS); model.Insert(companiesIdForBondingCompanies, dateForBondingCompanies, hdfNameForBondingCompanies.Value, false, companyIdForBondingCompanies); // ... Store tables Session["bondingCompaniesAddTDS"] = bondingCompaniesAddTDS; } return true; }
private bool StepBeginNext() { int selectedCompaniesId = Int32.Parse(ddlCompanies.SelectedValue); int companyId = Int32.Parse(hdfCompanyId.Value); BondingCompaniesAddBondingCompaniesGateway bondingCompaniesAddBondingCompaniesGateway = new BondingCompaniesAddBondingCompaniesGateway(); if (bondingCompaniesAddBondingCompaniesGateway.IsInLfs(selectedCompaniesId, companyId)) { lblUserErrorMessage.Visible = true; return false; } else { lblUserErrorMessage.Visible = false; // Get name int companiesId = Int32.Parse(ddlCompanies.SelectedValue); DateTime date = DateTime.Now; // Insert subcontractor CompaniesGatewayRAF companiesGatewayRAF = new CompaniesGatewayRAF(); companiesGatewayRAF.LoadByCompaniesId(companiesId, companyId); hdfName.Value = companiesGatewayRAF.GetName(companiesId); BondingCompaniesAddBondingCompanies model = new BondingCompaniesAddBondingCompanies(bondingCompaniesAddTDS); model.Insert(companiesId, date, hdfName.Value, false, companyId); // ... Store tables Session["bondingCompaniesAddTDS"] = bondingCompaniesAddTDS; } return true; }