// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_RESOURCES_INSURANCECOMPANIES_VIEW"]) && Convert.ToBoolean(Session["sgLFS_RESOURCES_INSURANCECOMPANIES_EDIT"])) && Convert.ToBoolean(Session["sgLFS_RESOURCES_INSURANCECOMPANIES_DELETE"])) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Validate query string if ((string)Request.QueryString["source_page"] == null) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in insuranceCompanies_navigator.aspx"); } // Tag page hdfCompanyId.Value = Session["companyID"].ToString(); // Prepare initial data Session.Remove("insuranceCompaniesSetupTableDummy"); tdNoResults.Visible = false; // If coming from // ... Left Menu or select_project if (Request.QueryString["source_page"] == "out") { // Load insuranceCompaniesSetupTDS = new InsuranceCompaniesSetupTDS(); InsuranceCompaniesSetupInsuranceCompaniesSetup model = new InsuranceCompaniesSetupInsuranceCompaniesSetup(insuranceCompaniesSetupTDS); int companyId = Int32.Parse(hdfCompanyId.Value); model.LoadAll(companyId); // Check if there is data InsuranceCompaniesSetupInsuranceCompaniesSetup modelForMessage = new InsuranceCompaniesSetupInsuranceCompaniesSetup(insuranceCompaniesSetupTDS); modelForMessage.Load(companyId); if (modelForMessage.Table.Rows.Count > 0) { tdNoResults.Visible = false; } else { tdNoResults.Visible = true; } // Store tables Session["insuranceCompaniesSetupTDS"] = insuranceCompaniesSetupTDS; Session["insuranceCompaniesSetupTable"] = insuranceCompaniesSetupTDS.InsuranceCompaniesSetup; } } else { // Restore datasets insuranceCompaniesSetupTDS = (InsuranceCompaniesSetupTDS)Session["insuranceCompaniesSetupTDS"]; Session["insuranceCompaniesSetupTable"] = insuranceCompaniesSetupTDS.InsuranceCompaniesSetup; } }
/// <summary> /// InitData /// </summary> protected override void InitData() { _data = new InsuranceCompaniesSetupTDS(); }