/// <summary> /// Table USERS_FACULTY_AUTHORIZED /// </summary> /// <param name="dataInsert"></param> /// <returns></returns> public string insertFacultyAuthorized(UserAuthorizedData dataInsert) { string response = ""; UserLoginData loginData = new UserLoginData(); loginData = (UserLoginData)HttpContext.Current.Session["login_data"]; LogData log_data = new LogData(); log_data.ModuleCode = new LogData().Module_Setting; log_data.Username = loginData.User_ID; log_data.Message = "Insert FacultyAuthorized with: " + dataInsert.Faculty_Authorized_User_Id + ", " + dataInsert.Faculty_Authorized_Faculty_Code + ", " + dataInsert.Faculty_Authorized_Allow_Status; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = ""; sql = "Insert Into USERS_FACULTY_AUTHORIZED (USER_ID, FACULTY_CODE, ALLOW_STATUS) Values ('" + dataInsert.Faculty_Authorized_User_Id + "','" + dataInsert.Faculty_Authorized_Faculty_Code + "','" + dataInsert.Faculty_Authorized_Allow_Status + "')"; oracleObj.InsertCommand = sql; try { if (oracleObj.Insert() == 1) { response = "OK"; log_data.StatusCode = log_data.LogStatus_SUCCESS; } else { log_data.StatusCode = log_data.LogStatus_FAILED; } } catch (Exception e) { response = e.Message.ToString() + " "; log_data.StatusCode = log_data.LogStatus_ERROR; log_data.Message += " [" + e.ToString() + "]"; } new Log().WriteLog(log_data); return(response); }
/// <summary> /// Table USERS_OTHER_AUTHORIZED /// </summary> /// <param name="User_Id"></param> /// <returns></returns> public UserAuthorizedData getOtherAuthorized(string User_Id) { UserAuthorizedData data = new UserAuthorizedData(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = "Select * From USERS_OTHER_AUTHORIZED Where USER_ID='" + User_Id + "'"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { data.Other_Authorized_User_Id = rowData["USER_ID"].ToString(); data.Other_Authorized_Other_Code = rowData["OTHEROFFICE_CODE"].ToString(); data.Other_Authorized_Allow_Status = rowData["ALLOW_STATUS"].ToString(); } return(data); }
/// <summary> /// Table USERS_OTHER_AUTHORIZED /// </summary> /// <param name="updateData"></param> /// <returns></returns> public string updateOtherAuthorized(UserAuthorizedData updateData) { string response = ""; UserLoginData loginData = new UserLoginData(); loginData = (UserLoginData)HttpContext.Current.Session["login_data"]; LogData log_data = new LogData(); log_data.ModuleCode = new LogData().Module_Setting; log_data.Username = loginData.User_ID; log_data.Message = "Update OtherAuthorized with: " + updateData.Other_Authorized_Other_Code + ", " + updateData.Other_Authorized_Allow_Status + ", " + updateData.Other_Authorized_User_Id; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "UPDATE USERS_OTHER_AUTHORIZED SET OTHEROFFICE_CODE = '" + updateData.Other_Authorized_Other_Code + "', ALLOW_STATUS = '" + updateData.Other_Authorized_Allow_Status + "' WHERE USER_ID = '" + updateData.Other_Authorized_User_Id + "'"; oracleObj.UpdateCommand = sql; try { if (oracleObj.Update() == 1) { response = "OK"; log_data.StatusCode = log_data.LogStatus_SUCCESS; } else { log_data.StatusCode = log_data.LogStatus_FAILED; } } catch (Exception e) { response = e.Message.ToString() + " "; log_data.StatusCode = log_data.LogStatus_ERROR; log_data.Message += " [" + e.ToString() + "]"; } new Log().WriteLog(log_data); return(response); }
/// <summary> /// Table USERS_FACULTY_AUTHORIZED /// </summary> /// <param name="sql"></param> /// <returns></returns> public List <UserAuthorizedData> getFacultyAuthorizedManual(string sql) { List <UserAuthorizedData> data = new List <UserAuthorizedData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { UserAuthorizedData users = new UserAuthorizedData(); users.Faculty_Authorized_User_Id = rowData["USER_ID"].ToString(); users.Faculty_Authorized_Faculty_Code = rowData["FACULTY_CODE"].ToString(); users.Faculty_Authorized_Allow_Status = rowData["ALLOW_STATUS"].ToString(); data.Add(users); } return(data); }
/// <summary> /// Table USERS_OTHER_AUTHORIZED /// </summary> /// <returns></returns> public List <UserAuthorizedData> getOtherAuthorized() { List <UserAuthorizedData> data = new List <UserAuthorizedData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = "Select * From USERS_OTHER_AUTHORIZED Order By USER_ID"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { UserAuthorizedData users = new UserAuthorizedData(); users.Other_Authorized_User_Id = rowData["USER_ID"].ToString(); users.Other_Authorized_Other_Code = rowData["OTHEROFFICE_CODE"].ToString(); users.Other_Authorized_Allow_Status = rowData["ALLOW_STATUS"].ToString(); data.Add(users); } return(data); }
protected void btnSAVE_Click(object sender, EventArgs e) { string password = getMD5(txtPassword.Text); string confirm = getMD5(txtPasswordConfirm.Text); if (password == confirm) { UsersInfo userInfo = new UsersInfo(); userInfo.USERS_INFO_USER_ID = txtUserName.Text; userInfo.USERS_INFO_NATIONAL_ID = txtNationId.Text; userInfo.USERS_INFO_OFFICIAL_ID = txtOfficId.Text; userInfo.USERS_INFO_TITLE_THAINAME = ddlTitleThai.SelectedValue; userInfo.USERS_INFO_FIRST_THAINAME = txtNameThai.Text; userInfo.USERS_INFO_FAMILY_THAINAME = txtLnameThai.Text; userInfo.USERS_INFO_TITLE_ENGNAME = ddlTitleEng.SelectedValue; userInfo.USERS_INFO_FIRST_ENGNAME = txtNameEng.Text; userInfo.USERS_INFO_FAMILY_ENGNAME = txtLnameEng.Text; userInfo.USERS_INFO_FACULTY_ID = ddlFaculty.SelectedValue; userInfo.USERS_INFO_DEPARTMENT_ID = ddlDepartment.SelectedValue; userInfo.USERS_INFO_INTERNAL_PHONE = txtIntNumber.Text; userInfo.USERS_INFO_EXTERNAL_PHONE = txtExtNumber.Text; userInfo.OTHEROFFICE_CODE = ddlOffice.SelectedValue; userInfo.STATUS = "0001"; //0001 เปิดใช้งาน userInfo.PASSWORD = password; int userDup = new UsersInfo().getCountUsers(userInfo.USERS_INFO_USER_ID); if (userDup > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('Username ซ้ำ!');", true); } else { string result = new UsersInfo().insertUsers(userInfo); //User คณะ if (userInfo.USERS_INFO_FACULTY_ID != "00" && userInfo.USERS_INFO_DEPARTMENT_ID == "0000" && userInfo.OTHEROFFICE_CODE == "0000") { UserAuthorizedData userFaculty = new UserAuthorizedData(); userFaculty.Faculty_Authorized_User_Id = userInfo.USERS_INFO_USER_ID; userFaculty.Faculty_Authorized_Faculty_Code = userInfo.USERS_INFO_FACULTY_ID; //0001 เปิดใช้งาน //0002 ไม่ใช้งาน userFaculty.Faculty_Authorized_Allow_Status = "0001"; //Check Duplicate string sqlUserFaculty = "Select * From USERS_FACULTY_AUTHORIZED Where USER_ID='" + userFaculty.Faculty_Authorized_User_Id + "' And FACULTY_CODE='" + userFaculty.Faculty_Authorized_Faculty_Code + "'"; List <UserAuthorizedData> chkuserFaculty = new UserAuthorized().getFacultyAuthorizedManual(sqlUserFaculty); if (chkuserFaculty.Count > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('Username ที่คณะ ซ้ำ!');", true); } else { //Insert ระดับคณะ string insertUserFaculty = new UserAuthorized().insertFacultyAuthorized(userFaculty); } } //User ภาควิชา else if (userInfo.USERS_INFO_FACULTY_ID != "00" && userInfo.USERS_INFO_DEPARTMENT_ID != "0000" && userInfo.OTHEROFFICE_CODE == "0000") { UserAuthorizedData userFaculty = new UserAuthorizedData(); userFaculty.Faculty_Authorized_User_Id = userInfo.USERS_INFO_USER_ID; userFaculty.Faculty_Authorized_Faculty_Code = userInfo.USERS_INFO_FACULTY_ID; //0001 เปิดใช้งาน //0002 ไม่ใช้งาน userFaculty.Faculty_Authorized_Allow_Status = "0001"; //Check Duplicate string sqlUserFaculty = "Select * From USERS_FACULTY_AUTHORIZED Where USER_ID='" + userFaculty.Faculty_Authorized_User_Id + "' And FACULTY_CODE='" + userFaculty.Faculty_Authorized_Faculty_Code + "'"; List <UserAuthorizedData> chkuserFaculty = new UserAuthorized().getFacultyAuthorizedManual(sqlUserFaculty); if (chkuserFaculty.Count > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('Username ที่คณะ ซ้ำ!');", true); } else { //Insert ระดับคณะ string insertUserFaculty = new UserAuthorized().insertFacultyAuthorized(userFaculty); } UserAuthorizedData userDepartment = new UserAuthorizedData(); userDepartment.Department_Authorized_User_Id = userInfo.USERS_INFO_USER_ID; userDepartment.Department_Authorized_Department_Code = userInfo.USERS_INFO_DEPARTMENT_ID; //0001 เปิดใช้งาน //0002 ไม่ใช้งาน userDepartment.Department_Authorized_Allow_Status = "0001"; //Check Duplicate string sqlUserDepartment = "Select * From USERS_DEPARTMENT_AUTHORIZED Where USER_ID='" + userDepartment.Department_Authorized_User_Id + "' And DEPARTMENT_CODE='" + userDepartment.Department_Authorized_Department_Code + "'"; List <UserAuthorizedData> chkuserDepartment = new UserAuthorized().getDepartmentAuthorizedManual(sqlUserDepartment); if (chkuserDepartment.Count > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('Username ที่ภาควิชา ซ้ำ!');", true); } else { //Insert ระดับภาควิชา string insertUserDepartment = new UserAuthorized().insertDepartmentAuthorized(userDepartment); } } //User สำนักงาน else if (userInfo.USERS_INFO_FACULTY_ID == "00" && userInfo.USERS_INFO_DEPARTMENT_ID == "0000" && userInfo.OTHEROFFICE_CODE != "0000") { UserAuthorizedData userOtherOffice = new UserAuthorizedData(); userOtherOffice.Other_Authorized_User_Id = userInfo.USERS_INFO_USER_ID; userOtherOffice.Other_Authorized_Other_Code = userInfo.OTHEROFFICE_CODE; //0001 เปิดใช้งาน //0002 ไม่ใช้งาน userOtherOffice.Other_Authorized_Allow_Status = "0001"; //Check Duplicate string sqlUserOffice = "Select * From USERS_OTHER_AUTHORIZED Where USER_ID='" + userOtherOffice.Other_Authorized_User_Id + "' And OTHEROFFICE_CODE='" + userOtherOffice.Other_Authorized_Other_Code + "'"; List <UserAuthorizedData> chkuserOffice = new UserAuthorized().getOtherAuthorizedManual(sqlUserOffice); if (chkuserOffice.Count > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('Username ที่สำนักงาน ซ้ำ!');", true); } else { //Insert ระดับสำนักงาน string insertUserOffice = new UserAuthorized().insertOtherAuthorized(userOtherOffice); } } Response.Redirect("list_User.aspx"); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('ตรวจสอบ Password อีกครั้ง!');", true); } }
protected void btnSave_Click(object sender, EventArgs e) { //if (autro_obj.CheckGroupUser(login_data, group_var.admin_university)) // { // //User คณะ // if (ddlFaculty.SelectedValue != "00" && ddlDepartment.SelectedValue == "0000" && ddlOffice.SelectedValue == "0000") // { // UserAuthorizedData userFaculty = new UserAuthorizedData(); // userFaculty.Faculty_Authorized_User_Id = userData.USERS_INFO_USER_ID; // userFaculty.Faculty_Authorized_Faculty_Code = ddlFaculty.SelectedValue; // //0001 เปิดใช้งาน // //0002 ไม่ใช้งาน // userFaculty.Faculty_Authorized_Allow_Status = "0001"; // //Check Duplicate // string sqlUserFaculty = "Select * From USERS_FACULTY_AUTHORIZED Where USER_ID='" + userFaculty.Faculty_Authorized_User_Id + "' And FACULTY_CODE='" + userFaculty.Faculty_Authorized_Faculty_Code + "'"; // List<UserAuthorizedData> chkuserFaculty = new UserAuthorized().getFacultyAuthorizedManual(sqlUserFaculty); // if (chkuserFaculty.Count > 0) // { // Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('Username ที่คณะ ซ้ำ!');", true); // } // else // { // //Insert ระดับคณะ // string insertUserFaculty = new UserAuthorized().insertFacultyAuthorized(userFaculty); // } // } // //User ภาควิชา // else if (ddlFaculty.SelectedValue != "00" && ddlDepartment.SelectedValue != "0000" && ddlOffice.SelectedValue == "0000") // { // UserAuthorizedData userFaculty = new UserAuthorizedData(); // userFaculty.Faculty_Authorized_User_Id = userData.USERS_INFO_USER_ID; // userFaculty.Faculty_Authorized_Faculty_Code = ddlFaculty.SelectedValue; // //0001 เปิดใช้งาน // //0002 ไม่ใช้งาน // userFaculty.Faculty_Authorized_Allow_Status = "0001"; // //Check Duplicate // string sqlUserFaculty = "Select * From USERS_FACULTY_AUTHORIZED Where USER_ID='" + userFaculty.Faculty_Authorized_User_Id + "' And FACULTY_CODE='" + userFaculty.Faculty_Authorized_Faculty_Code + "'"; // List<UserAuthorizedData> chkuserFaculty = new UserAuthorized().getFacultyAuthorizedManual(sqlUserFaculty); // if (chkuserFaculty.Count > 0) // { // Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('Username ที่คณะ ซ้ำ!');", true); // } // else // { // //Insert ระดับคณะ // string insertUserFaculty = new UserAuthorized().insertFacultyAuthorized(userFaculty); // } // UserAuthorizedData userDepartment = new UserAuthorizedData(); // userDepartment.Department_Authorized_User_Id = userData.USERS_INFO_USER_ID; // userDepartment.Department_Authorized_Department_Code = ddlDepartment.SelectedValue; // //0001 เปิดใช้งาน // //0002 ไม่ใช้งาน // userDepartment.Department_Authorized_Allow_Status = "0001"; // //Check Duplicate // string sqlUserDepartment = "Select * From USERS_DEPARTMENT_AUTHORIZED Where USER_ID='" + userDepartment.Department_Authorized_User_Id + "' And DEPARTMENT_CODE='" + userDepartment.Department_Authorized_Department_Code + "'"; // List<UserAuthorizedData> chkuserDepartment = new UserAuthorized().getDepartmentAuthorizedManual(sqlUserDepartment); // if (chkuserDepartment.Count > 0) // { // Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('Username ที่ภาควิชา ซ้ำ!');", true); // } // else // { // //Insert ระดับภาควิชา // string insertUserDepartment = new UserAuthorized().insertDepartmentAuthorized(userDepartment); // } // } // // office // else if (ddlOffice.SelectedValue != "0000") // { // UserAuthorizedData userOtherOffice = new UserAuthorizedData(); // userOtherOffice.Other_Authorized_User_Id = userData.USERS_INFO_USER_ID; // userOtherOffice.Other_Authorized_Other_Code = ddlOffice.SelectedValue; // //0001 เปิดใช้งาน // //0002 ไม่ใช้งาน // userOtherOffice.Other_Authorized_Allow_Status = "0001"; // //Check Duplicate // string sqlUserOffice = "Select * From USERS_OTHER_AUTHORIZED Where USER_ID='" + userOtherOffice.Other_Authorized_User_Id + "' And OTHEROFFICE_CODE='" + userOtherOffice.Other_Authorized_Other_Code + "'"; // List<UserAuthorizedData> chkuserOffice = new UserAuthorized().getOtherAuthorizedManual(sqlUserOffice); // if (chkuserOffice.Count > 0) // { // Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('Username ที่สำนักงาน ซ้ำ!');", true); // } // else // { // //Insert ระดับสำนักงาน // string insertUserOffice = new UserAuthorized().insertOtherAuthorized(userOtherOffice); // } // } // } if (autro_obj.CheckGroupUser(login_data, group_var.admin_faculty)) { //User คณะ if (ddlFaculty.SelectedValue != "00" && ddlDepartment.SelectedValue == "0000") { UserAuthorizedData userFaculty = new UserAuthorizedData(); userFaculty.Faculty_Authorized_User_Id = userData.USERS_INFO_USER_ID; userFaculty.Faculty_Authorized_Faculty_Code = ddlFaculty.SelectedValue; //0001 เปิดใช้งาน //0002 ไม่ใช้งาน userFaculty.Faculty_Authorized_Allow_Status = "0001"; //Check Duplicate string sqlUserFaculty = "Select * From USERS_FACULTY_AUTHORIZED Where USER_ID='" + userFaculty.Faculty_Authorized_User_Id + "' And FACULTY_CODE='" + userFaculty.Faculty_Authorized_Faculty_Code + "'"; List <UserAuthorizedData> chkuserFaculty = new UserAuthorized().getFacultyAuthorizedManual(sqlUserFaculty); if (chkuserFaculty.Count > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('Username ที่คณะ ซ้ำ!');", true); } else { //Insert ระดับคณะ string insertUserFaculty = new UserAuthorized().insertFacultyAuthorized(userFaculty); } } //User ภาควิชา else if (ddlFaculty.SelectedValue != "00" && ddlDepartment.SelectedValue != "0000") { UserAuthorizedData userFaculty = new UserAuthorizedData(); userFaculty.Faculty_Authorized_User_Id = userData.USERS_INFO_USER_ID; userFaculty.Faculty_Authorized_Faculty_Code = ddlFaculty.SelectedValue; //0001 เปิดใช้งาน //0002 ไม่ใช้งาน userFaculty.Faculty_Authorized_Allow_Status = "0001"; //Check Duplicate string sqlUserFaculty = "Select * From USERS_FACULTY_AUTHORIZED Where USER_ID='" + userFaculty.Faculty_Authorized_User_Id + "' And FACULTY_CODE='" + userFaculty.Faculty_Authorized_Faculty_Code + "'"; List <UserAuthorizedData> chkuserFaculty = new UserAuthorized().getFacultyAuthorizedManual(sqlUserFaculty); if (chkuserFaculty.Count > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('Username ที่คณะ ซ้ำ!');", true); } else { //Insert ระดับคณะ string insertUserFaculty = new UserAuthorized().insertFacultyAuthorized(userFaculty); } UserAuthorizedData userDepartment = new UserAuthorizedData(); userDepartment.Department_Authorized_User_Id = userData.USERS_INFO_USER_ID; userDepartment.Department_Authorized_Department_Code = ddlDepartment.SelectedValue; //0001 เปิดใช้งาน //0002 ไม่ใช้งาน userDepartment.Department_Authorized_Allow_Status = "0001"; //Check Duplicate string sqlUserDepartment = "Select * From USERS_DEPARTMENT_AUTHORIZED Where USER_ID='" + userDepartment.Department_Authorized_User_Id + "' And DEPARTMENT_CODE='" + userDepartment.Department_Authorized_Department_Code + "'"; List <UserAuthorizedData> chkuserDepartment = new UserAuthorized().getDepartmentAuthorizedManual(sqlUserDepartment); if (chkuserDepartment.Count > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('Username ที่ภาควิชา ซ้ำ!');", true); } else { //Insert ระดับภาควิชา string insertUserDepartment = new UserAuthorized().insertDepartmentAuthorized(userDepartment); } } } //else if (autro_obj.CheckGroupUser(login_data, group_var.admin_department)) // { // //User ภาควิชา // if (ddlFaculty.SelectedValue != "00" && ddlDepartment.SelectedValue != "0000" ) // { // UserAuthorizedData userFaculty = new UserAuthorizedData(); // userFaculty.Faculty_Authorized_User_Id = userData.USERS_INFO_USER_ID; // userFaculty.Faculty_Authorized_Faculty_Code = ddlFaculty.SelectedValue; // //0001 เปิดใช้งาน // //0002 ไม่ใช้งาน // userFaculty.Faculty_Authorized_Allow_Status = "0001"; // //Check Duplicate // string sqlUserFaculty = "Select * From USERS_FACULTY_AUTHORIZED Where USER_ID='" + userFaculty.Faculty_Authorized_User_Id + "' And FACULTY_CODE='" + userFaculty.Faculty_Authorized_Faculty_Code + "'"; // List<UserAuthorizedData> chkuserFaculty = new UserAuthorized().getFacultyAuthorizedManual(sqlUserFaculty); // if (chkuserFaculty.Count > 0) // { // Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('Username ที่คณะ ซ้ำ!');", true); // } // else // { // //Insert ระดับคณะ // string insertUserFaculty = new UserAuthorized().insertFacultyAuthorized(userFaculty); // } // UserAuthorizedData userDepartment = new UserAuthorizedData(); // userDepartment.Department_Authorized_User_Id = userData.USERS_INFO_USER_ID; // userDepartment.Department_Authorized_Department_Code = ddlDepartment.SelectedValue; // //0001 เปิดใช้งาน // //0002 ไม่ใช้งาน // userDepartment.Department_Authorized_Allow_Status = "0001"; // //Check Duplicate // string sqlUserDepartment = "Select * From USERS_DEPARTMENT_AUTHORIZED Where USER_ID='" + userDepartment.Department_Authorized_User_Id + "' And DEPARTMENT_CODE='" + userDepartment.Department_Authorized_Department_Code + "'"; // List<UserAuthorizedData> chkuserDepartment = new UserAuthorized().getDepartmentAuthorizedManual(sqlUserDepartment); // if (chkuserDepartment.Count > 0) // { // Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('Username ที่ภาควิชา ซ้ำ!');", true); // } // else // { // //Insert ระดับภาควิชา // string insertUserDepartment = new UserAuthorized().insertDepartmentAuthorized(userDepartment); // } // } // } //else if (autro_obj.CheckGroupUser(login_data, group_var.admin_otherOffice)) // { // if (ddlOffice.SelectedValue != "0000") // { // UserAuthorizedData userOtherOffice = new UserAuthorizedData(); // userOtherOffice.Other_Authorized_User_Id = userData.USERS_INFO_USER_ID; // userOtherOffice.Other_Authorized_Other_Code = ddlOffice.SelectedValue; // //0001 เปิดใช้งาน // //0002 ไม่ใช้งาน // userOtherOffice.Other_Authorized_Allow_Status = "0001"; // //Check Duplicate // string sqlUserOffice = "Select * From USERS_OTHER_AUTHORIZED Where USER_ID='" + userOtherOffice.Other_Authorized_User_Id + "' And OTHEROFFICE_CODE='" + userOtherOffice.Other_Authorized_Other_Code + "'"; // List<UserAuthorizedData> chkuserOffice = new UserAuthorized().getOtherAuthorizedManual(sqlUserOffice); // if (chkuserOffice.Count > 0) // { // Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('Username ที่สำนักงาน ซ้ำ!');", true); // } // else // { // //Insert ระดับสำนักงาน // string insertUserOffice = new UserAuthorized().insertOtherAuthorized(userOtherOffice); // } // } // } Response.Redirect("list_User.aspx"); }