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 HANMI_SALE { partial class SelectItemForm : XtraForm { public string m_ROUT_CD; public string m_ITEM_CD; public string m_ITEM_NM; public SelectItemForm(string item_nm) { InitializeComponent(); textEdit_Search.Text = item_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_ROUT_CD.EditValueChanged += (sender, e) => { searchProc(); }; radioGroup_ORDER_BY.EditValueChanged += (sender, e) => { searchProc(); }; gridView_Main.KeyPress += (sender, e) => { if (e.KeyChar == '\r') { DataRow row = gridView_Main.GetFocusedDataRow(); if (row != null) { m_ROUT_CD = UtilClass.toStr(row["ROUT_CD"]); m_ITEM_CD = UtilClass.toStr(row["ITEM_CD"]); m_ITEM_NM = UtilClass.toStr(row["ITEM_NM"]); this.DialogResult = DialogResult.Yes; this.Close(); } } }; gridView_Main.DoubleClick += (sender, e) => { DataRow row = gridView_Main.GetFocusedDataRow(); if (row != null) { m_ROUT_CD = UtilClass.toStr(row["ROUT_CD"]); m_ITEM_CD = UtilClass.toStr(row["ITEM_CD"]); m_ITEM_NM = UtilClass.toStr(row["ITEM_NM"]); this.DialogResult = DialogResult.Yes; this.Close(); } }; simpleButton_OK.Click += (sender, e) => { DataRow row = gridView_Main.GetFocusedDataRow(); if (row != null) { m_ROUT_CD = UtilClass.toStr(row["ROUT_CD"]); m_ITEM_CD = UtilClass.toStr(row["ITEM_CD"]); m_ITEM_NM = UtilClass.toStr(row["ITEM_NM"]); } }; 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("ROUT_CD", SqlDbType.NVarChar, radioGroup_ROUT_CD.EditValue), ClientClass.CreateSqlParameter("ORDER_BY", SqlDbType.Int, radioGroup_ORDER_BY.EditValue), ClientClass.CreateSqlParameter("SEARCH", SqlDbType.NVarChar, textEdit_Search.Text) }; ResultData resultData = ClientClass.GetData("GetItemSelectPopup", 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; XtraMessageBox.Show(ex.Message); } } } }