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.Linq; using System.Net; using System.Text; using System.Windows.Forms; using System.Xml; namespace HANMI_STD { partial class CustManagerPopup : XtraForm { private string m_TYPE, m_COMP_CD; public CustManagerPopup(string comp_cd) { InitializeComponent(); this.Icon = ConstClass._MAIN.Icon; m_TYPE = "I"; m_COMP_CD = comp_cd; checkEdit_DEAL_YN.Checked = true; // 분류 DataView cust_kind = new DataView(ConstClass._DATA); cust_kind.RowFilter = "CATE_CD = 'C' and GRP_CD = 'C06'"; UtilClass.SetLookup(lookUpEdit_CUST_KIND, cust_kind, "NO_CD", "NO_CD_NM", true); // 등급 DataView grade_cd = new DataView(ConstClass._DATA); grade_cd.RowFilter = "CATE_CD = 'C' and GRP_CD = 'C07'"; UtilClass.SetLookup(lookUpEdit_GRADE_CD, grade_cd, "NO_CD", "NO_CD_NM", true); // 국가 DataView natn_cd = new DataView(ConstClass._DATA); natn_cd.RowFilter = "CATE_CD = 'C' and GRP_CD = 'C02'"; UtilClass.SetLookup(lookUpEdit_NATN_CD, natn_cd, "NO_CD", "NO_CD_NM", true); // 결재통화 DataView exch_curr = new DataView(ConstClass._DATA); exch_curr.RowFilter = "CATE_CD = 'C' and GRP_CD = 'C05'"; UtilClass.SetLookup(lookUpEdit_EXCH_CURR, exch_curr, "NO_CD", "NO_CD_NM", true); // 부가세구분 DataView vat_cd = new DataView(ConstClass._DATA); vat_cd.RowFilter = "CATE_CD = 'C' and GRP_CD = 'C01'"; UtilClass.SetLookup(lookUpEdit_VAT_CD, vat_cd, "NO_CD", "NO_CD_NM", true); textEdit_CUST_NM.EditValueChanged += (sender, e) => { textEdit_CUST_SMP_NM.Text = textEdit_CUST_NM.Text; }; buttonEdit_POST_NO.ButtonClick += (sender, e) => { PostNoForm form = new PostNoForm(); if (form.ShowDialog() == DialogResult.Yes) { buttonEdit_POST_NO.Text = UtilClass.toStr(form.ResultRow["POST_NO"]); textEdit_ADDR1.Text = UtilClass.toStr(form.ResultRow["ADDR1"]); textEdit_ADDR2.Text = ""; textEdit_ADDR2.Focus(); } }; this.simpleButton_CANCEL.Click += (sender, e) => { this.DialogResult = DialogResult.Cancel; this.Close(); }; this.simpleButton_YES.Click += (sender, e) => { try { this.Cursor = Cursors.WaitCursor; if (UtilClass.isNull(textEdit_CUST_NM.Text)) { textEdit_CUST_NM.Focus(); throw new Exception("거래처명을 입력하십시오."); } if (UtilClass.isNull(lookUpEdit_CUST_KIND.EditValue)) { lookUpEdit_CUST_KIND.Focus(); throw new Exception("분류를 선택하십시오."); } //if (UtilClass.isNull(lookUpEdit_GRADE_CD.EditValue)) //{ // lookUpEdit_GRADE_CD.Focus(); // throw new Exception("등급을 선택하십시오."); //} //if (UtilClass.isNull(lookUpEdit_NATN_CD.EditValue)) //{ // lookUpEdit_NATN_CD.Focus(); // throw new Exception("국가를 선택하십시오."); //} //if (UtilClass.isNull(lookUpEdit_EXCH_CURR.EditValue)) //{ // lookUpEdit_EXCH_CURR.Focus(); // throw new Exception("결재통화를 선택하십시오."); //} if (UtilClass.isNull(lookUpEdit_VAT_CD.EditValue)) { lookUpEdit_VAT_CD.Focus(); throw new Exception("부가세 구분을 선택하십시오."); } SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, m_COMP_CD), ClientClass.CreateSqlParameter("CUST_KIND", SqlDbType.NVarChar, lookUpEdit_CUST_KIND.EditValue), ClientClass.CreateSqlParameter("CUST_NM", SqlDbType.NVarChar, textEdit_CUST_NM.Text), ClientClass.CreateSqlParameter("CUST_ENG_NM", SqlDbType.NVarChar, textEdit_CUST_ENG_NM.Text), ClientClass.CreateSqlParameter("CUST_SMP_NM", SqlDbType.NVarChar, textEdit_CUST_SMP_NM.Text), ClientClass.CreateSqlParameter("INIT_WORD_NM", SqlDbType.NVarChar, textEdit_INIT_WORD_NM.Text), ClientClass.CreateSqlParameter("DEAL_YN", SqlDbType.NVarChar, checkEdit_DEAL_YN.Checked ? "Y" : "N"), ClientClass.CreateSqlParameter("DEAL_START_DT", SqlDbType.NVarChar, UtilClass.isNull(dateEdit_DEAL_START_DT.EditValue) ? "" : dateEdit_DEAL_START_DT.DateTime.ToString("yyyy-MM-dd")), ClientClass.CreateSqlParameter("DEAL_FINISH_DT", SqlDbType.NVarChar, UtilClass.isNull(dateEdit_DEAL_FINISH_DT.EditValue) ? "" : dateEdit_DEAL_FINISH_DT.DateTime.ToString("yyyy-MM-dd")), ClientClass.CreateSqlParameter("GRADE_CD", SqlDbType.NVarChar, lookUpEdit_GRADE_CD.EditValue), ClientClass.CreateSqlParameter("FORN_YN", SqlDbType.NVarChar, checkEdit_FORN_YN.Checked ? "Y" : "N"), ClientClass.CreateSqlParameter("NATN_CD", SqlDbType.NVarChar, lookUpEdit_NATN_CD.EditValue), ClientClass.CreateSqlParameter("EXCH_CURR", SqlDbType.NVarChar, lookUpEdit_EXCH_CURR.EditValue), ClientClass.CreateSqlParameter("VAT_CD", SqlDbType.NVarChar, lookUpEdit_VAT_CD.EditValue), ClientClass.CreateSqlParameter("POST_NO", SqlDbType.NVarChar, buttonEdit_POST_NO.Text), ClientClass.CreateSqlParameter("ADDR1", SqlDbType.NVarChar, textEdit_ADDR1.Text), ClientClass.CreateSqlParameter("ADDR2", SqlDbType.NVarChar, textEdit_ADDR2.Text), ClientClass.CreateSqlParameter("TEL_NO", SqlDbType.NVarChar, textEdit_TEL_NO.Text), ClientClass.CreateSqlParameter("FAX_NO", SqlDbType.NVarChar, textEdit_FAX_NO.Text), ClientClass.CreateSqlParameter("EMAIL", SqlDbType.NVarChar, textEdit_EMAIL.Text), ClientClass.CreateSqlParameter("HOMEPAGE", SqlDbType.NVarChar, textEdit_HOMEPAGE.Text), ClientClass.CreateSqlParameter("BIZ_NO", SqlDbType.NVarChar, textEdit_BIZ_NO.Text), ClientClass.CreateSqlParameter("OWNER_NM", SqlDbType.NVarChar, textEdit_OWNER_NM.Text), ClientClass.CreateSqlParameter("OWNER_TEL_NO", SqlDbType.NVarChar, textEdit_OWNER_TEL_NO.Text), ClientClass.CreateSqlParameter("COND_NM", SqlDbType.NVarChar, textEdit_COND_NM.Text), ClientClass.CreateSqlParameter("EVNT_NM", SqlDbType.NVarChar, textEdit_EVNT_NM.Text), ClientClass.CreateSqlParameter("DEL_YN", SqlDbType.NVarChar, checkEdit_DEL_YN.Checked ? "Y" : "N"), ClientClass.CreateSqlParameter("MGR_NM", SqlDbType.NVarChar, textEdit_MGR_NM.Text), ClientClass.CreateSqlParameter("MGR_TEL_NO", SqlDbType.NVarChar, textEdit_MGR_TEL_NO.Text), ClientClass.CreateSqlParameter("MGR_EMAIL", SqlDbType.NVarChar, textEdit_MGR_EMAIL.Text), ClientClass.CreateSqlParameter("REMARK", SqlDbType.NVarChar, textEdit_REMARK.Text), ClientClass.CreateSqlParameter("REG_ID", SqlDbType.NVarChar, ConstClass._USR_ID), ClientClass.CreateSqlParameter("TYPE", SqlDbType.NVarChar, m_TYPE), ClientClass.CreateSqlParameter("RUN_RESULT", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000) }; ResultData result = ClientClass.SetData("SaveCustManagerPopup2", aParam); if (result.isError || !UtilClass.isNull(result.ResultValue)) { throw new Exception(result.ResultValue); } this.Cursor = Cursors.Arrow; MessageBox.Show("저장 완료!"); this.DialogResult = DialogResult.Yes; this.Close(); } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } }; this.Shown += (sender, e) => { lookUpEdit_CUST_KIND.Focus(); lookUpEdit_CUST_KIND.EditValue = "02"; }; } //public string setData(string comp_nm, string cust_cd) //{ // string result = ""; // m_TYPE = "M"; // this.Text = this.Text + " - " + comp_nm; // try // { // SerializedSqlParam[] aParam = new SerializedSqlParam[] { // ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, m_COMP_CD), // ClientClass.CreateSqlParameter("SEARCH", SqlDbType.NVarChar, ""), // ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar, cust_cd) // }; // ResultData resultData = ClientClass.GetData("GetCustManager", aParam); // if (resultData.isError) // { // throw new Exception(resultData.ResultValue); // } // if (resultData.TableData.Rows.Count < 1) // { // throw new Exception("해당 거래처의 정보가 없습니다."); // } // lookUpEdit_CUST_KIND.EditValue = resultData.TableData.Rows[0]["CUST_KIND"]; // textEdit_CUST_NM.Text = UtilClass.toStr(resultData.TableData.Rows[0]["CUST_NM"]); // textEdit_CUST_ENG_NM.Text = UtilClass.toStr(resultData.TableData.Rows[0]["CUST_ENG_NM"]); // textEdit_CUST_SMP_NM.Text = UtilClass.toStr(resultData.TableData.Rows[0]["CUST_SMP_NM"]); // textEdit_INIT_WORD_NM.Text = UtilClass.toStr(resultData.TableData.Rows[0]["INIT_WORD_NM"]); // dateEdit_DEAL_START_DT.EditValue = resultData.TableData.Rows[0]["DEAL_START_DT"]; // dateEdit_DEAL_FINISH_DT.EditValue = resultData.TableData.Rows[0]["DEAL_FINISH_DT"]; // checkEdit_DEAL_YN.Checked = UtilClass.isEqual(resultData.TableData.Rows[0]["DEAL_YN"], "Y"); // lookUpEdit_GRADE_CD.EditValue = resultData.TableData.Rows[0]["GRADE_CD"]; // checkEdit_FORN_YN.Checked = UtilClass.isEqual(resultData.TableData.Rows[0]["FORN_YN"], "Y"); // lookUpEdit_NATN_CD.EditValue = resultData.TableData.Rows[0]["NATN_CD"]; // lookUpEdit_EXCH_CURR.EditValue = resultData.TableData.Rows[0]["EXCH_CURR"]; // lookUpEdit_VAT_CD.EditValue = resultData.TableData.Rows[0]["VAT_CD"]; // buttonEdit_POST_NO.Text = UtilClass.toStr(resultData.TableData.Rows[0]["POST_NO"]); // textEdit_ADDR1.Text = UtilClass.toStr(resultData.TableData.Rows[0]["ADDR1"]); // textEdit_ADDR2.Text = UtilClass.toStr(resultData.TableData.Rows[0]["ADDR2"]); // textEdit_TEL_NO.Text = UtilClass.toStr(resultData.TableData.Rows[0]["TEL_NO"]); // textEdit_FAX_NO.Text = UtilClass.toStr(resultData.TableData.Rows[0]["FAX_NO"]); // textEdit_EMAIL.Text = UtilClass.toStr(resultData.TableData.Rows[0]["EMAIL"]); // textEdit_HOMEPAGE.Text = UtilClass.toStr(resultData.TableData.Rows[0]["HOMEPAGE"]); // textEdit_BIZ_NO.Text = UtilClass.toStr(resultData.TableData.Rows[0]["BIZ_NO"]); // textEdit_OWNER_NM.Text = UtilClass.toStr(resultData.TableData.Rows[0]["OWNER_NM"]); // textEdit_COND_NM.Text = UtilClass.toStr(resultData.TableData.Rows[0]["COND_NM"]); // textEdit_EVNT_NM.Text = UtilClass.toStr(resultData.TableData.Rows[0]["EVNT_NM"]); // checkEdit_DEL_YN.Checked = UtilClass.isEqual(resultData.TableData.Rows[0]["DEL_YN"], "Y"); // textEdit_REMARK.Text = UtilClass.toStr(resultData.TableData.Rows[0]["REMARK"]); // } // catch (Exception ex) // { // result = ex.Message; // } // return result; //} } }