275 lines
11 KiB
C#
275 lines
11 KiB
C#
|
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
using Cosmos.UserFrame;
|
|||
|
using Cosmos.ServiceProvider;
|
|||
|
using Cosmos.Common;
|
|||
|
using Cosmos.CommonManager;
|
|||
|
using System.Drawing;
|
|||
|
|
|||
|
namespace Cosmos.Win
|
|||
|
{
|
|||
|
public partial class frmBirthdayCandle : Form
|
|||
|
{
|
|||
|
#region Variable
|
|||
|
|
|||
|
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
|
|||
|
private PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조
|
|||
|
private DeviceStatus m_cDevStatus = new DeviceStatus(); // 디바이스 관리
|
|||
|
|
|||
|
//private string m_sPosMenuKeyIn;
|
|||
|
//public string PosMenuKeyIn { set { m_sPosMenuKeyIn = value; } get { return m_sPosMenuKeyIn; } }
|
|||
|
//private string m_sPosMenuKeyOut;
|
|||
|
//public string PosMenuKeyOut { set { m_sPosMenuKeyOut = value; } get { return m_sPosMenuKeyOut; } }
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 생성자 & 소멸자
|
|||
|
public frmBirthdayCandle()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
|
|||
|
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
|
|||
|
|
|||
|
m_cPosStatus = (PosStatus)StateObject.POS;
|
|||
|
m_cDevStatus = (DeviceStatus)StateObject.DEVICE;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 폼로드
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void frmBirthdayCandle_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();
|
|||
|
txtBrith.Select();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 폼 클로즈
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void frmBirthdayCandle_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
|
|||
|
{
|
|||
|
picBack.Image = ImageManager.GetImage(Cosmos.BaseFrame.BaseCom.NxImgPath, ImageManager.POP_SIZE_S);
|
|||
|
btnExit.Image = ImageManager.GetImage(Cosmos.BaseFrame.BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
|
|||
|
|
|||
|
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);
|
|||
|
|
|||
|
btnExit.Image = ImageManager.GetImage(Cosmos.BaseFrame.BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
|
|||
|
if (btnExit.Image != null) btnExit.Text = "";
|
|||
|
|
|||
|
FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
|
|||
|
|
|||
|
//테마색상 적용!
|
|||
|
padInPut.ThemeColor = m_cPosStatus.ScnMst.ThemeColor;
|
|||
|
padInPut.ClearBtnText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0817);
|
|||
|
btnFinish.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);
|
|||
|
|
|||
|
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1014);
|
|||
|
lblBrith.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1015);
|
|||
|
lblCandle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1017);
|
|||
|
lblMsgDesc.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1015) + " Ex) 1981";
|
|||
|
|
|||
|
btnFinish.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0248);
|
|||
|
btnEnter.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1016);
|
|||
|
|
|||
|
padInPut.BtnDotEnable = false;
|
|||
|
txtBrith.InputType = UI.InputType.Digit;
|
|||
|
|
|||
|
txtCandle.Text = "";
|
|||
|
|
|||
|
|
|||
|
// 기능 버튼 설정 체크
|
|||
|
FormManager.SetbtnMenu(null, m_cDevStatus.ICReader.UseYn, btnMenu1, btnMenu2, btnMenu3, btnMenu4);
|
|||
|
|
|||
|
txtBrith.Value = "";
|
|||
|
|
|||
|
}
|
|||
|
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 Control Event
|
|||
|
/// <summary>
|
|||
|
/// 입력박스 이벤트
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="sFuncValue"></param>
|
|||
|
private void txtEditBox_EditBoxKeyDownEvent(object sender, string sFuncValue)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (sFuncValue == PosKey.MENU_KEY.ENTER)
|
|||
|
{
|
|||
|
txtCandle.Text = GetCandle(txtBrith.Text);
|
|||
|
}
|
|||
|
else if (sFuncValue == PosKey.MENU_KEY.CLEAR)
|
|||
|
{
|
|||
|
if (((Cosmos.UI.CsmPosEditBox)sender).ReadOnly == false) ((Cosmos.UI.CsmPosEditBox)sender).Text = "";
|
|||
|
}
|
|||
|
else if (sFuncValue == PosKey.MENU_KEY.ESC_PREVIOUS)
|
|||
|
{
|
|||
|
this.DialogResult = DialogResult.Cancel;
|
|||
|
this.Close();
|
|||
|
}
|
|||
|
}
|
|||
|
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>
|
|||
|
/// 입력박스 엔터 이벤트
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void txtEditBox_EnterEvent(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
padInPut.SetActiveControl = (Control)sender;
|
|||
|
|
|||
|
}
|
|||
|
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>
|
|||
|
/// 기능키
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void btnProc_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (((Cosmos.UI.CsmButton)sender) == btnFinish) // 종료
|
|||
|
{
|
|||
|
txtEditBox_EditBoxKeyDownEvent(null, PosKey.MENU_KEY.ESC_PREVIOUS);
|
|||
|
}
|
|||
|
else if (((Cosmos.UI.CsmButton)sender) == btnEnter) // 계산
|
|||
|
{
|
|||
|
txtEditBox_EditBoxKeyDownEvent(null, PosKey.MENU_KEY.ENTER);
|
|||
|
}
|
|||
|
|
|||
|
padInPut.SetActiveFocus();
|
|||
|
}
|
|||
|
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>
|
|||
|
/// 종료
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void btnExit_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
txtEditBox_EditBoxKeyDownEvent(null, PosKey.MENU_KEY.ESC_PREVIOUS);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 생일 지움 처리
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void txtBrith_EditBoxTextChangedEvnet(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
//if (txtBrith.Text == "")
|
|||
|
txtCandle.Text = "";
|
|||
|
}
|
|||
|
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 User Method
|
|||
|
/// <summary>
|
|||
|
/// 생일초 계산
|
|||
|
/// </summary>
|
|||
|
/// <param name="sinDate"></param>
|
|||
|
/// <returns></returns>
|
|||
|
private string GetCandle(string sinDate)
|
|||
|
{
|
|||
|
|
|||
|
long NowDate = 0;
|
|||
|
long InDate = 0;
|
|||
|
long iCandle = 1;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
if (sinDate.Trim() == "")
|
|||
|
{
|
|||
|
//생일을 입력하세요.
|
|||
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0673);
|
|||
|
return "";
|
|||
|
}
|
|||
|
else if (sinDate.Length != 4)
|
|||
|
{
|
|||
|
//생일을 확인하세요.
|
|||
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0674);
|
|||
|
return "";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
NowDate = CmUtil.LongParse(DateTime.Now.ToString("yyyy"));
|
|||
|
InDate = CmUtil.LongParse(sinDate);
|
|||
|
iCandle = NowDate - InDate + 1;
|
|||
|
}
|
|||
|
|
|||
|
iCandle = iCandle < 0 ? 0 : iCandle;
|
|||
|
|
|||
|
txtBrith.Focus();
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|||
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return m_cPosStatus.Global.NumericTOCurrency(iCandle);
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|