File name
Commit message
Commit date
File name
Commit message
Commit date
using ClientLib;
using ClientLib.CommonService;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid;
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.Text;
using System.Windows.Forms;
namespace HANMI_SALE
{
public partial class AcceptManager : PublicLib.CommonMDI
{
public AcceptManager()
{
InitializeComponent();
gridControl_Main.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat;
gridControl_Main.LookAndFeel.UseDefaultLookAndFeel = false;
gridView_Main.Appearance.HeaderPanel.BackColor = Color.FromArgb(170, 204, 255);
// textEdit_CUST_NM.ImeMode = System.Windows.Forms.ImeMode.Hangul;
dateEdit_SDATE.DateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM") + "-01");
dateEdit_FDATE.DateTime = DateTime.Now.AddDays(7);
xtraTabControl_ACCEPT.SelectedTabPageIndex = 0;
simpleButton_SelectAll.Click += (sender, e) =>
{
try
{
if (gridControl_Main.DataSource == null)
{
return;
}
DataTable aData = gridControl_Main.DataSource as DataTable;
gridView_Main.BeginDataUpdate();
foreach (DataRow row in aData.Rows)
{
row["SEL_FIELD"] = "Y";
}
}
finally
{
gridView_Main.EndDataUpdate();
}
};
simpleButton_SelectNone.Click += (sender, e) =>
{
try
{
if (gridControl_Main.DataSource == null)
{
return;
}
DataTable aData = gridControl_Main.DataSource as DataTable;
gridView_Main.BeginDataUpdate();
foreach (DataRow row in aData.Rows)
{
row["SEL_FIELD"] = "N";
}
}
finally
{
gridView_Main.EndDataUpdate();
}
};
simpleButton_ALL.Click += (sender, e) =>
{
try
{
if (gridControl_Search.DataSource == null)
{
return;
}
DataTable aData = gridControl_Search.DataSource as DataTable;
gridView_Search.BeginDataUpdate();
foreach (DataRow row in aData.Rows)
{
row["SEL_FIELD"] = "Y";
}
}
finally
{
gridView_Search.EndDataUpdate();
}
};
simpleButton_NONE.Click += (sender, e) =>
{
try
{
if (gridControl_Search.DataSource == null)
{
return;
}
DataTable aData = gridControl_Search.DataSource as DataTable;
gridView_Search.BeginDataUpdate();
foreach (DataRow row in aData.Rows)
{
row["SEL_FIELD"] = "N";
}
}
finally
{
gridView_Search.EndDataUpdate();
}
};
simpleButton_Accept.Click += (sender, e) =>
{
saveProc();
};
simpleButton_Cancel.Click += (sender, e) =>
{
cancelAcceptProc();
};
simpleButton_Cust_Search.Click += (sender, e) =>
{
selectCustProc();
};
textEdit_CUST_NM.KeyPress += (sender, e) =>
{
if (e.KeyChar == '\r')
{
selectCustProc();
}
};
textEdit_CUST_NM.EditValueChanged += (sender, e) =>
{
if (UtilClass.isNull(textEdit_CUST_NM.Text))
{
labelControl_CUST_CD.Text = "";
}
};
gridView_Main.FocusedRowChanged += (sender, e) =>
{
};
dateEdit_FDATE.KeyPress += (sender, e) =>
{
searchProc();
};
this.Shown += (sender, e) =>
{
dateEdit_SDATE.Focus();
searchProc();
};
}
private void selectCustProc()
{
SelectCustomerForm form = new SelectCustomerForm(textEdit_CUST_NM.Text);
if (form.ShowDialog() != System.Windows.Forms.DialogResult.Yes)
{
return;
}
textEdit_CUST_NM.Text = form.m_CUST_NN;
labelControl_CUST_CD.Text = form.m_CUST_CD;
searchProc();
}
public override 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),
ClientClass.CreateSqlParameter("SDATE", SqlDbType.NVarChar, dateEdit_SDATE.DateTime.ToString("yyyy-MM-dd")),
ClientClass.CreateSqlParameter("FDATE", SqlDbType.NVarChar, dateEdit_FDATE.DateTime.ToString("yyyy-MM-dd")),
};
ResultData resultData = ClientClass.GetData("GetOrderAcceptManager2", aParam);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
gridControl_Main.DataSource = resultData.DataList.Tables[0];
gridControl_Search.DataSource = resultData.DataList.Tables[1];
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
XtraMessageBox.Show(ex.Message);
}
}
public override void saveProc()
{
try
{
if (gridControl_Main.DataSource == null)
{
return;
}
this.Cursor = Cursors.WaitCursor;
gridView_Main.PostEditor();
gridView_Main.UpdateCurrentRow();
Application.DoEvents();
DataTable data;
data = gridControl_Main.DataSource as DataTable;
DataTable aData = UtilClass.GetDataTable(data, false,
"COMP_CD", "ORDER_NO", "LN_SEQ", "SEL_FIELD"
);
if (aData.Rows.Count < 1)
{
throw new Exception("변경된 데이터가 없습니다.");
}
aData.TableName = "ADATA";
ResultData data1 = new ResultData();
data1.TableData = aData;
ResultData[] dataList = new ResultData[] { data1 };
SerializedSqlParam[] aParam = new SerializedSqlParam[]
{
ClientClass.CreateSqlParameter("REG_ID", SqlDbType.NVarChar, ConstClass._USR_ID),
ClientClass.CreateSqlParameter("RESULT_STR", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000)
};
ResultData resultData = ClientClass.SetTableData("SaveOrderAcceptManager", dataList, aParam);
if (resultData.isError || !UtilClass.isNull(resultData.ResultValue))
{
throw new Exception(resultData.ResultValue);
}
this.Cursor = Cursors.Arrow;
XtraMessageBox.Show("정상적으로 저장하였습니다.");
searchProc();
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
XtraMessageBox.Show(ex.Message);
}
}
public void cancelAcceptProc()
{
try
{
if (gridControl_Search.DataSource == null)
{
return;
}
this.Cursor = Cursors.WaitCursor;
gridView_Search.PostEditor();
gridView_Search.UpdateCurrentRow();
Application.DoEvents();
DataTable data;
data = gridControl_Search.DataSource as DataTable;
DataTable aData = UtilClass.GetDataTable(data, false,
"COMP_CD", "ORDER_NO", "LN_SEQ", "SEL_FIELD"
);
if (aData.Rows.Count < 1)
{
throw new Exception("변경된 데이터가 없습니다.");
}
aData.TableName = "ADATA";
ResultData data1 = new ResultData();
data1.TableData = aData;
ResultData[] dataList = new ResultData[] { data1 };
SerializedSqlParam[] aParam = new SerializedSqlParam[]
{
ClientClass.CreateSqlParameter("REG_ID", SqlDbType.NVarChar, ConstClass._USR_ID),
ClientClass.CreateSqlParameter("RESULT_STR", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000)
};
ResultData resultData = ClientClass.SetTableData("SaveOrderCancelManager", dataList, aParam);
if (resultData.isError || !UtilClass.isNull(resultData.ResultValue))
{
throw new Exception(resultData.ResultValue);
}
this.Cursor = Cursors.Arrow;
XtraMessageBox.Show("정상적으로 취소하였습니다.");
searchProc();
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
XtraMessageBox.Show(ex.Message);
}
}
public override void excelProc()
{
if (xtraTabControl_ACCEPT.SelectedTabPageIndex == 0)
{
this.ExportExcelGrid(gridControl_Main);
}
else if (xtraTabControl_ACCEPT.SelectedTabPageIndex == 1)
{
this.ExportExcelGrid(gridControl_Search);
}
}
}
}