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 OrderSeqPopup : XtraForm { public string m_ORDER_SEQ; public string m_ORDER_DT; public OrderSeqPopup(DateTime dt) { InitializeComponent(); m_ORDER_SEQ = ""; dateEdit_SDATE.DateTime = dateEdit_FDATE.DateTime = dt; xtraTabControl_Tab.ShowTabHeader = DevExpress.Utils.DefaultBoolean.False; gridView_Main.KeyPress += (sender, e) => { DataRow row = gridView_Main.GetFocusedDataRow(); if (row != null) { m_ORDER_SEQ = UtilClass.toStr(row["ORDER_SEQ"]); m_ORDER_DT = UtilClass.toStr(row["ORDER_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_ORDER_SEQ = UtilClass.toStr(row["ORDER_SEQ"]); m_ORDER_DT = UtilClass.toStr(row["ORDER_DT"]); this.DialogResult = DialogResult.Yes; this.Close(); } }; gridView_Det.KeyPress += (sender, e) => { DataRow row = gridView_Det.GetFocusedDataRow(); if (row != null) { m_ORDER_SEQ = UtilClass.toStr(row["ORDER_SEQ"]); m_ORDER_DT = UtilClass.toStr(row["ORDER_DT"]); this.DialogResult = DialogResult.Yes; this.Close(); } }; gridView_Det.DoubleClick += (sender, e) => { Point aPT = gridControl_Det.PointToClient(Control.MousePosition); GridHitInfo aInfo = gridView_Det.CalcHitInfo(aPT); if (aInfo.InRowCell) { DataRow row = gridView_Det.GetFocusedDataRow(); m_ORDER_SEQ = UtilClass.toStr(row["ORDER_SEQ"]); m_ORDER_DT = UtilClass.toStr(row["ORDER_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_ORDER_SEQ = UtilClass.toStr(row["ORDER_SEQ"]); m_ORDER_DT = UtilClass.toStr(row["ORDER_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; if (radioGroup_SEARCH.SelectedIndex == 0) { gridControl_Main.DataSource = null; xtraTabControl_Tab.SelectedTabPageIndex = 0; } else { gridControl_Det.DataSource = null; xtraTabControl_Tab.SelectedTabPageIndex = 1; } 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), ClientClass.CreateSqlParameter("MODE", SqlDbType.Int, radioGroup_SEARCH.SelectedIndex) }; ResultData resultData = ClientClass.GetData("GetOrderSeqPopup", aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } if (radioGroup_SEARCH.SelectedIndex == 0) { gridControl_Main.DataSource = resultData.TableData; gridView_Main.Focus(); } else { gridControl_Det.DataSource = resultData.TableData; gridView_Det.Focus(); } this.Cursor = Cursors.Arrow; } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } } } }