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 SelectNormForm : XtraForm { private string m_ITEM_CD; public string m_NORM; public SelectNormForm(string item_cd) { InitializeComponent(); m_ITEM_CD = item_cd; this.Shown += (sender, e) => { searchProc(); }; textEdit_NORM.KeyPress += (sender, e) => { if (e.KeyChar == '\r') { searchProc(); } }; simpleButton_Text_Clear.Click += (sender, e) => { textEdit_NORM.Text = ""; searchProc(); }; simpleButton_Search.Click += (sender, e) => { searchProc(); }; simpleButton_SAVE.Click += (sender, e) => { if (UtilClass.isNull(textEdit_NORM.Text)) { return; } saveProc(); }; simpleButton_RELOAD.Click += (sender, e) => { textEdit_NORM.Text = ""; searchProc(); }; simpleButton_DELETE.Click += (sender, e) => { if (XtraMessageBox.Show("삭제하시겠습니까?", "삭제", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes) { return; } deleteProc(); }; gridView_Main.FocusedRowChanged += (sender, e) => { DataRow row = gridView_Main.GetFocusedDataRow(); if (row == null) { return; } textEdit_NO_CD.Text = UtilClass.toStr(row["NO_CD"]); textEdit_NORM.Text = UtilClass.toStr(row["NORM"]); }; gridView_Main.KeyPress += (sender, e) => { if (e.KeyChar == '\r') { DataRow row = gridView_Main.GetFocusedDataRow(); if (row != null) { m_NORM = UtilClass.toStr(row["NORM"]); this.DialogResult = DialogResult.Yes; this.Close(); } } }; gridView_Main.DoubleClick += (sender, e) => { DataRow row = gridView_Main.GetFocusedDataRow(); if (row != null) { m_NORM = UtilClass.toStr(row["NORM"]); this.DialogResult = DialogResult.Yes; this.Close(); } }; simpleButton_SELECT.Click += (sender, e) => { DataRow row = gridView_Main.GetFocusedDataRow(); if (row != null) { m_NORM = UtilClass.toStr(row["NORM"]); this.DialogResult = DialogResult.Yes; this.Close(); } }; 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("NORM", SqlDbType.NVarChar, textEdit_NORM.Text) }; ResultData resultData = ClientClass.GetData("GetNormSelectPopup", 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); } } private void saveProc() { try { this.Cursor = Cursors.WaitCursor; gridControl_Main.DataSource = null; SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("MODE", SqlDbType.NVarChar, "I"), ClientClass.CreateSqlParameter("NO_CD", SqlDbType.NVarChar, textEdit_NO_CD.Text), ClientClass.CreateSqlParameter("NORM", SqlDbType.NVarChar, textEdit_NORM.Text), ClientClass.CreateSqlParameter("REG_ID", SqlDbType.NVarChar, ConstClass._USR_ID), }; ResultData resultData = ClientClass.SetData("SaveNormSelectPopup", aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } searchProc(); this.Cursor = Cursors.Arrow; } catch (Exception ex) { this.Cursor = Cursors.Arrow; XtraMessageBox.Show(ex.Message); } } private void deleteProc() { try { this.Cursor = Cursors.WaitCursor; gridControl_Main.DataSource = null; SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("MODE", SqlDbType.NVarChar, "D"), ClientClass.CreateSqlParameter("NO_CD", SqlDbType.NVarChar, textEdit_NO_CD.Text), ClientClass.CreateSqlParameter("NORM", SqlDbType.NVarChar, textEdit_NORM.Text), ClientClass.CreateSqlParameter("REG_ID", SqlDbType.NVarChar, ConstClass._USR_ID), }; ResultData resultData = ClientClass.SetData("SaveNormSelectPopup", aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } searchProc(); this.Cursor = Cursors.Arrow; } catch (Exception ex) { this.Cursor = Cursors.Arrow; XtraMessageBox.Show(ex.Message); } } } }