using ClientLib; using ClientLib.CommonService; using DevExpress.XtraEditors; using DevExpress.XtraGrid.Views.Grid.ViewInfo; 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_J_SALE { partial class ColCdPopup : XtraForm { public string m_COL_NO; public string m_COL_CD; public string m_COL_DT; public ColCdPopup(DateTime dt) { InitializeComponent(); m_COL_NO = ""; m_COL_CD = ""; m_COL_DT = ""; dateEdit_SDATE.DateTime = dateEdit_FDATE.DateTime = dt; gridView_Main.KeyPress += (sender, e) => { DataRow row = gridView_Main.GetFocusedDataRow(); if (row != null) { m_COL_NO = UtilClass.toStr(row["COL_NO"]); m_COL_CD = UtilClass.toStr(row["COL_CD"]); m_COL_DT = UtilClass.toStr(row["COL_DT"]); this.DialogResult = DialogResult.Yes; this.Close(); } }; gridView_Main.DoubleClick += (sender, e) => { Point aPT = gridControl_Main.PointToClient(Control.MousePosition); GridHitInfo aInfo = gridView_Main.CalcHitInfo(aPT); if (aInfo.InRowCell) { DataRow row = gridView_Main.GetFocusedDataRow(); m_COL_NO = UtilClass.toStr(row["COL_NO"]); m_COL_CD = UtilClass.toStr(row["COL_CD"]); m_COL_DT = UtilClass.toStr(row["COL_DT"]); this.DialogResult = DialogResult.Yes; this.Close(); } }; buttonEdit_CUST_NM.KeyPress += (sender, e) => { if (e.KeyChar == '\r') { selectCustProc(); } }; buttonEdit_CUST_NM.ButtonClick += (sender, e) => { selectCustProc(); }; simpleButton_SELECT.Click += (sender, e) => { DataRow row = gridView_Main.GetFocusedDataRow(); if (row != null) { m_COL_NO = UtilClass.toStr(row["COL_NO"]); m_COL_CD = UtilClass.toStr(row["COL_CD"]); m_COL_DT = UtilClass.toStr(row["COL_DT"]); this.DialogResult = DialogResult.Yes; this.Close(); } }; simpleButton_Cancel.Click += (sender, e) => { this.DialogResult = DialogResult.Cancel; this.Close(); }; simpleButton_Search.Click += (sender, e) => { searchProc(); }; this.Shown += (sender, e) => { searchProc(); }; } private void selectCustProc() { SelectCustomerForm form = new SelectCustomerForm(buttonEdit_CUST_NM.Text, DateTime.Now); if (form.ShowDialog() != System.Windows.Forms.DialogResult.Yes) { return; } buttonEdit_CUST_NM.Text = form.m_CUST_NM; labelControl_CUST_CD.Text = form.m_CUST_CD; searchProc(); } public void searchProc() { try { this.Cursor = Cursors.WaitCursor; SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("SDATE", SqlDbType.NVarChar, dateEdit_SDATE.DateTime.ToString("yyyy.MM.dd")), ClientClass.CreateSqlParameter("FDATE", SqlDbType.NVarChar, dateEdit_FDATE.DateTime.ToString("yyyy.MM.dd")), ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar, labelControl_CUST_CD.Text) }; ResultData resultData = ClientClass.GetData("GetColCdPopup", aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } gridControl_Main.DataSource = resultData.TableData; this.Cursor = Cursors.Arrow; } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } } } }