File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
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_J_SALE
{
partial class SelectCustDCPopup : XtraForm
{
public SelectCustDCPopup(string cust_cd, string cust_nm)
{
InitializeComponent();
labelControl_CUST_CD.Text = cust_cd;
textEdit_CUST_NM.Text = cust_nm;
simpleButton_ADD.Click += (sender, e) =>
{
saveProc();
};
simpleButton_DELETE.Click += (sender, e) =>
{
deleteProc();
};
gridView_Main.FocusedRowChanged += (sender, e) =>
{
DataRow row = gridView_Main.GetFocusedDataRow();
if (row == null)
{
return;
}
textEdit_DC_CD.Text = UtilClass.toStr(row["DC_CD"]);
textEdit_DC_RATE.EditValue = UtilClass.toDouble(row["DC_RATE"]);
};
simpleButton_CLOSE.Click += (sender, e) =>
{
this.DialogResult = DialogResult.Cancel;
this.Close();
};
gridView_Main.FocusedRowChanged += (sender, e) =>
{
textEdit_DC_CD.Text = "";
textEdit_DC_RATE.EditValue = 0;
DataRow row = gridView_Main.GetFocusedDataRow();
if (row == null)
{
return;
}
textEdit_DC_CD.Text = UtilClass.toStr(row["DC_CD"]);
textEdit_DC_RATE.EditValue = UtilClass.toDouble(row["DC_RATE"]);
};
this.Shown += (sender, e) =>
{
searchProc();
};
}
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_CD", SqlDbType.NVarChar, labelControl_CUST_CD.Text)
};
ResultData resultData = ClientClass.GetData("GetCustDCForm", 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()
{
try
{
this.Cursor = Cursors.WaitCursor;
string dc_cd = UtilClass.toStr(textEdit_DC_CD.Text);
double dc_rate = UtilClass.toDouble(textEdit_DC_RATE.EditValue);
if (dc_cd.Equals(""))
{
textEdit_DC_CD.Focus();
throw new Exception("코드를 입력하십시오.");
}
if (dc_rate <= 0.0)
{
textEdit_DC_RATE.Focus();
throw new Exception("할인율을 입력하십시오.");
}
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar, labelControl_CUST_CD.Text),
ClientClass.CreateSqlParameter("DC_CD", SqlDbType.NVarChar, dc_cd),
ClientClass.CreateSqlParameter("DC_RATE", SqlDbType.Float, dc_rate),
ClientClass.CreateSqlParameter("REG_ID", SqlDbType.NVarChar, ConstClass._USR_ID)
};
ResultData resultData = ClientClass.SetData("SaveCustDCForm", aParam);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
this.Cursor = Cursors.Arrow;
searchProc();
for (int i = 0; i < gridView_Main.RowCount; i++)
{
if (UtilClass.isEqual(gridView_Main.GetDataRow(i)["DC_CD"], dc_cd))
{
gridView_Main.FocusedRowHandle = i;
break;
}
};
textEdit_DC_CD.Focus();
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
MessageBox.Show(ex.Message);
}
}
private void deleteProc()
{
try
{
if (UtilClass.isNull(textEdit_DC_CD.Text))
{
throw new Exception("삭제할 코드를 선택 또는 입력하십시오.");
}
if (MessageBox.Show("삭제하시겠습니까?", "삭제", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
{
return;
}
this.Cursor = Cursors.WaitCursor;
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar, labelControl_CUST_CD.Text),
ClientClass.CreateSqlParameter("DC_CD", SqlDbType.NVarChar, textEdit_DC_CD.Text)
};
ResultData resultData = ClientClass.SetData("DeleteCustDCForm", aParam);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
searchProc();
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
MessageBox.Show(ex.Message);
}
}
}
}