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); HotelsAddHotels hotelsAddHotels = new HotelsAddHotels(hotelsAddTDS); hotelsAddHotels.Save(companyId); DB.CommitTransaction(); // Store datasets hotelsAddTDS.AcceptChanges(); Session["hotelsAddTDS"] = hotelsAddTDS; } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
private bool StepHotelNext() { int selectedCompaniesIdForHotels = Int32.Parse(ddlCompaniesForHotels.SelectedValue); int companyIdForHotels = Int32.Parse(hdfCompanyIdForHotels.Value); HotelsAddHotelsGateway hotelsAddHotelsGateway = new HotelsAddHotelsGateway(); if (hotelsAddHotelsGateway.IsInLfs(selectedCompaniesIdForHotels, companyIdForHotels)) { lblUserErrorMessageForHotels.Visible = true; } else { lblUserErrorMessageForHotels.Visible = false; // Get name int companiesIdForHotels = Int32.Parse(ddlCompaniesForHotels.SelectedValue); DateTime dateForHotels = DateTime.Now; // Insert subcontractor hdfNameForHotels.Value = GetCompanyName(companiesIdForHotels, companyIdForHotels); HotelsAddHotels model = new HotelsAddHotels(hotelsAddTDS); model.Insert(companiesIdForHotels, dateForHotels, hdfNameForHotels.Value, false, companyIdForHotels); // ... Store tables Session["hotelsAddTDS"] = hotelsAddTDS; } return true; }
private bool StepBeginNext() { int selectedCompaniesId = Int32.Parse(ddlCompanies.SelectedValue); int companyId = Int32.Parse(hdfCompanyId.Value); HotelsAddHotelsGateway hotelsAddHotelsGateway = new HotelsAddHotelsGateway(); if (hotelsAddHotelsGateway.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); HotelsAddHotels model = new HotelsAddHotels(hotelsAddTDS); model.Insert(companiesId, date, hdfName.Value, false, companyId); // ... Store tables Session["hotelsAddTDS"] = hotelsAddTDS; } return true; }