예제 #1
0
        private void setData()
        {
            cPerson   objPerson = new cPerson();
            DataTable dt;
            DataSet   ds          = new DataSet();
            var       strCriteria = string.Empty;
            var       strMessage  = string.Empty;

            try
            {
                strCriteria = " and person_code = '" + ViewState["person_code"].ToString() + "' ";
                objPerson.SP_PERSON_LIST_SEL(strCriteria, ref ds, ref strMessage);
                dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    #region get Data
                    hdduser_group_list.Value = Helper.CStr(dt.Rows[0]["user_group_list"]);
                    hddperson_code.Value     = dt.Rows[0]["person_code"].ToString();
                    lblperson_name.Text      = dt.Rows[0]["title_name"].ToString() + dt.Rows[0]["person_thai_name"] + " " + dt.Rows[0]["person_thai_surname"];
                    #endregion

                    BindGridItem();
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message.ToString();
            }
        }
예제 #2
0
        protected bool SetPersonUserProfile(string strUserName, ref string _strError)
        {
            bool      booResult = false;
            cPerson   objPerson = new cPerson();
            DataTable dt        = new DataTable();
            DataSet   ds        = new DataSet();
            string    strCriteria;
            string    strMessage         = string.Empty;
            string    strDecryptPassword = string.Empty;

            strCriteria = " And person_id='" + strUserName + "' ";
            objPerson.SP_PERSON_LIST_SEL(strCriteria, ref ds, ref strMessage);
            dt = ds.Tables[0];
            if (dt.Rows.Count > 0)
            {
                Session["PersonID"]             = strUserName;
                Session["PersonUserName"]       = strUserName;
                Session["PersonBudgetPlanCode"] = Helper.CStr(dt.Rows[0]["budget_plan_code"]);;
                Session["PersonCode"]           = Helper.CStr(dt.Rows[0]["person_code"]);
                Session["PersonFullName"]       = Helper.CStr(dt.Rows[0]["title_name"]) + Helper.CStr(dt.Rows[0]["person_thai_name"]) + "  " + Helper.CStr(dt.Rows[0]["person_thai_surname"]);
                booResult = true;
            }
            else
            {
                _strError = "ไม่พบผู้ใช้งานนี้";
            }
            return(booResult);
        }
예제 #3
0
        protected bool SetPersonUserProfile(string strUserName, ref string _strError)
        {
            bool      booResult = false;
            cPerson   objPerson = new cPerson();
            DataTable dt        = new DataTable();
            DataSet   ds        = new DataSet();
            string    strCriteria;
            string    strMessage = string.Empty;

            strCriteria = " And person_id='" + strUserName + "' ";
            objPerson.SP_PERSON_LIST_SEL(strCriteria, ref ds, ref strMessage);
            dt = ds.Tables[0];
            if (dt.Rows.Count > 0)
            {
                Session["PersonID"]             = strUserName;
                Session["PersonUserName"]       = strUserName;
                Session["PersonBudgetPlanCode"] = Helper.CStr(dt.Rows[0]["budget_plan_code"]);;
                Session["DirectorCode"]         = Helper.CStr(dt.Rows[0]["director_code"]);;
                Session["DirectorName"]         = Helper.CStr(dt.Rows[0]["director_name"]);
                Session["UnitCode"]             = Helper.CStr(dt.Rows[0]["unit_code"]);;
                Session["PersonCode"]           = Helper.CStr(dt.Rows[0]["person_code"]);
                if (Helper.CStr(dt.Rows[0]["ef_approve_for"]).Length == 0)
                {
                    Session["ApproveFor"] = Helper.CStr(dt.Rows[0]["person_code"]);
                }
                else
                {
                    Session["ApproveFor"] = Helper.CStr(dt.Rows[0]["ef_approve_for"]);
                }


                Session["PersonFullName"]     = Helper.CStr(dt.Rows[0]["title_name"]) + Helper.CStr(dt.Rows[0]["person_thai_name"]) + "  " + Helper.CStr(dt.Rows[0]["person_thai_surname"]);
                Session["username"]           = (Helper.CStr(dt.Rows[0]["person_thai_name"])).Substring(0, dt.Rows[0]["person_thai_name"].ToString().Length > 10 ? 10 : dt.Rows[0]["person_thai_name"].ToString().Length);
                Session["PositionManageCode"] = Helper.CStr(dt.Rows[0]["person_manage_code"]);
                Session["PositionManageName"] = Helper.CStr(dt.Rows[0]["person_manage_name"]);
                Session["PositionCode"]       = Helper.CStr(dt.Rows[0]["position_code"]);
                Session["PositionName"]       = Helper.CStr(dt.Rows[0]["position_name"]);
                Session["UserGroupCode"]      = Helper.CStr(dt.Rows[0]["ef_user_group_list"]) != "" ? Helper.CStr(dt.Rows[0]["ef_user_group_list"]) : "User";

                booResult = true;
            }
            else
            {
                _strError = "ไม่พบผู้ใช้งานนี้";
            }
            return(booResult);
        }
