コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    //เก็บไว้ส่งไปที่ Adam, AolSummaryReport
                    StaffData staff = SlmScr003Biz.GetStaff(HttpContext.Current.User.Identity.Name);
                    txtEmpCode.Text     = staff.EmpCode;
                    txtStaffTypeId.Text = staff.StaffTypeId != null?staff.StaffTypeId.ToString() : "";

                    txtStaffTypeDesc.Text   = staff.StaffTypeDesc;
                    txtStaffId.Text         = staff.StaffId.ToString();
                    txtStaffBranchCode.Text = staff.BranchCode;


                    //Set AdvanceSearch
                    if (staff.Collapse == null || staff.Collapse == true)
                    {
                        lbAdvanceSearch.Text             = "[+] <b>Advance Search</b>";
                        pnAdvanceSearch.Style["display"] = "none";
                        txtAdvanceSearch.Text            = "N";
                    }
                    else
                    {
                        lbAdvanceSearch.Text             = "[-] <b>Advance Search</b>";
                        pnAdvanceSearch.Style["display"] = "block";
                        txtAdvanceSearch.Text            = "Y";
                    }

                    InitialControl();
                    if (Session[searchcondition] != null)
                    {
                        SetSerachCondition((SearchLeadCondition)Session[searchcondition]);  //Page Load กลับมาจากหน้าอื่น
                        Session[searchcondition] = null;
                    }
                    //else
                    //    DoSearchLeadData(0, string.Empty, SortDirection.Ascending);    //First Load ครั้งแรก
                    StaffData Staff = StaffBiz.GetDefaultSearch(HttpContext.Current.User.Identity.Name);

                    if (Staff != null)
                    {
                        ViewState["SearchDefault"] = Staff.DefaultSearch;
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Debug(message);
                AppUtil.ClientAlert(Page, message);
            }
        }