Ejemplo n.º 1
0
        private void InitcboUser_group()
        {
            cUser_group oUser_group        = new cUser_group();
            string      strMessage         = string.Empty,
                        strCriteria        = string.Empty,
                        struser_group_code = string.Empty;

            struser_group_code = cbouser_group.SelectedValue;
            int       i;
            DataSet   ds = new DataSet();
            DataTable dt = new DataTable();

            strCriteria = " and c_active='Y' ";
            if (oUser_group.sp_USER_GROUP_SEL(strCriteria, ref ds, ref strMessage))
            {
                dt = ds.Tables[0];
                cbouser_group.Items.Clear();
                cbouser_group.Items.Add(new ListItem("---- เลือกข้อมูลทั้งหมด ----", ""));
                for (i = 0; i <= dt.Rows.Count - 1; i++)
                {
                    cbouser_group.Items.Add(new ListItem(dt.Rows[i]["user_group_name"].ToString(), dt.Rows[i]["user_group_code"].ToString()));
                }
                if (cbouser_group.Items.FindByValue(struser_group_code) != null)
                {
                    cbouser_group.SelectedIndex = -1;
                    cbouser_group.Items.FindByValue(struser_group_code).Selected = true;
                }
            }
        }
Ejemplo n.º 2
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");
            }
            // }
        }