예제 #4
0
        private void GotoUserMode(string user_group_code)
        {
            cUser_group objUserGroup = new cUser_group();
            DataTable   dt           = new DataTable();
            DataSet     ds           = new DataSet();
            string      strCriteria  = " and user_group_code = '" + user_group_code + "' ";
            string      strMessage   = string.Empty;

            objUserGroup.SP_USER_GROUP_SEL(strCriteria, ref ds, ref strMessage);
            dt = ds.Tables[0];
            if (dt.Rows.Count > 0)
            {
                this.IsLogin      = "******";
                this.DirectorLock = Helper.CStr(dt.Rows[0]["director_lock"]);
                this.MajorLock    = Helper.CStr(dt.Rows[0]["unit_lock"]);

                string[] strperson_group_list = Helper.CStr(dt.Rows[0]["person_group_list"]).Split(',');
                for (int i = 0; i <= (strperson_group_list.GetUpperBound(0)); i++)
                {
                    PersonGroupList = PersonGroupList + "'" + strperson_group_list[i] + "',";
                }

                PersonGroupList = PersonGroupList.Substring(0, PersonGroupList.Length - 1);


                cPerson objPerson = new cPerson();
                strCriteria = " And person_id='" + base.PersonId + "' ";
                objPerson.SP_PERSON_LIST_SEL(strCriteria, ref ds, ref strMessage);
                dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    this.UserLoginName     = Helper.CStr(dt.Rows[0]["person_thai_name"]) + "  " + Helper.CStr(dt.Rows[0]["person_thai_surname"]);
                    this.PersonMajorCode   = Helper.CStr(dt.Rows[0]["major_code"]);
                    this.PersonMajorName   = Helper.CStr(dt.Rows[0]["major_name"]);
                    this.PersonMajorAbbrev = Helper.CStr(dt.Rows[0]["major_abbrev"]);
                    this.DirectorCode      = Helper.CStr(dt.Rows[0]["director_code"]);
                    this.DirectorName      = Helper.CStr(dt.Rows[0]["director_name"]);
                    Session["username"]    = Helper.CStr(dt.Rows[0]["person_thai_name"]) + "  " + Helper.CStr(dt.Rows[0]["person_thai_surname"]);
                }

                Response.Redirect("Menu_control.aspx");
            }
        }
