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 ChangeOrderDate : PublicLib.CommonMDI
{
Timer m_Timer;
private string m_ORDER_NO;
public ChangeOrderDate()
{
InitializeComponent();
m_Timer = new Timer();
m_Timer.Enabled = false;
m_ORDER_NO = "";
dateEdit_SDATE.DateTime = DateTime.Now;
dateEdit_ORDER_DATE.DateTime = DateTime.Now.AddDays(1);
labelControl_SDATE_YO.Text = GetDay(DateTime.Now) ;
gridControl_Main.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat;
gridControl_Main.LookAndFeel.UseDefaultLookAndFeel = false;
gridView_Main.Appearance.HeaderPanel.BackColor = Color.FromArgb(170, 204, 255);
simpleButton_SelectCheck.Click += (sender, e) =>
{
if (gridControl_Main.DataSource == null)
{
return;
}
foreach (int i in gridView_Main.GetSelectedRows())
{
DataRow row = gridView_Main.GetDataRow(i);
row["SEL_FIELD"] = "Y";
}
};
simpleButton_SelectNone.Click += (sender, e) =>
{
if (gridControl_Main.DataSource == null)
{
return;
}
foreach (int i in gridView_Main.GetSelectedRows())
{
DataRow row = gridView_Main.GetDataRow(i);
row["SEL_FIELD"] = "N";
}
};
simpleButton_SelectAll.Click += (sender, e) =>
{
if (gridControl_Main.DataSource == null)
{
return;
}
DataTable aData = gridControl_Main.DataSource as DataTable;
for (int i = 0; i < aData.Rows.Count; i++)
{
if (aData.Rows[i].RowState == DataRowState.Deleted)
{
continue;
}
aData.Rows[i]["SEL_FIELD"] = "Y";
}
};
simpleButton_SelectAllNone.Click += (sender, e) =>
{
if (gridControl_Main.DataSource == null)
{
return;
}
DataTable aData = gridControl_Main.DataSource as DataTable;
for (int i = 0; i < aData.Rows.Count; i++)
{
if (aData.Rows[i].RowState == DataRowState.Deleted)
{
continue;
}
aData.Rows[i]["SEL_FIELD"] = "N";
}
};
simpleButton_CHANGE.Click += (sender, e) =>
{
if (XtraMessageBox.Show("주문일자를 " + dateEdit_ORDER_DATE.Text + "로 일괄 변경 하시겠습니까?", "확인", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{
saveChangeOrderDate();
}
};
dateEdit_SDATE.EditValueChanged += (sender, e) =>
{
labelControl_SDATE_YO.Text = GetDay(dateEdit_SDATE.DateTime);
};
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.CustomDrawCell += (sender, e) =>
{
DataRow row = gridView_Main.GetDataRow(e.RowHandle);
if (!UtilClass.isEqual(row["BILL_NO"], ""))
{
e.Appearance.BackColor = Color.FromArgb(206, 254, 188);
e.Appearance.ForeColor = Color.DarkBlue;
}
};
m_Timer.Tick += (sender, e) =>
{
DateTime dt = DateTime.Now;
string datePart = dt.ToString("yyyy-MM-dd hh:mm:ss");
labelControl_Time.Text = datePart;
};
this.Shown += (sender, e) =>
{
dateEdit_SDATE.Focus();
//시간 설정.
m_Timer.Interval = 100;
m_Timer.Enabled = true;
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")),
};
ResultData resultData = ClientClass.GetData("GetChangeOrderDate", aParam);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
DataTable aData = resultData.TableData;
foreach (DataRow arow in aData.Rows)
{
if (UtilClass.isEqual(arow["LN_SEQ"], "01"))
{
continue;
}
arow["FILE_NM"] = "";
arow["PRINT_POS"] = "";
arow["OUT_POS"] = "";
arow["IN_FIN_YN"] = "";
arow["IN_USR_NM"] = "";
arow["IN_DATE"] = "";
arow["OUT_YN"] = "";
arow["OUT_USR_NM"] = "";
arow["OUT_DATE"] = "";
}
gridControl_Main.DataSource = aData;
aData.AcceptChanges();
this.Cursor = Cursors.Arrow;
if (!UtilClass.isNull(m_ORDER_NO))
{
for (int i = 0; i < gridView_Main.RowCount; i++)
{
if (UtilClass.isEqual(gridView_Main.GetDataRow(i)["ORDER_NO"], m_ORDER_NO))
{
gridView_Main.FocusedRowHandle = i;
break;
}
}
}
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
XtraMessageBox.Show(ex.Message);
}
}
public override void newProc()
{
}
public override void updateProc()
{
}
public override void deleteProc()
{
}
public override void printProc()
{
}
public override void excelProc()
{
this.ExportExcelGrid(gridControl_Main);
}
public override void saveProc()
{
}
private void saveChangeOrderDate()
{
try
{
gridView_Main.PostEditor();
gridView_Main.UpdateCurrentRow();
Application.DoEvents();
this.Cursor = Cursors.WaitCursor;
DataTable aData = gridControl_Main.DataSource as DataTable;
DataRow[] rows;
rows = aData.Select("SEL_FIELD = 'Y'");
if (rows == null || rows.Length <= 0)
{
throw new Exception("선택된 데이타가 없습니다.");
}
DataTable dtData = new DataTable();
dtData.Columns.Add("ORDER_NO", typeof(string));
foreach (DataRow inrow in rows)
{
DataRow aRow = dtData.NewRow();
aRow["ORDER_NO"] = inrow["ORDER_NO"];
dtData.Rows.Add(aRow);
}
ResultData[] dataList = null;
ResultData data1 = new ResultData();
dtData.TableName = "ADATA";
data1.TableData = dtData;
dataList = new ResultData[] { data1 };
SerializedSqlParam[] aParam = new SerializedSqlParam[]
{
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("REG_ID", SqlDbType.NVarChar, ConstClass._USR_ID),
ClientClass.CreateSqlParameter("ORDER_DATE", SqlDbType.NVarChar, dateEdit_ORDER_DATE.DateTime.ToString("yyyy-MM-dd"))
};
ResultData resultData = ClientClass.SetTableData("SaveChangeOrderDate", dataList, aParam);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
XtraMessageBox.Show("정상적으로 변경하였습니다");
searchProc();
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
XtraMessageBox.Show(ex.Message);
}
}
private string GetDay(DateTime dt)
{
string strDay = "";
switch (dt.DayOfWeek)
{
case DayOfWeek.Monday:
strDay = "월요일";
break;
case DayOfWeek.Tuesday:
strDay = "화요일";
break;
case DayOfWeek.Wednesday:
strDay = "수요일";
break;
case DayOfWeek.Thursday:
strDay = "목요일";
break;
case DayOfWeek.Friday:
strDay = "금요일";
break;
case DayOfWeek.Saturday:
strDay = "토요일";
break;
case DayOfWeek.Sunday:
strDay = "일요일";
break;
}
return strDay;
}
}
}