// สถานะผู้ใช้งาน private void _loadAccountStatus() { List <Account_Level> list_data = new Account_Manager().listAccountLevel(); Account_status_DDL.Items.Add(new ListItem("ปกติ", "1")); Account_status_DDL.Items.Add(new ListItem("ห้ามใช้งานชั่วคราว", "2")); Account_status_DDL.Items.Add(new ListItem("ลาออก", "0")); Account_status_DDL.Items.Add(new ListItem("ไล่ออก", "3")); }
// สิทธิ์ในการใช้งาน private void _loadLevelAccess() { List <Account_Level> list_data = new Account_Manager().listAccountLevel(); for (int i = 0; i < list_data.Count; i++) { Account_Level data = list_data[i]; level_ChkBxL.Items.Add(new ListItem(data.level_name_TH + " ( " + data.level_name_ENG + " ) ", data.level_id.ToString())); } }
protected void Save_Btn_Click(object sender, EventArgs e) { string[] code = Request.Params["code"].Split('U'); string id = code[1]; Account_Login acc_lgn_edit = new Account_Login(); acc_lgn_edit.Account_id = id; acc_lgn_edit.Username_md = username_TBx.Text; acc_lgn_edit.Password_md = password_TBx.Text; acc_lgn_edit.acc_lv = new Account_Level(); acc_lgn_edit.acc_lv.level_id = level_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(level_DDL.SelectedValue); acc_lgn_edit.Account_Idcard = Account_Idcard_TBx.Text; acc_lgn_edit.Account_F_name = Account_F_name_TBx.Text; acc_lgn_edit.Account_N_Name = Account_N_Name_TBx.Text; acc_lgn_edit.Account_Address_pri = Account_Address_pri_TBx.Text; acc_lgn_edit.Account_Tel = Account_Tel_TBx.Text; acc_lgn_edit.Account_Email = Account_Email_TBx.Text; acc_lgn_edit.bs_cpn = new Base_Companys(); acc_lgn_edit.bs_cpn.Company_id = Company_DDL.SelectedIndex <= 0 ? 1 : Convert.ToInt32(Company_DDL.SelectedValue); acc_lgn_edit.Account_status = Convert.ToInt32(Account_status_DDL.SelectedValue); Account_Manager acc_mng = new Account_Manager(); if (acc_mng.editAccount(acc_lgn_edit)) { /// Acticity Logs System /// package_login = (Base_Companys)Session["Package"]; acc_lgn = (Account_Login)Session["Login"]; string message = Messages_Logs._messageLogsNormal(acc_lgn.Account_F_name, " แก้ไขข้อมูลผู้ใช้งาน : " + acc_lgn_edit.Account_F_name, acc_lgn.resu, package_login.Company_N_name); new Activity_Log_Manager().addActivityLogs(message, acc_lgn.Account_id, package_login.Company_id); /// Acticity Logs System Response.Redirect("/Form_Account/Account_Search"); } else { Alert_Danger_Panel.Visible = true; alert_header_danger_Lbl.Text = "แจ้งเตือน!!"; alert_danger_Lbl.Text = "กรุณาตรวจสอบ ข้อมูลอีกครั้ง"; Alert_Danger_Panel.Focus(); } }
private void _getMore(int current_page) { string username = (string)Session["username"]; string idcard = (string)Session["idcard"]; string name = (string)Session["name"]; string level_id_inline = (string)Session["level_id_inline"]; string Company_id_inline = (string)Session["company_id_inline"]; acc_lgn_mng = new Account_Manager(); if (current_page > 1) { int row_str = (current_page - 1) * 20; link_Previous.Enabled = true; List <Account_Login> list_acc = acc_lgn_mng.listAccount(username, name, idcard, level_id_inline, Company_id_inline, row_str, 20); Session["row_str"] = row_str; Session["List_Account"] = list_acc; } else { link_Previous.Enabled = false; List <Account_Login> list_acc = acc_lgn_mng.listAccount(username, name, idcard, level_id_inline, Company_id_inline, 0, 20); Session["row_str"] = 0; Session["List_Account"] = list_acc; } int max_page = (int)Session["max_page"]; if (current_page == max_page) { link_Next.Enabled = false; } }
/******************************************************************************************************************************************************************************* **************************************************** Search Leasing Method ******************************************************** **************************************************** ******************************************************** *******************************************************************************************************************************************************************************/ private void _getData() { string username = Username_md_TBx.Text; string idcard = Account_Idcard_TBx.Text; string name = Account_F_name_TBx.Text.Trim(' '); string level_id_inline = _getCheckedLevel(); string Company_id_inline = _getCheckedCompany(); if (!string.IsNullOrEmpty(username) || !string.IsNullOrEmpty(idcard) || !string.IsNullOrEmpty(name) || !string.IsNullOrEmpty(level_id_inline) || !string.IsNullOrEmpty(Company_id_inline)) { acc_lgn_mng = new Account_Manager(); List <Account_Login> list_acc_all = acc_lgn_mng.listAccount(username, name, idcard, level_id_inline, Company_id_inline, 0, 0); try { int row = list_acc_all.Count; _pageCount(row); List <Account_Login> list_acc = acc_lgn_mng.listAccount(username, name, idcard, level_id_inline, Company_id_inline, 0, 20); Session["username"] = username; Session["idcard"] = idcard; Session["name"] = name; Session["level_id_inline"] = level_id_inline; Session["company_id_inline"] = Company_id_inline; Session["row_str"] = 0; Session["List_Account"] = list_acc; } catch (Exception ex) { error = "Exception ==> Account_Search : Page --> _getData() "; Log_Error._writeErrorFile(error, ex); } } }
protected void btn_Login_Click(object sender, EventArgs e) { string pack = Request.Params["pack"]; string username = Username_TBx.Text; string password = Password_TBx.Text; Base_Companys package_login = new Base_Companys_Manager().getCompanypackage(pack); Account_Login acc_lgn = new Account_Manager().getLogin(username, password); if (acc_lgn.Account_status == 1 && package_login != null) { Alert_Warning_Panel.Visible = false; Session["Login"] = acc_lgn; Session["Package"] = package_login; /// Acticity Logs System /// string message = Messages_Logs._messageLogsAccess(acc_lgn.Account_F_name, acc_lgn.resu, package_login.Company_N_name, 1); new Activity_Log_Manager().addActivityLogs(message, acc_lgn.Account_id, package_login.Company_id); /// Acticity Logs System Response.Redirect("/Form_Main/Main_JKL_Form"); } else if (acc_lgn.Account_status == 2) { alert_danger_Lbl.Visible = true; alert_danger_Lbl.Text = " ** ชื่อผู้ใช้งาน ' " + username + " ' ถูกระงับการใช้งานชั่วคราว กรุณาติดต่อเจ้าหน้าที่ฝ่าย IT ** "; /// Acticity Logs System /// string message = Messages_Logs._messageLogsWarning(acc_lgn.Account_F_name, "ตรวจพบการเข้าใช้งานระบบ ในขณะ ถูกระงับการใช้งานชั่วคราว", username, package_login.Company_N_name); new Activity_Log_Manager().addActivityLogs(message, acc_lgn.Account_id, package_login.Company_id); /// Acticity Logs System } else if (acc_lgn.Account_status == 3) { alert_danger_Lbl.Visible = true; alert_danger_Lbl.Text = " ** ชื่อผู้ใช้งาน ' " + username + " ' ถูกระงับการใช้งานถาวร เนื่องจากพ้นสภาพพนักงาน ** "; /// Acticity Logs System /// string message = Messages_Logs._messageLogsWarning(acc_lgn.Account_F_name, "ตรวจพบการเข้าใช้งานระบบ ในขณะ ถูกระงับการใช้งานถาวร", username, package_login.Company_N_name); new Activity_Log_Manager().addActivityLogs(message, acc_lgn.Account_id, package_login.Company_id); /// Acticity Logs System } else { alert_danger_Lbl.Visible = true; alert_danger_Lbl.Text = "** ไม่พบข้อมูลผู้ใช้งาน หรือ ชื่อผู้ใช้งาน (Username) หรือ รหัสผ่านไม่ถูกต้อง (Password) กรุณาตรวจสอบ **"; /// Acticity Logs System /// string message = Messages_Logs._messageLogsWarning(acc_lgn.Account_F_name, "ตรวจพบการเข้าใช้งานระบบโดยใช้ ชื่อผู้ใช้งาน หรือรหัสผ่าน ไม่ตามที่กำหนด", username, package_login.Company_N_name); new Activity_Log_Manager().addActivityLogs(message, acc_lgn.Account_id, package_login.Company_id); /// Acticity Logs System } }