예제 #5
0
        private void BindGridView(int nPageNo)
        {
            cPerson oPerson                    = new cPerson();
            DataSet ds                         = new DataSet();
            string  strMessage                 = string.Empty;
            string  strCriteria                = string.Empty;
            string  strperson_group_code       = string.Empty;
            string  strdirector_code           = string.Empty;
            string  strunit_code               = string.Empty;
            string  strperson_code             = string.Empty;
            string  strperson_name             = string.Empty;
            string  strperson_work_status_code = string.Empty;
            string  struser_group_code         = string.Empty;
            string  struser_group_list         = string.Empty;

            strperson_group_code       = cboPerson_group.SelectedValue;
            strdirector_code           = cboDirector.SelectedValue;
            strunit_code               = cboUnit.SelectedValue;
            strperson_work_status_code = cboPerson_work_status.SelectedValue;
            strperson_code             = txtperson_code.Text.Replace("'", "''").Trim();
            strperson_name             = txtperson_name.Text.Replace("'", "''").Trim();
            struser_group_list         = cboUserGroup.SelectedValue;

            var strperson_id = txtperson_id.Text.Replace("'", "''").Trim();

            if (!strperson_id.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_id like '%" + strperson_id + "%') ";
            }

            if (Request.Form[strPrefixCtr + "cboPerson_work_status"] != null)
            {
                strperson_work_status_code = Request.Form[strPrefixCtr + "cboPerson_work_status"].ToString();
            }
            if (!strperson_group_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_group_code like '%" + strperson_group_code + "%') ";
            }

            if (!strdirector_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (director_code = '" + strdirector_code + "') ";
            }

            if (!strunit_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (unit_code= '" + strunit_code + "') ";
            }

            if (!strperson_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_code= '" + strperson_code + "') ";
            }

            if (!strperson_name.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_thai_name like '%" + strperson_name + "%'  " +
                              "  OR person_thai_surname like '%" + strperson_name + "%'  " +
                              "  OR person_eng_name like '%" + strperson_name + "%'  " +
                              "  OR person_eng_surname like '%" + strperson_name + "%')";
            }

            if (!strperson_work_status_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_work_status_code= '" + strperson_work_status_code + "') ";
            }

            if (RadioActive.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='Y') ";
            }
            else if (RadioCancel.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='N') ";
            }
            if (!struser_group_list.Equals(""))
            {
                if (struser_group_list == "User")
                {
                    strCriteria = strCriteria + "  And  (user_group_list is null or user_group_list  = '') ";
                }
                else
                {
                    strCriteria = strCriteria + "  And  (user_group_list  Like '%" + struser_group_list + "%') ";
                }
            }

            try
            {
                if (!oPerson.SP_PERSON_LIST_SEL(strCriteria, ref ds, ref strMessage))
                {
                    lblError.Text = strMessage;
                }
                else
                {
                    try
                    {
                        GridView1.PageIndex           = nPageNo;
                        txthTotalRecord.Value         = ds.Tables[0].Rows.Count.ToString();
                        ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"];
                        GridView1.DataSource          = ds.Tables[0];
                        GridView1.DataBind();
                    }
                    catch
                    {
                        GridView1.PageIndex           = 0;
                        txthTotalRecord.Value         = ds.Tables[0].Rows.Count.ToString();
                        ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"];
                        GridView1.DataSource          = ds.Tables[0];
                        GridView1.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message.ToString();
            }
            finally
            {
                oPerson.Dispose();
                ds.Dispose();
                if (GridView1.Rows.Count > 0)
                {
                    GridView1.TopPagerRow.Visible = true;
                }
            }
        }
예제 #6
0
        private void BindGridView()
        {
            InitcboWork_status();
            InitcboPerson_group();

            cPerson oPerson               = new cPerson();
            DataSet ds                    = new DataSet();
            string  strMessage            = string.Empty;
            string  strCriteria           = string.Empty;
            string  strYear               = string.Empty;
            string  strActive             = string.Empty;
            string  strperson_group_code  = string.Empty;
            string  strperson_group_name  = string.Empty;
            string  strunit_code          = string.Empty;
            string  strdirector_code      = string.Empty;
            string  strperson_code        = string.Empty;
            string  strperson_name        = string.Empty;
            string  strperson_manage_name = string.Empty;

            string strperson_work_status_code = string.Empty;

            strperson_group_code       = cboPerson_group.Text;
            strdirector_code           = cboDirector.SelectedValue;
            strunit_code               = cboUnit.SelectedValue;
            strperson_code             = txtperson_code.Text.Replace("'", "''").Trim();
            strperson_name             = txtperson_name.Text.Replace("'", "''").Trim();
            strperson_manage_name      = txtperson_manage_name.Text.Replace("'", "''").Trim();
            strperson_work_status_code = cboPerson_work_status.SelectedValue;

            if (!strYear.Equals(""))
            {
                strCriteria = strCriteria + "  And  (budget_plan_year = '" + strYear + "') ";
            }

            if (!strperson_group_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_group_code like '%" + strperson_group_code + "%') ";
            }

            if (!strdirector_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (director_code = '" + strdirector_code + "') ";
            }

            if (!strunit_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (unit_code= '" + strunit_code + "') ";
            }

            if (!strperson_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_code= '" + strperson_code + "') ";
            }

            if (!strperson_manage_name.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_manage_name like '%" + strperson_manage_name + "%') ";
            }


            if (!strperson_name.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_thai_name like '%" + strperson_name + "%'  " +
                              "  OR person_thai_surname like '%" + strperson_name + "%'  " +
                              "  OR person_eng_name like '%" + strperson_name + "%'  " +
                              "  OR person_eng_surname like '%" + strperson_name + "%'" +
                              "  OR '" + strperson_name + "' like ('%'+person_thai_name+'%'+person_thai_surname+'%')) ";
            }

            if (!strperson_work_status_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_work_status_code= '" + strperson_work_status_code + "') ";
            }

            if (RadioActive.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='Y') ";
            }
            else if (RadioCancel.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='N') ";
            }

            //strCriteria += " and person_group_code IN (" + PersonGroupList + ") ";
            //if (DirectorLock == "Y")
            //{
            //    strCriteria += " and substring(director_code,4,2) = substring('" + DirectorCode + "',4,2) ";
            //}


            try
            {
                if (!oPerson.SP_PERSON_LIST_SEL(strCriteria, ref ds, ref strMessage))
                {
                    lblError.Text = strMessage;
                }
                else
                {
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        string strScript = string.Empty;
                        strperson_code = ds.Tables[0].Rows[0]["person_code"].ToString();
                        strperson_name = ds.Tables[0].Rows[0]["person_thai_name"].ToString() + " " + ds.Tables[0].Rows[0]["person_thai_surname"].ToString();

                        if (!ViewState["show"].ToString().Equals("1"))
                        {
                            strScript = "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl1"].ToString() + "').value='" + strperson_code + "';\n " +
                                        "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl2"].ToString() + "').value='" + strperson_name + "';\n" +
                                        "ClosePopUp('" + ViewState["show"].ToString() + "');";
                        }
                        else
                        {
                            strScript = "window.parent.document.getElementById('" + ViewState["ctrl1"].ToString() + "').value='" + strperson_code + "';\n " +
                                        "window.parent.document.getElementById('" + ViewState["ctrl2"].ToString() + "').value='" + strperson_name + "';\n" +
                                        "ClosePopUp('" + ViewState["show"].ToString() + "');";
                        }
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "close", strScript, true);
                    }
                    else
                    {
                        ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"];
                        GridView1.DataSource          = ds.Tables[0];
                        GridView1.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message.ToString();
            }
            finally
            {
                oPerson.Dispose();
                ds.Dispose();
            }
        }
