// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check EmployeeGateway employeeGateway1 = new EmployeeGateway(); int employeeIdNow = employeeGateway1.GetEmployeIdByLoginId(Convert.ToInt32(Session["loginID"])); employeeGateway1.LoadByEmployeeId(employeeIdNow); if (!employeeGateway1.GetIsVacationsManager(employeeIdNow)) { 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) && ((string)Request.QueryString["date_to_show"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in vacations_approve_vacation_request.aspx"); } //recibe opcionalmente el employee_id // Tag page int companyId = Int32.Parse(Session["companyID"].ToString()); hdfCompanyId.Value = companyId.ToString(); ViewState["rejected_by_id"] = employeeGateway1.GetEmployeIdByLoginId(Convert.ToInt32(Session["loginID"])); //recibe opcionalmente el employee_id y date_to_show if ((string)Request.QueryString["date_to_show"] == null) { ViewState["date_to_show"] = DateTime.Now.ToString(); } else { ViewState["date_to_show"] = (string)Request.QueryString["date_to_show"]; } if ((string)Request.QueryString["employee_id"] == null) { hdfEmployeeId.Value = "-1"; } else { hdfEmployeeId.Value = (string)Request.QueryString["employee_id"]; } EmployeeList employeeList = new EmployeeList(); employeeList.LoadBySalariedAndAddItem(1, -1, "(All)"); DropDownList ddlVacationsFor = (DropDownList)tkrpbLeftMenuAllVacations.FindItemByValue("nbVacationsForDDL").FindControl("ddlVacationsFor"); ddlVacationsFor.DataSource = employeeList.Table; ddlVacationsFor.DataValueField = "EmployeeID"; ddlVacationsFor.DataTextField = "FullName"; ddlVacationsFor.DataBind(); ddlVacationsFor.SelectedValue = Session["ddlVacationsForSelectedValue"].ToString(); vacationsInformationTDS = new VacationsInformationTDS(); VacationsInformationRequestsInformationGateway vacationsInformationRequestsInformationGateway = new VacationsInformationRequestsInformationGateway(vacationsInformationTDS); vacationsInformationRequestsInformationGateway.LoadByState("For Approval", companyId); grdVacations.DataSource = vacationsInformationTDS.RequestsInformation; Session["vacationsInformationTDS"] = vacationsInformationTDS; Page.DataBind(); // Check results if (vacationsInformationTDS.RequestsInformation.Rows.Count > 0) { tdNoResults.Visible = false; lblTotalRows.Visible = true; lblTotalRows.Text = "Total Rows: " + vacationsInformationTDS.RequestsInformation.Rows.Count; } else { tdNoResults.Visible = true; lblTotalRows.Visible = false; } } else { vacationsInformationTDS = (VacationsInformationTDS)Session["vacationsInformationTDS"]; } }