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_STD { partial class SelectCurrentMoneyGroupForm : 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 string m_GROUP_CD = ""; public string m_ITEM_CD = ""; public SelectCurrentMoneyGroupForm(string cust_nm, string group_cd, string item_cd) { InitializeComponent(); textEdit_Search.Text = cust_nm; m_GROUP_CD = group_cd; m_ITEM_CD = item_cd; radioGroup_CUST_KIND.Properties.Items.Clear(); DataView cust_kind = new DataView(ConstClass._DATA); cust_kind.RowFilter = "CATE_CD = 'C' and GRP_CD = 'C06'"; foreach (DataRowView row in cust_kind) { radioGroup_CUST_KIND.Properties.Items.Add(new DevExpress.XtraEditors.Controls.RadioGroupItem(UtilClass.toStr(row["NO_CD"]), UtilClass.toStr(row["NO_CD_NM"]))); } radioGroup_CUST_KIND.Properties.Items.Add(new DevExpress.XtraEditors.Controls.RadioGroupItem("", "전체")); 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(); try { if (row != null) { this.Cursor = Cursors.WaitCursor; DataTable aData = new DataTable(); ResultData[] dataList = null; ResultData data1 = new ResultData(); SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("GRP_CD", SqlDbType.NVarChar, m_GROUP_CD), ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, m_ITEM_CD), ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar,row["CUST_CD"].ToString()), ClientClass.CreateSqlParameter("RUN_RESULT", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000) }; ResultData result = ClientClass.SetTableData("U3SaveCurrentmoneyPopup", dataList, aParam); if (result.isError || !UtilClass.isNull(result.ResultValue)) { throw new Exception(result.ResultValue); } this.Cursor = Cursors.Arrow; } } catch (Exception ex) { this.Cursor = Cursors.Arrow; XtraMessageBox.Show(ex.Message); } searchProc_GROUP(); } }; gridView_Group.KeyPress += (sender, e) => { if (e.KeyChar == '\r') { DataRow row = gridView_Group.GetFocusedDataRow(); try { if (row != null) { this.Cursor = Cursors.WaitCursor; DataTable aData = new DataTable(); ResultData[] dataList = null; ResultData data1 = new ResultData(); SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("GRP_CD", SqlDbType.NVarChar, m_GROUP_CD), ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, m_ITEM_CD), ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar,row["CUST_CD"].ToString()), ClientClass.CreateSqlParameter("RUN_RESULT", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000) }; ResultData result = ClientClass.SetTableData("U3DeleteCurrentmoneyPopup", dataList, aParam); if (result.isError || !UtilClass.isNull(result.ResultValue)) { throw new Exception(result.ResultValue); } searchProc_GROUP(); this.Cursor = Cursors.Arrow; } } catch (Exception ex) { this.Cursor = Cursors.Arrow; XtraMessageBox.Show(ex.Message); } } }; gridView_Group.DoubleClick += (sender, e) => { DataRow row = gridView_Group.GetFocusedDataRow(); try { if (row != null) { this.Cursor = Cursors.WaitCursor; DataTable aData = new DataTable(); ResultData[] dataList = null; ResultData data1 = new ResultData(); SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("GRP_CD", SqlDbType.NVarChar, m_GROUP_CD), ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, m_ITEM_CD), ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar,row["CUST_CD"].ToString()), ClientClass.CreateSqlParameter("RUN_RESULT", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000) }; ResultData result = ClientClass.SetTableData("U3DeleteCurrentmoneyPopup", dataList, aParam); if (result.isError || !UtilClass.isNull(result.ResultValue)) { throw new Exception(result.ResultValue); } searchProc_GROUP(); this.Cursor = Cursors.Arrow; } } catch (Exception ex) { this.Cursor = Cursors.Arrow; XtraMessageBox.Show(ex.Message); } }; gridView_Main.DoubleClick += (sender, e) => { DataRow row = gridView_Main.GetFocusedDataRow(); try { if (row != null) { this.Cursor = Cursors.WaitCursor; DataTable aData = new DataTable(); ResultData[] dataList = null; ResultData data1 = new ResultData(); SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("GRP_CD", SqlDbType.NVarChar, m_GROUP_CD), ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, m_ITEM_CD), ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar,row["CUST_CD"].ToString()), ClientClass.CreateSqlParameter("RUN_RESULT", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000) }; ResultData result = ClientClass.SetTableData("U3SaveCurrentmoneyPopup", dataList, aParam); if (result.isError || !UtilClass.isNull(result.ResultValue)) { throw new Exception(result.ResultValue); } searchProc_GROUP(); this.Cursor = Cursors.Arrow; } } catch (Exception ex) { this.Cursor = Cursors.Arrow; XtraMessageBox.Show(ex.Message); } }; simpleButton_OK.Click += (sender, e) => { DataRow row = gridView_Main.GetFocusedDataRow(); try { if (row != null) { this.Cursor = Cursors.WaitCursor; DataTable aData = new DataTable(); ResultData[] dataList = null; ResultData data1 = new ResultData(); SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("GRP_CD", SqlDbType.NVarChar, m_GROUP_CD), ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, m_ITEM_CD), ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar,row["CUST_CD"].ToString()), ClientClass.CreateSqlParameter("RUN_RESULT", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000) }; ResultData result = ClientClass.SetTableData("U3SaveCurrentmoneyPopup", dataList, aParam); if (result.isError || !UtilClass.isNull(result.ResultValue)) { throw new Exception(result.ResultValue); } searchProc_GROUP(); this.Cursor = Cursors.Arrow; } } catch (Exception ex) { this.Cursor = Cursors.Arrow; XtraMessageBox.Show(ex.Message); } }; 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("U3GetCustSelectPopup", aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } gridControl_Main.DataSource = resultData.TableData; gridView_Main.Focus(); searchProc_GROUP(); this.Cursor = Cursors.Arrow; } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } } public void searchProc_GROUP() { try { this.Cursor = Cursors.WaitCursor; gridControl_Group.DataSource = null; SerializedSqlParam[] aParam2 = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD), ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, m_ITEM_CD), ClientClass.CreateSqlParameter("GRP_CD", SqlDbType.NVarChar, m_GROUP_CD) }; ResultData resultData2 = ClientClass.GetData("U3GetCurrentMoneyPopup", aParam2); if (resultData2.isError) { throw new Exception(resultData2.ResultValue); } gridControl_Group.DataSource = resultData2.TableData; gridControl_Group.Focus(); this.Cursor = Cursors.Arrow; } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } } } }