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 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_MACH
{
public partial class CompManager : PublicLib.CommonMDI
{
public CompManager()
{
InitializeComponent();
gridView_Main.FocusedRowChanged += (sender, e) =>
{
DataRow row = gridView_Main.GetFocusedDataRow();
gridView_Main.Columns["COMP_CD"].OptionsColumn.AllowEdit = row != null && (row.RowState == DataRowState.Added || row.RowState == DataRowState.Detached);
};
DataView natnView = new DataView(ConstClass._DATA);
natnView.RowFilter = "CATE_CD = 'C' and GRP_CD = 'C02'";
UtilClass.SetLookup(repositoryItemLookUpEdit_NATN_CD, natnView, "NO_CD", "NO_CD_NM", true);
repositoryItemButtonEdit_POST_NO.ButtonClick += (sender, e) =>
{
DataRow row = gridView_Main.GetFocusedDataRow();
if (row == null)
{
return;
}
PostNoForm form = new PostNoForm();
if (form.ShowDialog() == DialogResult.Yes)
{
row["POST_NO"] = form.ResultRow["POST_NO"];
row["ADDR1"] = form.ResultRow["ADDR1"];
row["ADDR2"] = "";
gridView_Main.FocusedColumn = gridView_Main.Columns["ADDR2"];
}
};
this.Shown += (sender, e) =>
{
searchProc();
};
}
public override void deleteProc()
{
try
{
DataRow row = gridView_Main.GetFocusedDataRow();
if (row == null)
{
throw new Exception("삭제할 데이터를 선택하십시오.");
}
this.Cursor = Cursors.WaitCursor;
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, row["COMP_CD"]),
ClientClass.CreateSqlParameter("RESULT_STR", SqlDbType.NVarChar, "", ParameterDirection.Output, 1000)
};
ResultData result = ClientClass.SetData("DeleteCompManager", aParam);
if (result.isError || !UtilClass.isNull(result.ResultValue))
{
throw new Exception(result.ResultValue);
}
this.Cursor = Cursors.Arrow;
MessageBox.Show("삭제 완료!");
searchProc();
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
MessageBox.Show(ex.Message);
}
}
public override void searchProc()
{
try
{
this.Cursor = Cursors.WaitCursor;
gridControl_Main.DataSource = null;
ResultData resultData = ClientClass.GetData("GetCompManager", null);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
gridControl_Main.DataSource = resultData.TableData;
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
m_Searching = false;
this.Cursor = Cursors.Arrow;
MessageBox.Show(ex.Message);
}
}
public override void excelProc()
{
ExportExcelGrid(gridControl_Main);
}
public override void newProc()
{
gridView_Main.AddNewRow();
}
public override void saveProc()
{
try
{
this.Cursor = Cursors.WaitCursor;
gridView_Main.PostEditor();
gridView_Main.UpdateCurrentRow();
Application.DoEvents();
DataTable aData = gridControl_Main.DataSource as DataTable;
DataTable dtData = UtilClass.GetDataTable(aData, true, "COMP_CD", "COMP_NM", "NATN_CD", "POST_NO", "ADDR1",
"ADDR2", "TEL_NO", "FAX_NO", "MAIL_ADDR", "HOME_PAGE_NM", "BUSI_NO", "MAJR_NM", "COND_NM", "EVNT_NM","DEL_YN");
if (dtData == null || dtData.Rows.Count < 1)
{
throw new Exception("변경된 정보가 없습니다.");
}
for (int i = 0; i < dtData.Rows.Count; i++)
{
if (UtilClass.isNull(dtData.Rows[i]["COMP_CD"]))
{
throw new Exception("회사코드가 누락된 데이터가 있습니다.");
}
else if (UtilClass.isNull(dtData.Rows[i]["COMP_NM"]))
{
throw new Exception(UtilClass.toStr(dtData.Rows[i]["COMP_CD"]) + " 의 회사명이 누락되었습니다.");
}
}
dtData.TableName = "ADATA";
ResultData data1 = new ResultData();
data1.TableData = dtData;
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 result = ClientClass.SetTableData("SaveCompManager", dataList, aParam);
if (result.isError || !UtilClass.isNull(result.ResultValue))
{
throw new Exception(result.ResultValue);
}
this.Cursor = Cursors.Arrow;
MessageBox.Show("저장 완료!");
searchProc();
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
MessageBox.Show(ex.Message);
}
}
}
}