// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Access to this page if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_SUBCONTRACTOR_HOURS_VIEW"])) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Tag Page hdfCompanyId.Value = Session["companyID"].ToString(); // Prepare initial data // ... For Client int companyId = Int32.Parse(hdfCompanyId.Value); CompaniesList companiesList = new CompaniesList(); companiesList.LoadAndAddItem(-1, "(All)", companyId); ddlClient.DataSource = companiesList.Table; ddlClient.DataValueField = "COMPANIES_ID"; ddlClient.DataTextField = "NAME"; ddlClient.DataBind(); // ... for project ProjectList projectList = new ProjectList(); projectList.LoadProjectsAndAddItem(-1, "(All)", int.Parse(ddlClient.SelectedValue)); ddlProject.DataSource = projectList.Table; ddlProject.DataValueField = "ProjectID"; ddlProject.DataTextField = "Name"; ddlProject.DataBind(); tkrdpStartDate.SelectedDate = DateTime.Now; tkrdpEndDate.SelectedDate = DateTime.Now; // Register delegates this.RegisterDelegates(); } else { // Register delegates this.RegisterDelegates(); } }
private void RestoreNavigatorState() { // Search condition 1 // ... For Condition // ... for the client int companyId = Int32.Parse(hdfCompanyId.Value); CompaniesList companiesList = new CompaniesList(new DataSet()); companiesList.LoadAndAddItem(-1, "(All)", companyId); ddlClient.DataSource = companiesList.Table; ddlClient.DataValueField = "COMPANIES_ID"; ddlClient.DataTextField = "NAME"; ddlClient.DataBind(); //ddlClient.SelectedIndex = 0; ddlClient.SelectedValue = Request.QueryString["search_ddlClient"]; int clientId = -1; if (Request.QueryString["search_ddlClient"] != "" && Request.QueryString["search_ddlClient"] != null) { clientId = Int32.Parse(Request.QueryString["search_ddlClient"].ToString()); } // ... for project ProjectList projectList = new ProjectList(); projectList.LoadProjectsAndAddItem(-1, "(All)", clientId); ddlProject.DataSource = projectList.Table; ddlProject.DataValueField = "ProjectID"; ddlProject.DataTextField = "Name"; ddlProject.DataBind(); //ddlProject.SelectedIndex = 0; ddlProject.SelectedValue = Request.QueryString["search_ddlProject"]; // Search condition 1 // ... For Condition odsSubcontractorsList.DataBind(); ddlSubcontractor.DataSourceID = "odsSubcontractorsList"; ddlSubcontractor.DataValueField = "SubcontractorID"; ddlSubcontractor.DataTextField = "Name"; ddlSubcontractor.DataBind(); ddlSubcontractor.SelectedValue = Request.QueryString["search_ddlSubcontractor"]; //Other values //... For SortBy ddlSortBy.SelectedValue = Request.QueryString["search_sort_by"]; if (!String.IsNullOrEmpty(Request.QueryString["search_tkrdpStartDate"].ToString())) { tkrdpStartDate.SelectedDate = DateTime.Parse(Request.QueryString["search_tkrdpStartDate"]); } if (!String.IsNullOrEmpty(Request.QueryString["search_tkrdpEndDate"].ToString())) { tkrdpEndDate.SelectedDate = DateTime.Parse(Request.QueryString["search_tkrdpEndDate"]); } if (!String.IsNullOrEmpty(Request.QueryString["search_cbxFilterByDateSelected"].ToString())) { cbxFilterByRangeOfDates.Checked = Convert.ToBoolean(Request.QueryString["search_cbxFilterByDateSelected"]); } }
// //////////////////////////////////////////////////////////////////////// // INITIAL EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { if (!(Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_SUBCONTRACTOR_HOURS_ADMIN"]))) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_SUBCONTRACTOR_HOURS_VIEW"]))) { 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 subcontractor_hours_navigator.aspx"); } } // Tag Page hdfCompanyId.Value = Session["companyID"].ToString(); tkrdpStartDate.SelectedDate = DateTime.Now; tkrdpEndDate.SelectedDate = DateTime.Now; // ... for the client int companyId = Int32.Parse(hdfCompanyId.Value); CompaniesList companiesList = new CompaniesList(new DataSet()); companiesList.LoadAndAddItem(-1, "(All)", companyId); ddlClient.DataSource = companiesList.Table; ddlClient.DataValueField = "COMPANIES_ID"; ddlClient.DataTextField = "NAME"; ddlClient.DataBind(); ddlClient.SelectedIndex = 0; // ... for project ProjectList projectList = new ProjectList(); projectList.LoadProjectsAndAddItem(-1, "(All)", -1); ddlProject.DataSource = projectList.Table; ddlProject.DataValueField = "ProjectID"; ddlProject.DataTextField = "Name"; ddlProject.DataBind(); ddlProject.SelectedIndex = 0; // If coming from // ... Left Menu or out if ((Request.QueryString["source_page"] == "lm") || (Request.QueryString["source_page"] == "out")) { tdNoResults.Visible = false; } // ... subcontractor_hours_navigator2.aspx if (Request.QueryString["source_page"] == "subcontractor_hours_navigator2.aspx") { RestoreNavigatorState(); if ((string)Request.QueryString["no_results"] == "yes") { tdNoResults.Visible = true; } else { tdNoResults.Visible = false; } } } }