using ClientLib; using ClientLib.CommonService2; using DevExpress.XtraEditors; using PublicLib; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Net; using System.Reflection; using System.Text; using System.Threading; using System.Windows.Forms; namespace HANMI_STD { partial class CustUserManagerPopup : XtraForm { private string m_Type; public CustUserManagerPopup() { InitializeComponent(); m_Type = "I"; simpleButton_Cust_Search.Click += (sender, e) => { selectCustProc(); }; textEdit_CUST_NM.KeyPress += (sender, e) => { if (e.KeyChar == '\r') { selectCustProc(); } }; buttonEdit_POST_NO.ButtonClick += (sender, e) => { PostNoForm form = new PostNoForm(); if (form.ShowDialog() == DialogResult.Yes) { buttonEdit_POST_NO.Text = UtilClass.toStr(form.ResultRow["POST_NO"]); textEdit_ADDR1.Text = UtilClass.toStr(form.ResultRow["ADDR1"]); textEdit_BIZ_NO.Focus(); } }; simpleButton_Cancel.Click += (sender, e) => { this.DialogResult = DialogResult.Cancel; this.Close(); }; simpleButton_Yes.Click += (sender, e) => { try { this.Cursor = Cursors.WaitCursor; if (UtilClass.isNull(labelControl_CUST_CD.Text)) { textEdit_USR_ID.Focus(); throw new Exception("거래처명을 입력하십시오."); } if (UtilClass.isNull(textEdit_USR_ID.Text)) { textEdit_USR_ID.Focus(); throw new Exception("아이디를 입력하십시오."); } if (UtilClass.isNull(textEdit_USR_PWD.Text)) { textEdit_USR_PWD.Focus(); throw new Exception("패스워드를 입력하십시오."); } if (UtilClass.isNull(textEdit_USR_NM.Text)) { textEdit_USR_NM.Focus(); throw new Exception("사용자명을 입력하십시오."); } SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("TYPE", SqlDbType.NVarChar, m_Type), ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar, labelControl_CUST_CD.Text), ClientClass.CreateSqlParameter("USR_ID", SqlDbType.NVarChar, textEdit_USR_ID.Text), ClientClass.CreateSqlParameter("USR_NM", SqlDbType.NVarChar, textEdit_USR_NM.Text), ClientClass.CreateSqlParameter("USR_PWD", SqlDbType.NVarChar, textEdit_USR_PWD.Text), ClientClass.CreateSqlParameter("TEL_NO", SqlDbType.NVarChar, textEdit_TEL_NO.Text), ClientClass.CreateSqlParameter("POST_NO", SqlDbType.NVarChar, buttonEdit_POST_NO.Text), ClientClass.CreateSqlParameter("ADDR1", SqlDbType.NVarChar, textEdit_ADDR1.Text), ClientClass.CreateSqlParameter("BIZ_NO", SqlDbType.NVarChar, textEdit_BIZ_NO.Text), ClientClass.CreateSqlParameter("DEL_YN", SqlDbType.NVarChar, checkEdit_DEL_YN.Checked ? "Y" : "N"), ClientClass.CreateSqlParameter("REG_ID", SqlDbType.NVarChar, ConstClass._USR_ID), ClientClass.CreateSqlParameter("RESULT_STR", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000) }; ResultData result = ClientClass.SetData("SaveCustUserManagerPopup", aParam); if (result.isError || !UtilClass.isNull(result.ResultValue)) { throw new Exception(result.ResultValue); } this.Cursor = Cursors.Arrow; MessageBox.Show("정상적으로 저장하였습니다."); this.DialogResult = DialogResult.Yes; this.Close(); } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } }; } private void selectCustProc() { SelectCustomerForm form = new SelectCustomerForm(textEdit_CUST_NM.Text); if (form.ShowDialog() != System.Windows.Forms.DialogResult.Yes) { return; } textEdit_CUST_NM.Text = form.m_CUST_NN; labelControl_CUST_CD.Text = form.m_CUST_CD; textEdit_USR_ID.Focus(); } public string initProc(string usr_id) { string result = ""; try { SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("USR_ID", SqlDbType.NVarChar, usr_id) }; ResultData resultData = ClientClass.GetData("GetCustUserManagerPopup", aParam); DataTable data = resultData.TableData; if (data.Rows.Count > 0) { m_Type = "M"; textEdit_CUST_NM.Properties.ReadOnly = true; simpleButton_Cust_Search.Enabled = false; textEdit_USR_ID.Properties.ReadOnly = true; DataRow row = data.Rows[0]; labelControl_CUST_CD.Text = UtilClass.toStr(row["CUST_CD"]); textEdit_CUST_NM.Text = UtilClass.toStr(row["CUST_NM"]); textEdit_USR_ID.Text = UtilClass.toStr(row["USR_ID"]); textEdit_USR_PWD.Text = UtilClass.toStr(row["USR_PWD"]); textEdit_USR_NM.Text = UtilClass.toStr(row["USR_NM"]); textEdit_TEL_NO.Text = UtilClass.toStr(row["TEL_NO"]); buttonEdit_POST_NO.Text = UtilClass.toStr(row["POST_NO"]); textEdit_ADDR1.Text = UtilClass.toStr(row["ADDR1"]); textEdit_BIZ_NO.Text = UtilClass.toStr(row["BIZ_NO"]); checkEdit_DEL_YN.Checked = UtilClass.isEqual(row["DEL_YN"], "Y"); } } catch (Exception ex) { result = ex.Message; } return result; } } }