示例#1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (PLA_Approval.TrainingClass.SessionHasTimeOut(Request.Cookies["Session_ID"].Value.ToString()))
            {
                Response.Redirect("/Web_Projects/trn/PLA/out.aspx?message=Your Session has timed out" + "&backurl=0", true);
            }
            lblScript.Text = "";
            #region BasTemplate
            if (!IsPostBack)
            {
                Template.BasTemplate objBasTemplate = new Template.BasTemplate();
                try
                {
                    if (Request.Cookies["Session_ID"] == null)
                    {
                        Response.Redirect("/web_projects/login_error/ErrorPage.aspx?error=Cookie not found. Please signon first", true);
                    }
                    string strResult = objBasTemplate.Authenticate(Request.Cookies["Session_ID"].Value.ToString(), Request.Url.Authority.ToString(), Request.Url.AbsolutePath.ToString(), true, false);
                    if (strResult != "")
                    {
                        Response.Redirect("/web_projects/login_error/ErrorPage.aspx?error=" + strResult.Replace("\n", "~"), false);
                        return;
                    }
                    LblTemplateHeader1.Text = objBasTemplate.Header1();
                    LblTemplateHeader2.Text = objBasTemplate.Header2();
                    LblTemplateFooter.Text  = objBasTemplate.Footer();
                    um.MenuSourceXml        = objBasTemplate.MenuXML();
                    um.DataBind();
                    ViewState["AccessType"]                   = objBasTemplate.strAccessType;
                    ViewState["Employee_Number"]              = objBasTemplate.strEmployee_Number;
                    ViewState["Processing_Year"]              = objBasTemplate.strProcessingYear;
                    ViewState["Role_Restriction_Level"]       = objBasTemplate.strRole_Restriction_Level;
                    ViewState["Selected_Account_Number"]      = objBasTemplate.strSelected_Account_Number;
                    ViewState["Selected_Employee_Class_Code"] = objBasTemplate.strSelected_Employee_Class_Code;
                    ViewState["User_Group_ID"]                = objBasTemplate.strUser_Group_ID;
                    ViewState["User_ID"]           = objBasTemplate.strUser_ID;
                    ViewState["User_Name"]         = objBasTemplate.strUser_Name;
                    ViewState["User_Primary_Role"] = objBasTemplate.strUser_Primary_Role;
                    // Wizard
                    string strpnlXML = objBasTemplate.PanelXML();
                    if (strpnlXML != "")
                    {
                        if (strpnlXML.IndexOf("Error:") != -1)
                        {
                            Response.Redirect("/web_projects/login_error/ErrorPage.aspx?error=" + strpnlXML.Replace("\n", "~"), false);
                            return;
                        }
                        upPO.PanelSourceXml = strpnlXML;
                        upPO.DataBind();
                        ViewState["CurrGrp"]           = objBasTemplate.Wizard_Value("CurrGrp");
                        ViewState["CurrGrpTtl"]        = objBasTemplate.Wizard_Value("CurrGrpTtl");
                        ViewState["CurrGrpUrl"]        = objBasTemplate.Wizard_Value("CurrGrpUrl");
                        ViewState["CurrStp"]           = objBasTemplate.Wizard_Value("CurrStp");
                        ViewState["CurrStpTtl"]        = objBasTemplate.Wizard_Value("CurrStpTtl");
                        ViewState["CurrStpUrl"]        = objBasTemplate.Wizard_Value("CurrStpUrl");
                        ViewState["Is_Step_Completed"] = objBasTemplate.Wizard_Value("Is_Step_Completed");
                        ViewState["NextGrp"]           = objBasTemplate.Wizard_Value("NextGrp");
                        ViewState["NextGrpTtl"]        = objBasTemplate.Wizard_Value("NextGrpTtl");
                        ViewState["NextGrpUrl"]        = objBasTemplate.Wizard_Value("NextGrpUrl");
                        ViewState["NextStp"]           = objBasTemplate.Wizard_Value("NextStp");
                        ViewState["NextStpTtl"]        = objBasTemplate.Wizard_Value("NextStpTtl");
                        ViewState["NextStpUrl"]        = objBasTemplate.Wizard_Value("NextStpUrl");
                        ViewState["NoGrp"]             = objBasTemplate.Wizard_Value("NoGrp");
                        ViewState["NoStpInGrp"]        = objBasTemplate.Wizard_Value("NoStpInGrp");
                        ViewState["PrvGrp"]            = objBasTemplate.Wizard_Value("PrvGrp");
                        ViewState["PrvGrpTtl"]         = objBasTemplate.Wizard_Value("PrvGrpTtl");
                        ViewState["PrvGrpUrl"]         = objBasTemplate.Wizard_Value("PrvGrpUrl");
                        ViewState["PrvStp"]            = objBasTemplate.Wizard_Value("PrvStp");
                        ViewState["PrvStpTtl"]         = objBasTemplate.Wizard_Value("PrvStpTtl");
                        ViewState["PrvStpUrl"]         = objBasTemplate.Wizard_Value("PrvStpUrl");
                    }
                }
                catch (Exception ex)
                {
                    string strError = "Error Message: " + ex.Message + "~~Application:" + ex.Source + "~~Method:" + ex.TargetSite + "~~Detail:" + ex.StackTrace;
                    Response.Redirect("/web_projects/login_error/ErrorPage.aspx?error=" + strError.Replace("\n", "~"));
                }
                finally
                {
                    objBasTemplate.CleanUp();
                    objBasTemplate.Dispose();
                }
            }
            #endregion
            LblTemplateHeader1.Text = Template.BasTemplate.ChangeLogo(LblTemplateHeader1.Text, 1);
            if (!IsPostBack)
            {
                SetCurrentProcessingYear();
                SetHeaderInformation();
                ProcessesStarFunctionality();

                ViewState["Adjust_Employee"] = SQLStatic.Sessions.GetSessionValue(Request.Cookies["Session_ID"].Value.ToString(), "Found_Employee_Number", PLA_Approval.TrainingClass.ConnectionString);
                if (ViewState["Adjust_Employee"].ToString() != "")
                {
                    txtEmployeeName.Text = SQLStatic.Sessions.GetSessionValue(Request.Cookies["Session_ID"].Value.ToString(), "Found_Name", PLA_Approval.TrainingClass.ConnectionString);
                    DrawGrid();
                }
            }
            if (ViewState["Adjust_Employee"].ToString() != "")
            {
                DrawGrid();
            }
        }