spc-kiosk-pb/Window/WinAdmin/frmCustomerClaimsList.cs
2019-06-16 14:12:09 +09:00

385 lines
20 KiB
C#

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;
using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using Cosmos.CommonManager;
using Cosmos.ServiceProvider;
using Cosmos.Common;
namespace Cosmos.Win
{
public partial class frmCustomerClaimsList : Form
{
#region
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
private PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조
private IDataProcessUs m_cDataService = null;
private ICustomerService m_cCustomer = null; // 고객 클레임 처리 인터페이스
private DataTable m_dtItemInit; // 조회 데이터 리스트
#endregion
#region &
public frmCustomerClaimsList()
{
InitializeComponent();
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
//this.UpdateStyles();
m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
m_cDataService = (IDataProcessUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_SERVICE);
m_cCustomer = (ICustomerService)sManager.InitServiceInstance(ServiceLists.BSV_ADMIN.DLL, ServiceLists.BSV_ADMIN.CUSTOMER_CLAIM); // 고객 클레임 처리 인터페이스
}
private void frmCustomerClaims_Load(object sender, EventArgs e)
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");
// 콘트롤 초기화 처리
InitControl();
string sSaleDate = m_cPosStatus.Global.CultureToDate(txtDate.Text).Substring(0, 6); // YYYYMM
// 고객 불편사항 리스트 조회
GetCustomerClaimList(sSaleDate);
}
private void frmCustomerClaimsList_FormClosing(object sender, FormClosingEventArgs e)
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", lblTitle.Text);
}
#endregion &
#region
/// <summary>
/// 폼 컨트롤 초기화
/// </summary>
private void InitControl()
{
try
{
if (m_cPosStatus.Sale.ScreenSizeUser == 1024)
{
// 이미지 로딩 처리
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_FULL_SIZE);
//this.Size = new Size(1024, 696);
//this.Location = new Point(0, 50);
FormManager.SetControlSize(picBack, 0, 0, 1024, 696);
FormManager.SetControlSize(this, 0, 50, picBack.Size.Width, picBack.Size.Height);
FormManager.SetControlSize(this.btnExit, 965, 1, 58, 50);
FormManager.SetControlSize(this.lblDate, 16, 68, 122, 40);
FormManager.SetControlSize(this.label1, 16, 67, 350, 2);
FormManager.SetControlSize(this.lblTitle, 16, 1, 950, 50);
FormManager.SetControlSize(this.btnModify, 908, 68, 100, 40);
FormManager.SetControlSize(this.btnInput, 806, 68, 100, 40);
FormManager.SetControlSize(this.btnUp, 978, 123, 30, 279);
FormManager.SetControlSize(this.btnDw, 978, 401, 30, 279);
FormManager.SetControlSize(this.dgvData, 16, 123, 963, 556);
FormManager.SetControlSize(this.label3, 16, 122, 992, 2);
FormManager.SetControlSize(this.btnDate, 320, 72, 30, 30);
FormManager.SetControlSize(this.txtDate, 153, 72, 166, 30);
FormManager.SetControlSize(this.lblBox1, 137, 68, 229, 40);
}
else
{
// 이미지 로딩 처리
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_800X600);
FormManager.SetControlSize(picBack, 0, 0, 800, 600);
FormManager.SetControlSize(this, 0, 0, picBack.Size.Width, picBack.Size.Height);
FormManager.SetControlSize(this.lblTitle, 16, 1, 714, 50);
FormManager.SetControlSize(this.btnExit, 741, 1, 58, 50);
FormManager.SetControlSize(this.lblDate, 22, 68, 122, 40);
FormManager.SetControlSize(this.label1, 22, 67, 350, 2);
FormManager.SetControlSize(this.btnModify, 678, 68, 100, 40);
FormManager.SetControlSize(this.btnInput, 576, 68, 100, 40);
FormManager.SetControlSize(this.btnUp, 748, 123, 30, 228);
FormManager.SetControlSize(this.btnDw, 748, 350, 30, 228);
FormManager.SetControlSize(this.dgvData, 22, 123, 727, 454);
FormManager.SetControlSize(this.label3, 22, 122, 756, 2);
FormManager.SetControlSize(this.btnDate, 326, 72, 30, 30);
FormManager.SetControlSize(this.txtDate, 159, 72, 166, 30);
FormManager.SetControlSize(this.lblBox1, 143, 68, 229, 40);
}
FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT);
FormManager.SetTextBoxGlobalInfo(this, m_cPosStatus.Global.m_stCultureMaster.nGroupingDigits, m_cPosStatus.Global.m_stCultureMaster.strGroupingSymbol
, m_cPosStatus.Global.m_stCultureMaster.nDecimalDigits, m_cPosStatus.Global.m_stCultureMaster.strDecimalSymbol);
FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
//picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_FULL_SIZE);
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
if (btnExit.Image != null) btnExit.Text = "";
btnDate.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.ICON_DATE_BASIC);
if (btnDate.Image != null) btnDate.Text = "";
btnUp.Image = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_14X9_UP1_BASIC);
btnDw.Image = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_14X9_DOWN1_BASIC);
if (btnUp.Image != null) btnUp.Text = "";
if (btnDw.Image != null) btnDw.Text = "";
// 라벨 이름 설정
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0407);
lblDate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0408);
// 버튼 이름 설정
btnInput.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0126);
btnModify.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0409);
txtDate.InputTypeFormat = m_cPosStatus.Global.m_stCultureMaster.strDatePattern;
txtDate.Text = m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate);
// 그리드 설정
SetListColumn();
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
/// <summary>
/// 고객 불편사항 정보에 대한 DataGridView 초기화
/// </summary>
private void SetListColumn()
{
try
{
// 고객불만사항 정보
dgvData.CsmGridColumnHeadersVisible = true; //DataGridView 자체의 컬럼 헤더 Visible 여부
dgvData.CsmGridColumnHeadersFont = new Font(m_cPosStatus.Base.FONT, 12, FontStyle.Bold); //DataGridView 자체의 컬럼 헤더 폰트
dgvData.CsmGridColumnCount = 6; //그리드의 컬럼수
dgvData.CsmGridSetHeaderBackColor(236, 238, 239); //그리드 헤더 배경색
dgvData.CsmGridDefaultRowBackColor = Color.FromArgb(255, 255, 255); //그리드 홀수(Default)행의 배경색 지정
dgvData.CsmGridAlternateRowBackColor = Color.FromArgb(251, 253, 255); //그리드 짝수(Alternate)행의 배경색 지정
dgvData.CsmGridBackGroundColor = Color.FromArgb(251, 253, 255); //기본 백그라운드 컬러
dgvData.CsmGridHighlightColor = Color.FromArgb(255, 251, 211); //그리드 선택 백 컬러
dgvData.CsmGridHighlightTextColor = Color.Black; //그리드 선택 글자 컬러
dgvData.CsmGridAlignment(new int[] { 1, 1, 1, 1, 0, 0 }); //컬럼 정렬 0:왼쪽, 1:가운데, 2:오른쪽
if (m_cPosStatus.Sale.ScreenSizeUser == 1024)
{
dgvData.CsmGridColumnHeadersHeight = 36; //DataGridView 자체의 컬럼 헤더 높이
dgvData.CsmGridRowsHeight = 37;
dgvData.CsmGridShowPageRowsCount = 14; //그리드의 한 화면에 보이는 로우수
dgvData.CsmGridSetColumnWidth(new int[] { 107, 62, 137, 127, 262, 268 }); //컬럼넓이 지정(963)
}
else
{
dgvData.CsmGridColumnHeadersHeight = 34; //DataGridView 자체의 컬럼 헤더 높이
dgvData.CsmGridRowsHeight = 38;
dgvData.CsmGridShowPageRowsCount = 11; //그리드의 한 화면에 보이는 로우수
dgvData.CsmGridSetColumnWidth(new int[] { 97, 52, 117, 107, 162, 200 }); //컬럼넓이 지정(727)
}
//각 컬럼별 이름 지정
dgvData.CsmGridColumnName(0, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0408));
dgvData.CsmGridColumnName(1, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0410));
dgvData.CsmGridColumnName(2, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0278));
dgvData.CsmGridColumnName(3, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0411));
dgvData.CsmGridColumnName(4, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0412));
dgvData.CsmGridColumnName(5, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0413));
//그리드 초기화 테이블
m_dtItemInit = new DataTable("INIT");
m_dtItemInit.Columns.Add(new DataColumn("SALE_DT", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("SEQ", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("CUST_NM", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("CLAIM_PRC_COST", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("ITEM_SNM", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("CLAIM_PRC_MEMO", typeof(string)));
m_dtItemInit.Clear();
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
}
#endregion
#region Control Event
#region
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
#endregion
#region
/// <summary>
/// 등록버튼
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnInput_Click(object sender, EventArgs e)
{
string sRet = UserCom.RST_ERR;
string sSearchInfo = "";
try
{
sRet = WinAdmin.ShowForm(new string[] { FormManager.FORM_SAL_CUSTOMER_CLAIMS_INPUT, PosKey.MENU_KEY.CUSTOMER_CLAIMS_INPUT, sSearchInfo });
if (sRet != UserCom.RST_OK) return;
string sSaleDate = m_cPosStatus.Global.CultureToDate(txtDate.Text).Substring(0, 6); // YYYYMM
// 신규등록을 완료한 경우 목록 재 조회
GetCustomerClaimList(sSaleDate);
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
#region
private void btnModify_Click(object sender, EventArgs e)
{
string sRet = UserCom.RST_ERR;
string sSearchInfo = "";
try
{
if (dgvData.CsmGridRowsCount <= 0)
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0418));
return;
}
if (dgvData.CsmGridSelectedRowIndex < 0)
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0419));
return;
}
// 선택한 Row의 상세조회를 위한 파라메터 값을 넘겨준다. (일자, SEQ)
// POS번호는 상세조회에 안쓰는게 좋을듯 하다.. 같은 매장의 여러대의 POS가 있을 경우도 생각
sSearchInfo = dgvData.CsmGridGetCell(dgvData.CsmGridSelectedRowIndex, 0) + "|" + dgvData.CsmGridGetCell(dgvData.CsmGridSelectedRowIndex, 1);
sRet = WinAdmin.ShowForm(new string[] { FormManager.FORM_SAL_CUSTOMER_CLAIMS_INPUT, PosKey.MENU_KEY.CUSTOMER_CLAIMS_INPUT, sSearchInfo });
if (sRet != UserCom.RST_OK) return;
string sSaleDate = m_cPosStatus.Global.CultureToDate(txtDate.Text).Substring(0, 6); // YYYYMM
// 신규등록을 완료한 경우 목록 재 조회
GetCustomerClaimList(sSaleDate);
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
#region
private void dtpSearchDate_ValueChanged(object sender, EventArgs e)
{
string sSaleDate = m_cPosStatus.Global.CultureToDate(txtDate.Text).Substring(0, 6); // YYYYMM
// 재조회
GetCustomerClaimList(sSaleDate);
}
#endregion
#endregion Control Event
#region User Method
/// <summary>
/// 계정선택 DataGridView와 Data 연결
/// </summary>
/// <param name="sSearchDate">접수일자</param>
public void GetCustomerClaimList(string sSearchDate)
{
try
{
DataTable dtData = new DataTable();
dtData = m_cCustomer.SearchCustomerList(sSearchDate);
if (dtData == null || dtData.Rows.Count < 1)
{
//데이터 없음!
dgvData.CsmGridDataSource = m_dtItemInit;
}
else
{
foreach (DataRow dr in dtData.Rows)
{
dr[PosEtc.CUSTOMER_CLAIM_INFO.DATA.SALE_DT] = m_cPosStatus.Global.DateToCulture(dr[PosEtc.CUSTOMER_CLAIM_INFO.DATA.SALE_DT].ToString());
dr[PosEtc.CUSTOMER_CLAIM_INFO.DATA.CLAIM_PRC_COST] = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(dr[PosEtc.CUSTOMER_CLAIM_INFO.DATA.CLAIM_PRC_COST].ToString()));
}
//그리드 적용!
dgvData.CsmGridDataSource = dtData;
dgvData.CsmGridSelectRow(0);
}
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR,
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
ex.Message);
}
}
#region /
/// <summary>
/// 조회 그리드 업/다운 클릭 이벤트
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSelProc_Click(object sender, EventArgs e)
{
if ((UI.CsmButton)sender == btnUp)
{
dgvData.CsmGridScroll("UP");
}
else if ((UI.CsmButton)sender == btnDw)
{
dgvData.CsmGridScroll("DOWN");
}
}
#endregion /
private void btnDate_Click(object sender, EventArgs e)
{
try
{
string sDate = WinBasic.ShowForm(new string[] { FormManager.FORM_CALENDAR });
if (sDate != "") txtDate.Text = m_cPosStatus.Global.DateToCulture(sDate);
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion User Method
}
}