예제 #7
0
        private void BindGridView(int nPageNo)
        {
            InitcboYear();
            InitcboWork_status();
            InitcboPerson_group();
            //InitcboDirector();
            // InitcboUnit();
            cPerson oPerson                    = new cPerson();
            DataSet ds                         = new DataSet();
            string  strMessage                 = string.Empty;
            string  strCriteria                = string.Empty;
            string  strYear                    = string.Empty;
            string  strActive                  = string.Empty;
            string  strperson_group_code       = string.Empty;
            string  strperson_group_name       = string.Empty;
            string  strdirector_code           = string.Empty;
            string  strunit_code               = string.Empty;
            string  strperson_code             = string.Empty;
            string  strperson_name             = string.Empty;
            string  strperson_work_status_code = string.Empty;

            strperson_group_code       = cboPerson_group.SelectedValue;
            strdirector_code           = cboDirector.SelectedValue;
            strunit_code               = cboUnit.SelectedValue;
            strperson_work_status_code = cboPerson_work_status.SelectedValue;
            strYear        = cboYear.SelectedValue;
            strperson_code = txtperson_code.Text.Replace("'", "''").Trim();
            strperson_name = txtperson_name.Text.Replace("'", "''").Trim();
            if (Request.Form[strPrefixCtr + "cboPerson_work_status"] != null)
            {
                strperson_work_status_code = Request.Form[strPrefixCtr + "cboPerson_work_status"].ToString();
            }

            //if (!strYear.Equals(""))
            //{
            //    strCriteria = strCriteria + "  And  (budget_plan_year = '" + strYear + "') ";
            //}

            if (!strperson_group_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_group_code like '%" + strperson_group_code + "%') ";
            }

            if (!strdirector_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (director_code = '" + strdirector_code + "') ";
            }

            if (!strunit_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (unit_code= '" + strunit_code + "') ";
            }

            if (!strperson_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_code= '" + strperson_code + "') ";
            }

            if (!strperson_name.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_thai_name like '%" + strperson_name + "%'  " +
                              "  OR person_thai_surname like '%" + strperson_name + "%'  " +
                              "  OR person_eng_name like '%" + strperson_name + "%'  " +
                              "  OR person_eng_surname like '%" + strperson_name + "%')";
            }

            if (!strperson_work_status_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_work_status_code= '" + strperson_work_status_code + "') ";
            }

            if (RadioActive.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='Y') ";
            }
            else if (RadioCancel.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='N') ";
            }
            strCriteria += " and person_group_code IN (" + PersonGroupList + ",'') ";
            if (DirectorLock == "Y")
            {
                strCriteria += " and substring(director_code,4,2) = substring('" + DirectorCode + "',4,2) ";
            }
            try
            {
                if (!oPerson.SP_PERSON_LIST_SEL(strCriteria, ref ds, ref strMessage))
                {
                    lblError.Text = strMessage;
                }
                else
                {
                    try
                    {
                        GridView1.PageIndex           = nPageNo;
                        txthTotalRecord.Value         = ds.Tables[0].Rows.Count.ToString();
                        ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"];
                        GridView1.DataSource          = ds.Tables[0];
                        GridView1.DataBind();
                    }
                    catch
                    {
                        GridView1.PageIndex           = 0;
                        txthTotalRecord.Value         = ds.Tables[0].Rows.Count.ToString();
                        ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"];
                        GridView1.DataSource          = ds.Tables[0];
                        GridView1.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message.ToString();
            }
            finally
            {
                oPerson.Dispose();
                ds.Dispose();
                if (GridView1.Rows.Count > 0)
                {
                    GridView1.TopPagerRow.Visible = true;
                }
            }
        }
예제 #8
0
        private void BindGridView()
        {
            InitcboWork_status();
            InitcboPerson_group();

            cPerson oPerson                    = new cPerson();
            DataSet ds                         = new DataSet();
            string  strMessage                 = string.Empty;
            string  strCriteria                = string.Empty;
            string  strYear                    = string.Empty;
            string  strActive                  = string.Empty;
            string  strperson_group_code       = string.Empty;
            string  strperson_group_name       = string.Empty;
            string  strmajor_code              = string.Empty;
            string  strperson_code             = string.Empty;
            string  strperson_name             = string.Empty;
            string  strperson_work_status_code = string.Empty;

            strperson_group_code       = cboPerson_group.Text;
            strmajor_code              = cboMajor.SelectedValue;
            strperson_code             = txtperson_code.Text.Replace("'", "''").Trim();
            strperson_name             = txtperson_name.Text.Replace("'", "''").Trim();
            strperson_work_status_code = cboPerson_work_status.SelectedValue;

            if (!strYear.Equals(""))
            {
                strCriteria = strCriteria + "  And  (budget_plan_year = '" + strYear + "') ";
            }

            if (!strperson_group_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_group_code like '%" + strperson_group_code + "%') ";
            }


            if (!strmajor_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (major_code= '" + strmajor_code + "') ";
            }

            if (!strperson_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_code= '" + strperson_code + "') ";
            }

            if (!strperson_name.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_thai_name like '%" + strperson_name + "%'  " +
                              "  OR person_thai_surname like '%" + strperson_name + "%'  " +
                              "  OR (person_thai_surname + ' ' +person_eng_surname) like '%" + strperson_name + "%')";
            }

            if (!strperson_work_status_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_work_status_code= '" + strperson_work_status_code + "') ";
            }

            if (RadioActive.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='Y') ";
            }
            else if (RadioCancel.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='N') ";
            }

            strCriteria += " and person_group_code IN (" + PersonGroupList + ") ";


            if (DirectorLock == "Y")
            {
                strCriteria += " and substring(director_code,4,2) = substring('" + DirectorCode + "',4,2) ";
            }



            try
            {
                if (!oPerson.SP_PERSON_LIST_SEL(strCriteria, ref ds, ref strMessage))
                {
                    lblError.Text = strMessage;
                }
                else
                {
                    ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"];
                    GridView1.DataSource          = ds.Tables[0];
                    GridView1.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message.ToString();
            }
            finally
            {
                oPerson.Dispose();
                ds.Dispose();
            }
        }
