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

302 lines
13 KiB
C#

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using System.Threading;
using System.Collections;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 :
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Win
{
public partial class frmSelectBtnMsgCom : Form
{
#region Variable
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
private PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조
private TranStatus m_cTrnStatus = new TranStatus(); // 거래정보 참조
private string m_sPosMenuKey;
public string SetPosMenuKey { set { this.m_sPosMenuKey = value; } }
private string m_sPosMsg;
public string SetPosMsg { set { this.m_sPosMsg = value; } }
private string m_sPosMenuKeyOut;
public string PosMenuKeyOut { set { m_sPosMenuKeyOut = value; } get { return m_sPosMenuKeyOut; } }
private ArrayList AlMenu01 = new ArrayList();
private ArrayList AlMenu02 = new ArrayList();
private readonly string SELECT_FORECOLOR_1 = "000000000"; //선택 글자 컬러1
private readonly string SELECT_FORECOLOR_2 = "121153025"; //선택 글자 컬러2
private readonly string SELECT_FORECOLOR_3 = "000169221"; //선택 글자 컬러3
private readonly string SELECT_FORECOLOR_4 = "231126015"; //선택 글자 컬러4
#endregion
#region &
/// <summary>
/// 생성자
/// </summary>
public frmSelectBtnMsgCom()
{
InitializeComponent();
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
//this.UpdateStyles();
m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
m_cTrnStatus = (TranStatus)StateObject.TRAN; // POS 거래정보
}
/// <summary>
/// 폼로드
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmSelectBtnMsgCom_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();
}
/// <summary>
/// 폼클로즈
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmSelectBtnMsgCom_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 + "()", "");
}
/// <summary>
/// 폼엑티브
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmSelectBtnMsgCom_Activated(object sender, EventArgs e)
{
}
/// <summary>
/// 폼디엑티브
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmSelectBtnMsgCom_Deactivate(object sender, EventArgs e)
{
}
#endregion &
#region
/// <summary>
/// 폼 컨트롤 초기화
/// </summary>
private void InitControl()
{
try
{
// 이미지 로딩 처리
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.SCH_MESSAGE_BOX);
FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT);
FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
//테마색상 적용!
btnEnter.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);
btnEnter.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0126);
btnMenu01.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_BLUE_BASIC);
btnMenu01.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_BLUE_PRESS);
btnMenu02.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_ORANGE_BASIC);
btnMenu02.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.MENU_BTN_ORANGE_PRESS);
if (m_sPosMenuKey == PosKey.MENU_KEY.TAKE_IN_OUT)
{
lblMsg.Visible = false;
btnEnter.Visible = false;
FormManager.SetControlSize(btnMenu01, 106, 78, 240, 60);
FormManager.SetControlSize(btnMenu02, 449, 78, 240, 60);
lblMsg.Text = "";
btnMenu01.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0302);
btnMenu01.Tag = "1";
btnMenu01.ForeColor = CmUtil.GetColorToString(SELECT_FORECOLOR_3);
btnMenu02.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0303);
btnMenu02.Tag = "2";
btnMenu02.ForeColor = CmUtil.GetColorToString(SELECT_FORECOLOR_4);
}
else
{
lblMsg.Visible = true;
btnEnter.Visible = true;
FormManager.SetControlSize(lblMsg, 12, 20, 765, 86);
FormManager.SetControlSize(btnEnter, 633, 116, 120, 60);
FormManager.SetControlSize(btnMenu01, 37, 116, 240, 60);
FormManager.SetControlSize(btnMenu02, 298, 116, 240, 60);
lblMsg.Text = m_sPosMsg;
AlMenu01.Clear();
AlMenu02.Clear();
//[TO DELIVERY, 직원]은 추후 사용하면 주석만 풀어주면됨!
AlMenu01.Add(new string[] { "0", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1003), SELECT_FORECOLOR_1, "1" }); //TO STAY
AlMenu01.Add(new string[] { "1", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1004), SELECT_FORECOLOR_2, "2" }); //TO GO
//AlMenu01.Add(new string[] { "2", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1005), SELECT_FORECOLOR_3, "3" }); //TO DELIVERY
AlMenu02.Add(new string[] { "0", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0910), SELECT_FORECOLOR_1, "0" }); //일반
AlMenu02.Add(new string[] { "1", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1006), SELECT_FORECOLOR_2, "1" }); //VIP
//AlMenu02.Add(new string[] { "2", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1007), SELECT_FORECOLOR_3, "2" }); //직원
//17.09.13 dkshin SS 해피오더 수정 - 직원 보이게 수정
AlMenu02.Add(new string[] { "2", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1007), SELECT_FORECOLOR_3, "2" }); //직원
btnMenu01.Text = ((string[])AlMenu01[0])[1];
btnMenu01.ForeColor = CmUtil.GetColorToString(((string[])AlMenu01[0])[2]);
btnMenu01.Tag = ((string[])AlMenu01[0])[0];
btnMenu02.Text = ((string[])AlMenu02[0])[1];
btnMenu02.ForeColor = CmUtil.GetColorToString(((string[])AlMenu02[0])[2]);
btnMenu02.Tag = ((string[])AlMenu02[0])[0];
}
}
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
/// <summary>
/// 버튼 입력 처리
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnProc_Click(object sender, EventArgs e)
{
try
{
if (((Cosmos.UI.CsmButton)sender) == btnEnter) // 등록
{
if (m_sPosMenuKey == PosKey.MENU_KEY.TAKE_IN_OUT)
{
m_sPosMenuKeyOut = ((Cosmos.UI.CsmButton)sender).Tag.ToString();
}
else
{
m_sPosMenuKeyOut = string.Format("{0}|{1}"
, ((string[])AlMenu01[CmUtil.IntParse(btnMenu01.Tag.ToString())])[3], ((string[])AlMenu02[CmUtil.IntParse(btnMenu02.Tag.ToString())])[3]);
//return;
}
}
else if (((Cosmos.UI.CsmButton)sender) == btnMenu01 || ((Cosmos.UI.CsmButton)sender) == btnMenu02) // 선택 버튼
{
if (m_sPosMenuKey == PosKey.MENU_KEY.TAKE_IN_OUT)
{
m_sPosMenuKeyOut = ((Cosmos.UI.CsmButton)sender).Tag.ToString();
}
else
{
SelectChageBotton(sender, ((Cosmos.UI.CsmButton)sender).Tag.ToString());
return;
}
}
this.DialogResult = System.Windows.Forms.DialogResult.OK;
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);
}
}
#endregion
#region User Method
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="sSeq"></param>
private void SelectChageBotton(object sender, string sSeq)
{
try
{
int iSeq = CmUtil.IntParse(sSeq) + 1;
if ((UI.CsmButton)sender == btnMenu01)
{
if (iSeq >= AlMenu01.Count)
{
btnMenu01.Text = ((string[])AlMenu01[0])[1];
btnMenu01.ForeColor = CmUtil.GetColorToString(((string[])AlMenu01[0])[2]);
btnMenu01.Tag = ((string[])AlMenu01[0])[0];
}
else
{
btnMenu01.Text = ((string[])AlMenu01[iSeq])[1];
btnMenu01.ForeColor = CmUtil.GetColorToString(((string[])AlMenu01[iSeq])[2]);
btnMenu01.Tag = ((string[])AlMenu01[iSeq])[0];
}
}
else if ((UI.CsmButton)sender == btnMenu02)
{
if (iSeq >= AlMenu02.Count)
{
btnMenu02.Text = ((string[])AlMenu02[0])[1];
btnMenu02.ForeColor = CmUtil.GetColorToString(((string[])AlMenu02[0])[2]);
btnMenu02.Tag = ((string[])AlMenu02[0])[0];
}
else
{
btnMenu02.Text = ((string[])AlMenu02[iSeq])[1];
btnMenu02.ForeColor = CmUtil.GetColorToString(((string[])AlMenu02[iSeq])[2]);
btnMenu02.Tag = ((string[])AlMenu02[iSeq])[0];
}
}
}
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
}
}