spc-kiosk-pb/Window/WinTable/frmRegStorNotice.cs

191 lines
7.9 KiB
C#
Raw Permalink Normal View History

2019-06-16 05:12:09 +00:00
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.UserFrame;
using Cosmos.BaseFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using Cosmos.UI;
namespace Cosmos.Win
{
public partial class frmRegStorNotice : Form
{
private SManager sManager = new SManager(); //이 객체를 통해 업무 Service 호출
private StateServer StateObject = (StateServer)StateServer.GetInstance(); //StateObject : StateServer Object(객체)
private PosStatus m_cPosStatus; //기본정보 참조
private TranStatus m_cTrnStatus; //거래정보 참조
private ITableUs m_cTableSvr = null; //테이블 서비스 관리
public frmRegStorNotice()
{
InitializeComponent();
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
//this.UpdateStyles();
m_cPosStatus = (PosStatus)StateObject.POS; //POS 기본정보
m_cTrnStatus = (TranStatus)StateObject.TRAN; //POS 거래정보
m_cTableSvr = (ITableUs)sManager.InitServiceInstance(ServiceLists.BSV_TABLE.DLL, ServiceLists.BSV_TABLE.TABLE_SERVICE);
}
private void From_Load(object sender, EventArgs e)
{
try
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");
InitControls();
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
ex.Message);
}
}
private void Form_Closing(object sender, FormClosingEventArgs e)
{
vScrollbar.Attach(null);
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", lblTitle.Text);
}
private void InitControls()
{
try
{
this.picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_S);
this.picBack.Location = new Point(0, 0);
this.picBack.SendToBack();
this.Size = this.picBack.Size = this.picBack.Image.Size;
FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT);
//테마색상 적용!
btnEnter.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
if (btnExit.Image != null) btnExit.Text = "";
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0157);
lblBBSTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0152);
lblBBSContents.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0156);
btnEnter.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0126);
tbTitle.Text = string.Empty;
tbContents.Text = string.Empty;
vScrollbar.Attach(tbContents);
btnEnter.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0009);
tbTitle.Select();
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
ex.Message);
}
}
private void btnEnter_Click(object sender, EventArgs e)
{
try
{
if(ActiveControl == tbTitle)
{
if (tbTitle.Text.Length > 0)
{
tbContents.Focus();
ActiveControl = tbContents;
}
}
else if(ActiveControl == tbContents)
{
if(tbContents.Text.Length > 0)
{
string sReturn = m_cTableSvr.RegisterStoreNotice(tbTitle.Text, tbContents.Text);
if(sReturn == UserCom.RST_OK)
{
this.DialogResult = DialogResult.OK;
this.Close();
}
else
{
WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0089);
}
}
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
ex.Message);
}
}
private void btnExit_Click(object sender, EventArgs e)
{
try
{
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);
}
}
private void EditBox_Enter(object sender, EventArgs e)
{
ActiveControl = (Control)sender;
}
private void EditBox_KeyDownEvent(object sender, string sFuncValue)
{
try
{
if (sender != tbTitle) return;
switch (sFuncValue)
{
case PosKey.MENU_KEY.ENTER:
btnEnter_Click(sender, null);
break;
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
ex.Message);
}
}
}
}