예제 #9
0
        private void GotoUserMode(string user_group_code)
        {
            //if (user_group_code == "001")
            //{
            //    if (SetPersonUserProfile(txtUser.Text, ref _strMessage))
            //    {
            //        Response.Redirect("Menu_control.aspx");
            //    }
            //}
            //else
            //{
            cUser_group objUserGroup = new cUser_group();
            DataTable   dt           = new DataTable();
            DataSet     ds           = new DataSet();
            string      strCriteria  = " and user_group_code = '" + user_group_code + "' ";
            string      strMessage   = string.Empty;

            objUserGroup.sp_USER_GROUP_SEL(strCriteria, ref ds, ref strMessage);
            dt = ds.Tables[0];
            if (dt.Rows.Count > 0)
            {
                this.IsLogin      = "******";
                this.DirectorLock = Helper.CStr(dt.Rows[0]["director_lock"]);

                try
                {
                    this.UnitLock = Helper.CStr(dt.Rows[0]["unit_lock"]);
                }
                catch
                {
                    this.UnitLock = "N";
                }

                if (this.UnitLock == "Y")
                {
                    this.UnitCodeList = string.Empty;
                    string[] strunit_code_list = Helper.CStr(dt.Rows[0]["unit_code_list"]).Split(',');
                    for (int i = 0; i <= (strunit_code_list.GetUpperBound(0)); i++)
                    {
                        this.UnitCodeList += "'" + strunit_code_list[i].Substring(3, 5) + "',";
                    }
                    this.UnitCodeList = this.UnitCodeList.Substring(0, this.UnitCodeList.Length - 1);
                }

                string[] strperson_group_list = Helper.CStr(dt.Rows[0]["person_group_list"]).Split(',');
                for (int i = 0; i <= (strperson_group_list.GetUpperBound(0)); i++)
                {
                    PersonGroupList = PersonGroupList + "'" + strperson_group_list[i] + "',";
                }

                PersonGroupList = PersonGroupList.Substring(0, PersonGroupList.Length - 1);



                cPerson objPerson = new cPerson();
                strCriteria = " And person_code='" + this.PersonCode + "' ";
                objPerson.SP_PERSON_LIST_SEL(strCriteria, ref ds, ref strMessage);
                dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    this.UserLoginName = Helper.CStr(dt.Rows[0]["person_thai_name"]) + "  "
                                         + Helper.CStr(dt.Rows[0]["person_thai_surname"]);
                    this.DirectorCode   = Helper.CStr(dt.Rows[0]["director_code"]);
                    this.DirectorName   = Helper.CStr(dt.Rows[0]["director_name"]);
                    Session["username"] = Helper.CStr(dt.Rows[0]["person_thai_name"]) + "  "
                                          + Helper.CStr(dt.Rows[0]["person_thai_surname"]);
                }



                Response.Redirect("Menu_control.aspx");
            }
            // }
        }