using ClientLib; using ClientLib.CommonService2; 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_STD { public partial class HolidayManager : PublicLib.CommonMDI { public HolidayManager() { InitializeComponent(); lookUpEdit_COMP_CD.EditValueChanged += (sender, e) => { searchProc(); }; this.Shown += (sender, e) => { try { SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("MENU_ID", SqlDbType.NVarChar, this.m_MenuID), ClientClass.CreateSqlParameter("USR_ID", SqlDbType.NVarChar, ConstClass._USR_ID) }; ResultData resultComp = ClientClass.GetData("GetCompanyListByMenuUser", aParam); if (resultComp.isError) { throw new Exception(resultComp.ResultValue); } UtilClass.SetLookup(lookUpEdit_COMP_CD, resultComp.TableData, "COMP_CD", "COMP_NM", true); } catch (Exception ex) { MessageBox.Show(ex.Message); this.Close(); } }; } public override void searchProc() { try { if (UtilClass.isNull(lookUpEdit_COMP_CD.EditValue)) { return; } this.Cursor = Cursors.WaitCursor; gridControl_Main.DataSource = null; SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, lookUpEdit_COMP_CD.EditValue) }; ResultData resultData = ClientClass.GetData("GetHolidayManager", aParam); if (resultData.isError) { throw new Exception(resultData.ResultValue); } gridControl_Main.DataSource = resultData.TableData; this.Cursor = Cursors.Arrow; } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } } public override void newProc() { if (UtilClass.isNull(lookUpEdit_COMP_CD.EditValue)) { return; } bandedGridView_Main.PostEditor(); bandedGridView_Main.UpdateCurrentRow(); bandedGridView_Main.AddNewRow(); DataRow row = bandedGridView_Main.GetFocusedDataRow(); row["COMP_CD"] = lookUpEdit_COMP_CD.EditValue; row["SOLAR_YN"] = "Y"; bandedGridView_Main.PostEditor(); bandedGridView_Main.UpdateCurrentRow(); bandedGridView_Main.FocusedColumn = bandedGridView_Main.Columns["MMDD"]; gridControl_Main.Focus(); bandedGridView_Main.Focus(); } public override void deleteProc() { bandedGridView_Main.DeleteSelectedRows(); } public override void excelProc() { this.ExportExcelGrid(gridControl_Main); } public override void saveProc() { try { this.Cursor = Cursors.WaitCursor; bandedGridView_Main.PostEditor(); bandedGridView_Main.UpdateCurrentRow(); Application.DoEvents(); DataTable aData = gridControl_Main.DataSource as DataTable; if (aData.GetChanges() == null) { throw new Exception("변경된 내용이 없습니다."); } DataTable srcData = UtilClass.GetDataTable(aData, true, "COMP_CD", "MMDD", "SOLAR_YN", "SOLAR_NM", "LUNAR_YN", "LUNAR_NM", "LUNAR_PRE_DD", "LUNAR_NEXT_DD"); for (int i = 0; i < srcData.Rows.Count; i++) { if (UtilClass.isNull(srcData.Rows[i]["MMDD"])) { throw new Exception("월일은 필수입력입니다. 누락된 항목이 있습니다."); } } srcData.TableName = "ADATA"; ResultData data1 = new ResultData(); data1.TableData = srcData; ResultData[] dataList = new ResultData[] { data1 }; SerializedSqlParam[] aParam = new SerializedSqlParam[] { ClientClass.CreateSqlParameter("REG_ID", SqlDbType.NVarChar, ConstClass._USR_ID) }; ResultData result = ClientClass.SetTableData("SaveHolidayManager", dataList, aParam); if (result.isError) { throw new Exception(result.ResultValue); } this.Cursor = Cursors.Arrow; MessageBox.Show("저장 완료"); searchProc(); } catch (Exception ex) { this.Cursor = Cursors.Arrow; MessageBox.Show(ex.Message); } } } }