File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
using ClientLib;
using ClientLib.CommonService2;
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 SelectCodePopup : XtraForm
{
public string m_NO_CD;
public string m_NO_CD_NM;
public DataTable m_Data;
private string m_CATE_CD, m_GRP_CD;
public SelectCodePopup(string cate_cd, string grp_cd, string title)
{
InitializeComponent();
m_NO_CD = "";
m_NO_CD_NM = "";
m_CATE_CD = cate_cd;
m_GRP_CD = grp_cd;
m_Data = null;
this.Text = colTitle.Caption = title;
this.Shown += (sender, e) =>
{
searchProc();
};
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_NO_CD = UtilClass.toStr(row["NO_CD"]);
m_NO_CD_NM = UtilClass.toStr(row["NO_CD_NM"]);
m_Data = gridControl_Main.DataSource as DataTable;
this.DialogResult = DialogResult.Yes;
this.Close();
}
};
gridView_Main.FocusedRowChanged += (sender, e) =>
{
textEdit_NO_CD.Text = "";
textEdit_NO_CD_NM.Text = "";
DataRow row = gridView_Main.GetFocusedDataRow();
if (row == null)
{
return;
}
textEdit_NO_CD.Text = UtilClass.toStr(row["NO_CD"]);
textEdit_NO_CD_NM.Text = UtilClass.toStr(row["NO_CD_NM"]);
};
gridView_Main.KeyPress += (sender, e) =>
{
if (e.KeyChar == '\r')
{
DataRow row = gridView_Main.GetFocusedDataRow();
if (row != null)
{
m_NO_CD = UtilClass.toStr(row["NO_CD"]);
m_NO_CD_NM = UtilClass.toStr(row["NO_CD_NM"]);
m_Data = gridControl_Main.DataSource as DataTable;
this.DialogResult = DialogResult.Yes;
this.Close();
}
}
};
simpleButton_Clear.Click += (sender, e) =>
{
textEdit_NO_CD.Text = "";
textEdit_NO_CD_NM.Text = "";
};
simpleButton_Select.Click += (sender, e) =>
{
DataRow row = gridView_Main.GetFocusedDataRow();
if (row != null)
{
m_NO_CD = UtilClass.toStr(row["NO_CD"]);
m_NO_CD_NM = UtilClass.toStr(row["NO_CD_NM"]);
m_Data = gridControl_Main.DataSource as DataTable;
this.DialogResult = DialogResult.Yes;
this.Close();
}
};
simpleButton_Add.Click += (sender, e) =>
{
saveProc("I");
};
simpleButton_Update.Click += (sender, e) =>
{
saveProc("M");
};
simpleButton_Delete.Click += (sender, e) =>
{
saveProc("D");
};
this.Shown += (sender, e) =>
{
searchProc();
};
}
private void searchProc()
{
try
{
this.Cursor = Cursors.WaitCursor;
gridControl_Main.DataSource = null;
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("CATE_CD", SqlDbType.NVarChar, m_CATE_CD),
ClientClass.CreateSqlParameter("GRP_CD", SqlDbType.NVarChar, m_GRP_CD)
};
ResultData resultData = ClientClass.GetData("GetCodePopup", 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;
MessageBox.Show(ex.Message);
}
}
private void saveProc(string mode)
{
try
{
this.Cursor = Cursors.WaitCursor;
string no_cd = textEdit_NO_CD.Text.Trim();
if (UtilClass.isNull(no_cd))
{
textEdit_NO_CD.Focus();
throw new Exception("코드를 입력하십시오.");
}
SerializedSqlParam[] aParam = new SerializedSqlParam[]
{
ClientClass.CreateSqlParameter("MODE", SqlDbType.NVarChar, mode),
ClientClass.CreateSqlParameter("CATE_CD", SqlDbType.NVarChar, m_CATE_CD),
ClientClass.CreateSqlParameter("GRP_CD", SqlDbType.NVarChar, m_GRP_CD),
ClientClass.CreateSqlParameter("NO_CD", SqlDbType.NVarChar, no_cd),
ClientClass.CreateSqlParameter("NO_CD_NM", SqlDbType.NVarChar, textEdit_NO_CD_NM.Text)
};
ResultData resultData = ClientClass.SetData("SaveCodePopup", aParam);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
this.Cursor = Cursors.Arrow;
MessageBox.Show((UtilClass.isEqual(mode, "I") ? "등록" : (UtilClass.isEqual(mode, "M") ? "수정" : "삭제")) + " 완료.");
searchProc();
if (!UtilClass.isEqual(mode, "D"))
{
for (int i = 0; i < gridView_Main.RowCount; i++)
{
if (UtilClass.isEqual(gridView_Main.GetDataRow(i)["NO_CD"], no_cd))
{
gridView_Main.FocusedRowHandle = i;
break;
}
}
}
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
MessageBox.Show(ex.Message);
}
}
}
}