コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            session_id = Request.Cookies["Session_ID"].Value.ToString();

            #region BasTemplate
            if (!IsPostBack)
            {
                if ((Request.Params["SkipCheck"] == null) || (Request.Params["SkipCheck"] != "YES"))
                {
                    SQLStatic.Sessions.SetSessionValue(Request.Cookies["Session_ID"].Value.ToString(), "main_run", Request.Path + "?SkipCheck=YES");
                    Response.Redirect("/web_projects/PTemplate/index.htm");
                    return;
                }
                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, false);
                        return;
                    }
                    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;

                }
                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

            if (!IsPostBack)
            {
                
                if (!string.IsNullOrEmpty(Request.Params["ee"]))
                {
                    if (!string.IsNullOrEmpty(Request.Params["Verify"]))
                        Response.Redirect("Dependents.aspx?SkipCheck=YES&Skipcvrg=1&ee=" + Request.Params["ee"] + "&Verify=" + Request.Params["Verify"], true);
                    if (!Data.HasMorePendingCvrg(Request.Params["ee"]))
                    {
                        if (!string.IsNullOrEmpty(Request.Params["Verify"]))
                            Response.Redirect("Dependents.aspx?SkipCheck=YES&Skipcvrg=1&ee=" + Request.Params["ee"] + "&Verify=" + Request.Params["Verify"], true);
                        else
                          Response.Redirect("Dependents.aspx?SkipCheck=YES&Skipcvrg=1&ee=" + Request.Params["ee"], true);
                    }
                    dvLeft.Visible = false;
                    dvRight.Style.Add("float","left");
                    btnBack.Visible = true;
                    ViewState["EE_Number"] = Request.Params["ee"];
                    setLabelName();
                }
                else
                {
                    ViewState["EE_Number"] = "-1";
                    drawEEGrid();
                }
            }
            if (!string.IsNullOrEmpty(hidDecline.Value))
            {
                DisApprove(hidDecline.Value);
                hidDecline.Value = "";
                return;
            }
            //if (!Data.HasMorePendingCvrg(Request.Params["ee"]))
            //{
            //    Response.Redirect("Dependents.aspx?SkipCheck=YES&Skipcvrg=1&ee=" + Request.Params["ee"], true);
            //}
            AutoSelect();
            DrawCvrgGrid();
            DrawDepGrid();

        }