using ClientLib; using ClientLib.CommonService; 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.Reflection; using System.Text; using System.Threading; using System.Windows.Forms; namespace HM_WORK { partial class SelectCustomerForm : XtraForm { public string m_CUST_CD; public string m_CUST_NN; public string m_TEL_NO; public string m_OWNER_TEL_NO; public string m_MGR_TEL_NO; public SelectCustomerForm(string cust_nm) { InitializeComponent(); textEdit_Search.Text = cust_nm; this.Shown += (sender, e) => { searchProc(); }; textEdit_Search.KeyPress += (sender, e) => { if (e.KeyChar == '\r') { searchProc(); } }; simpleButton_Text_Clear.Click += (sender, e) => { textEdit_Search.Text = ""; }; simpleButton_Search.Click += (sender, e) => { searchProc(); }; radioGroup_CUST_KIND.EditValueChanged += (sender, e) => { searchProc(); }; radioGroup_ORDER_BY.EditValueChanged += (sender, e) => { searchProc(); }; radioGroup_CUST_NAME_GBN.EditValueChanged += (sender, e) => { searchProc(); }; gridView_Main.KeyPress += (sender, e) => { if (e.KeyChar == '\r') { DataRow row = gridView_Main.GetFocusedDataRow(); if (row != null) { m_CUST_CD = UtilClass.toStr(row["CUST_CD"]); m_CUST_NN = UtilClass.toStr(row["CUST_NM"]); m_TEL_NO = UtilClass.toStr(row["TEL_NO"]); m_OWNER_TEL_NO = UtilClass.toStr(row["OWNER_TEL_NO"]); m_MGR_TEL_NO = UtilClass.toStr(row["MGR_TEL_NO"]); this.DialogResult = DialogResult.Yes; this.Close(); } } }; gridView_Main.DoubleClick += (sender, e) => { DataRow row = gridView_Main.GetFocusedDataRow(); if (row != null) { m_CUST_CD = UtilClass.toStr(row["CUST_CD"]); m_CUST_NN = UtilClass.toStr(row["CUST_NM"]); m_TEL_NO = UtilClass.toStr(row["TEL_NO"]); m_OWNER_TEL_NO = UtilClass.toStr(row["OWNER_TEL_NO"]); m_MGR_TEL_NO = UtilClass.toStr(row["MGR_TEL_NO"]); this.DialogResult = DialogResult.Yes; this.Close(); } }; simpleButton_OK.Click += (sender, e) => { DataRow row = gridView_Main.GetFocusedDataRow(); if (row != null) { m_CUST_CD = UtilClass.toStr(row["CUST_CD"]); m_CUST_NN = UtilClass.toStr(row["CUST_NM"]); m_TEL_NO = UtilClass.toStr(row["TEL_NO"]); m_OWNER_TEL_NO = UtilClass.toStr(row["OWNER_TEL_NO"]); m_MGR_TEL_NO = UtilClass.toStr(row["MGR_TEL_NO"]); } }; simpleButton_Cancel.Click += (sender, e) => { this.DialogResult = DialogResult.Cancel; this.Close(); }; } public void searchProc() { try { this.Cursor = Cursors.WaitCursor; gridControl_Main.DataSource = null; SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("CUST_KIND", SqlDbType.NVarChar, radioGroup_CUST_KIND.EditValue), ClientClass.CreateSqlParameter("ORDER_BY", SqlDbType.Int, radioGroup_ORDER_BY.EditValue), ClientClass.CreateSqlParameter("DEL_YN", SqlDbType.NVarChar, checkBox_DEL_YN.Checked ? 'N':'Y'), ClientClass.CreateSqlParameter("CUST_NAME_GBN", SqlDbType.Int, radioGroup_CUST_NAME_GBN.EditValue), ClientClass.CreateSqlParameter("SEARCH", SqlDbType.NVarChar, textEdit_Search.Text) }; ResultData resultData = ClientClass.GetData("GetCustSelectPopup", aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } gridControl_Main.DataSource = resultData.TableData; gridView_Main.Focus(); this.Cursor = Cursors.Arrow; } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } } } }