using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using Cosmos.UI;
namespace Cosmos.Win
{
///
/// 판매원(캐셔) 로그인 및 등록
///
public partial class frmLogOnCashier : Form
{
#region 변수선언 및 생성자
private SManager sManager = new SManager(); //이 객체를 통해 업무 Service 호출
private StateServer StateObject = (StateServer)StateServer.GetInstance(); //StateObject : StateServer Object(객체)
private PosStatus m_cPosStatus; //기본정보 참조
private TranStatus m_cTrnStatus; //거래정보 참조
private object ActiveTxtBox = null;
///
/// 담당자 ID
///
private string m_sCashierNo;
///
/// 담당자 패스워드
///
private string m_sCashierPwd;
private string m_sPosMenuKey;
///
/// 기능키
///
public string PosMenuKey { set { m_sPosMenuKey = value; } get { return m_sPosMenuKey; } }
private string m_sCashierInfo;
///
/// 등록된 판매원 정보
///
public string CashierInfo { set { m_sCashierInfo = value; } get { return m_sCashierInfo; } }
[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
public frmLogOnCashier()
{
InitializeComponent();
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
//this.UpdateStyles();
m_cPosStatus = (PosStatus)StateObject.POS; //POS 기본정보
m_cTrnStatus = (TranStatus)StateObject.TRAN; //POS 거래정보
LoadInPutKey();
}
private void frmLogOn_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();
this.Tag = "START";
}
private void frmLogOn_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);
}
private void frmLogOnCashier_Activated(object sender, EventArgs e)
{
if (this.Tag.ToString() == "START")
{
this.Tag = "";
CmUtil.IgnoreMouseClick(this); // 마우스 클릭 무시
}
SetForegroundWindow(this.Handle);
}
#endregion
#region InitControl 폼 컨트롤 초기화
///
/// 폼 컨트롤 초기화
///
private void InitControl()
{
try
{
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);
if (m_sPosMenuKey == PosKey.MENU_KEY.LOG_ON)
{
// 캐셔 로그인 화면 처리
this.Location = new Point(0, 0);
picBack.Location = new Point(0, 0);
if (System.IO.File.Exists(BaseCom.NxCDPPath + PosConst.MST_IMG_PATH.CDP_COM + m_cPosStatus.ScnMst.LoginImg) == false)
picBack.Image = ImageManager.GetImage(BaseCom.NxCDPPath + PosConst.MST_IMG_PATH.CDP_COM, ImageManager.LOGIN_BACKGROUND);
else
picBack.Image = ImageManager.GetImage(BaseCom.NxCDPPath + PosConst.MST_IMG_PATH.CDP_COM, m_cPosStatus.ScnMst.LoginImg);
picCILogo.Image = ImageManager.GetImage(BaseCom.NxCDPPath + PosConst.MST_IMG_PATH.CDP_COM, m_cPosStatus.ScnMst.BrandCiImg);
picCILogo.Parent = picBack;
if (picCILogo.Image != null)
CmUtil.FileCopy(BaseCom.NxCDPPath + PosConst.MST_IMG_PATH.CDP_COM + m_cPosStatus.ScnMst.BrandCiImg, BaseCom.NxCDPPath + PosConst.MST_IMG_PATH.CDP_COM + ImageManager.BRADN_CI, false);
else
picCILogo.Image = ImageManager.GetImage(BaseCom.NxCDPPath + PosConst.MST_IMG_PATH.CDP_COM, ImageManager.BRADN_CI);
btnAlphaLarge.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.LOGIN_ALPHAL);
btnAlphaSmall.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.LOGIN_ALPHAS);
btnNumber.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.LOGIN_NUMBER);
btnClear.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.LOGIN_CLAER);
btnExit.Image = null;
btnExit.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0008);
btnEnter.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0009);
btnEnter.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);
// Add, 2017.09.04, 로그인화면에 근태등록 바로가기 추가
btnRegInOut.Visible = true;
btnRegInOut.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0333);
btnRegInOut.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);
txtCashierNo.BackColor = Color.FromArgb(85, 85, 85);
txtCashierNm.BackColor = Color.FromArgb(85, 85, 85);
txtPassword.BackColor = Color.FromArgb(85, 85, 85);
txtCashierNo.ForeColor = Color.White;
txtCashierNm.ForeColor = Color.White;
txtPassword.ForeColor = Color.White;
if (m_cPosStatus.Sale.ScreenSizeUser == 800)
{
this.Size = new Size(800, 600);
picBack.Size = new Size(800, 600);
picCILogo.Location = new Point(0, 38);
picCILogo.Size = new Size(800, 78);
FormManager.SetControlSize(txtCashierNo, 165, 327, 86, 29, 16);
FormManager.SetControlSize(txtCashierNm, 159, 223, 118, 29, 16);
FormManager.SetControlSize(txtPassword, 165, 375, 86, 29, 16);
FormManager.SetControlSize(btnFuncChar, 282, 119, 455, 290);
//FormManager.SetControlSize(lblLineFunc, 362, 523, 580, 0);
FormManager.SetControlSize(btnAlphaLarge, 282, 408, 90, 73, 12);
FormManager.SetControlSize(btnAlphaSmall, 373, 408, 90, 73, 12);
FormManager.SetControlSize(btnNumber, 464, 408, 91, 73, 12);
FormManager.SetControlSize(btnClear, 555, 408, 182, 73, 12);
FormManager.SetControlSize(btnExit, 283, 481, 227, 74);
FormManager.SetControlSize(btnEnter, 510, 481, 227, 74);
}
else
{
this.Size = new Size(1024, 768);
picBack.Size = new Size(1024, 768);
picCILogo.Location = new Point(0, 49);
picCILogo.Size = new Size(1024, 78);
FormManager.SetControlSize(txtCashierNo, 210, 428, 120, 30, 17);
FormManager.SetControlSize(txtCashierNm, 216, 290, 145, 40, 17);
FormManager.SetControlSize(txtPassword, 210, 490, 120, 30, 17);
FormManager.SetControlSize(btnFuncChar, 364, 153, 578, 369);
FormManager.SetControlSize(lblLineFunc, 362, 523, 580, 0);
FormManager.SetControlSize(btnAlphaLarge, 364, 523, 115, 93, 14);
FormManager.SetControlSize(btnAlphaSmall, 479, 523, 115, 93, 14);
FormManager.SetControlSize(btnNumber, 594, 523, 115, 93, 14);
FormManager.SetControlSize(btnClear, 709, 523, 233, 93, 14);
FormManager.SetControlSize(btnExit, 362, 616, 290, 95);
FormManager.SetControlSize(btnEnter, 652, 616, 290, 95);
// Add, 2017.09.04, 로그인화면에 근태등록 바로가기 추가
// 2017.09.06 PC만 보이도록 변경.
btnRegInOut.Visible = false;
if (m_cPosStatus.Mst.CorpDiv.Equals(ItemConst.CORP_DIV.BR) == false)
{
btnRegInOut.Visible = true;
FormManager.SetControlSize(btnRegInOut, 82, 616, 280, 95);
}
}
picCILogo.Visible = true;
lblFuncChar.Visible = false;
lblLineFunc.Visible = false;
lblTitle.Visible = false;
lblCashierNo.Visible = false;
lblPassword.Visible = false;
lblLine1.Visible = false;
lblLine2.Visible = false;
lblLine3.Visible = false;
lblLine4.Visible = false;
lblLine5.Visible = false;
lblLine6.Visible = false;
txtPassword.Visible = true;
CustDspReLoad();
}
else
{
this.Size = new Size(800, 600);
// 이미지 로딩 처리
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_800X600);
picBack.Location = new Point(0, 0);
picBack.Size = new Size(800, 600);
picCILogo.Location = new Point(0, 49);
picCILogo.Size = new Size(864, 78);
btnAlphaLarge.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.LOGIN_ALPHAL2);
btnAlphaSmall.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.LOGIN_ALPHAS2);
btnNumber.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.LOGIN_NUMBER2);
btnClear.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.LOGIN_CLAER2);
FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
if (m_sPosMenuKey == PosKey.MENU_KEY.REGISTER_ADMIN)
{
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0506);
lblCashierNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0507);
}
//#20171107 통제관리 start, phj
else if (m_sPosMenuKey == PosKey.MENU_KEY.AUTHORITY_CNTL)
{
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1078);
lblCashierNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0507);
}
//#20171107 통제관리 end, phj
else if (m_sPosMenuKey == PosKey.MENU_KEY.SIMPLE_LOG_ON)
{
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0011);
lblCashierNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0149);
}
else
{
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0148);
lblCashierNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0149);
}
lblPassword.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0013);
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
btnExit.Text = btnExit.Image != null ? "" : "X";
btnEnter.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0009);
btnEnter.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);
FormManager.SetControlSize(lblCashierNo, 24, 69, 120, 38);
FormManager.SetControlSize(lblPassword, 495, 69, 120, 38);
FormManager.SetControlSize(txtCashierNo, 161, 75, 155, 25, 14);
FormManager.SetControlSize(txtCashierNm, 323, 75, 154, 25, 14);
FormManager.SetControlSize(txtPassword, 633, 75, 127, 25, 14);
FormManager.SetControlSize(lblFuncChar, 24, 124, 754, 361);
FormManager.SetControlSize(btnFuncChar, 25, 125, 752, 359);
FormManager.SetControlSize(btnAlphaLarge, 24, 485, 150, 92, 15);
FormManager.SetControlSize(btnAlphaSmall, 174, 485, 150, 92, 15);
FormManager.SetControlSize(btnNumber, 324, 485, 150, 92, 15);
FormManager.SetControlSize(btnClear, 474, 485, 150, 92, 15);
FormManager.SetControlSize(btnEnter, 625, 485, 153, 92);
FormManager.SetControlSize(btnExit, 741, 1, 58, 50);
txtCashierNo.BackColor = Color.FromArgb(249, 253, 254);
txtCashierNm.BackColor = Color.FromArgb(249, 253, 254); //Color.FromArgb(235, 235, 235);
txtPassword.BackColor = Color.FromArgb(249, 253, 254);
txtCashierNo.ForeColor = Color.Black;
txtCashierNm.ForeColor = Color.Black;
txtPassword.ForeColor = Color.Black;
picCILogo.Visible = false;
lblFuncChar.Visible = true;
lblLineFunc.Visible = false;
lblTitle.Visible = true;
lblCashierNo.Visible = true;
lblPassword.Visible = true;
lblLine1.Visible = true;
lblLine2.Visible = true;
lblLine3.Visible = true;
lblLine4.Visible = true;
lblLine5.Visible = true;
lblLine6.Visible = true;
txtPassword.Visible = true;
// Add, 2017.09.04, 로그인화면에 근태등록 바로가기 추가
btnRegInOut.Visible = false;
if (m_sPosMenuKey == PosKey.MENU_KEY.REGISTER_SERVER)
{
// 판매원(담당자) 입력
lblPassword.Visible = false;
lblLine4.Visible = false;
txtPassword.Visible = false;
}
}
btnAlphaLarge.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0029) + PosConst.CRLF;
btnAlphaLarge.Tag = PosKey.MENU_KEY.LOGIN_ALPHALARGE;
btnAlphaSmall.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0030) + PosConst.CRLF;
btnAlphaSmall.Tag = PosKey.MENU_KEY.LOGIN_ALPHASMALL;
btnNumber.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0031) + PosConst.CRLF;
btnNumber.Tag = PosKey.MENU_KEY.LOGIN_NUMBER;
btnClear.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0032) + PosConst.CRLF;
btnClear.Tag = PosKey.MENU_KEY.CLEAR;
m_sCashierNo = "";
m_sCashierPwd = "";
m_sCashierInfo = "";
txtCashierNo.Text = "";
txtPassword.Text = "";
txtCashierNm.Text = "";
ActiveTxtBox = txtCashierNo;
btnFuncChar.DisplayFuncButton("1");
//if (picCILogo.Image.Width > picCILogo.Width || picCILogo.Image.Height > picCILogo.Height)
//{
// if (picCILogo.Image.Width < picCILogo.Width)
// {
// picCILogo.Left = (picCILogo.Width - picCILogo.Image.Width) / 2;
// picCILogo.Width = picCILogo.Image.Width;
// }
// picCILogo.SizeMode = PictureBoxSizeMode.StretchImage;
//}
//else
//{
// picCILogo.SizeMode = PictureBoxSizeMode.CenterImage;
//}
txtCashierNo.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);
}
}
#endregion
#region LoadInPutKey 버튼 로딩
private bool LoadInPutKey()
{
bool bRet = false;
try
{
// 문자 기능키 초기화
btnFuncChar.SetFuncButtonCount(2, 5); // 버튼갯수 설정
btnFuncChar.VisibleUpDown = false;
btnFuncChar.BackColor = CmUtil.GetColorToString("202207213");
btnFuncChar.BackColorUpDown = Color.White;
btnFuncChar.ClearFuncButtonInfo(); // 설정된 메뉴정보 초기화
for (int iRow = 1; iRow < 11; iRow++)
{
Cosmos.UI.CsmFunc.FuncBtnInfo cFuncInfo = new Cosmos.UI.CsmFunc.FuncBtnInfo();
cFuncInfo.sGroupCode = "1"; // 분류코드
cFuncInfo.nSeqNo = iRow; // 표시순번
if (iRow == 10)
{
cFuncInfo.sFuncText = "0"; // 기능 명
cFuncInfo.sFuncCode = "0";
}
else
{
cFuncInfo.sFuncText = iRow.ToString(); // 기능 명
cFuncInfo.sFuncCode = iRow.ToString();
}
cFuncInfo.cBackColor = Color.White; // 백 컬러
cFuncInfo.cForeColor = Color.Black; // 명 컬러
cFuncInfo.fFontSize = 16; // 명 폰트 사이즈
cFuncInfo.nButtonSize = 0; // 버튼 사이즈(0:일반,1:가로확대,2:세로확대,3:가로세로확대)
btnFuncChar.AddFuncButtonInfo(cFuncInfo);
}
int iSeq = 1;
int iSmallChr = 32;
for (int iRow = 65; iRow <= 90; iRow++)
{
//대문자
Cosmos.UI.CsmFunc.FuncBtnInfo cFuncInfoD = new Cosmos.UI.CsmFunc.FuncBtnInfo();
cFuncInfoD.sGroupCode = "2"; // 분류코드
cFuncInfoD.nSeqNo = iSeq; //표시순번
cFuncInfoD.sFuncText = ((char)iRow).ToString(); // 기능 명
cFuncInfoD.sFuncCode = ((char)iRow).ToString();
cFuncInfoD.cBackColor = Color.White; // 백 컬러
cFuncInfoD.cForeColor = Color.Black; // 명 컬러
cFuncInfoD.fFontSize = 16; // 명 폰트 사이즈
cFuncInfoD.nButtonSize = 0; // 버튼 사이즈(0:일반,1:가로확대,2:세로확대,3:가로세로확대)
//소문자
Cosmos.UI.CsmFunc.FuncBtnInfo cFuncInfoS = new Cosmos.UI.CsmFunc.FuncBtnInfo();
cFuncInfoS.sGroupCode = "3"; // 분류코드
cFuncInfoS.nSeqNo = iSeq; //표시순번
cFuncInfoS.sFuncText = ((char)(iRow + iSmallChr)).ToString();
cFuncInfoS.sFuncCode = ((char)(iRow + iSmallChr)).ToString();
cFuncInfoS.cBackColor = Color.White; // 백 컬러
cFuncInfoS.cForeColor = Color.Black; // 명 컬러
cFuncInfoS.fFontSize = 16; // 명 폰트 사이즈
cFuncInfoS.nButtonSize = 0; // 버튼 사이즈(0:일반,1:가로확대,2:세로확대,3:가로세로확대)
btnFuncChar.AddFuncButtonInfo(cFuncInfoD);
btnFuncChar.AddFuncButtonInfo(cFuncInfoS);
iSeq++;
}
bRet = true;
}
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 bRet;
}
#endregion
#region 컨트롤 이벤트 처리
///
/// 버튼 입력 처리
///
///
///
private void btnProc_Click(object sender, EventArgs e)
{
try
{
if (((CsmButton)sender) == btnEnter)
{
txtEditBox_EditBoxKeyDownEvent(ActiveTxtBox, PosKey.MENU_KEY.ENTER);
}
else if (((CsmButton)sender) == btnExit)
{
txtEditBox_EditBoxKeyDownEvent(ActiveTxtBox, PosKey.MENU_KEY.ESC_PREVIOUS);
}
else if (((CsmButton)sender) == btnClear)
{
txtEditBox_EditBoxKeyDownEvent(ActiveTxtBox, PosKey.MENU_KEY.CLEAR);
}
else if (((CsmButton)sender) == btnAlphaLarge)
{
btnFuncChar.SetFuncButtonCount(4, 7);
btnFuncChar.DisplayFuncButton("2");
}
else if (((CsmButton)sender) == btnAlphaSmall)
{
btnFuncChar.SetFuncButtonCount(4, 7);
btnFuncChar.DisplayFuncButton("3");
}
else if (((CsmButton)sender) == btnNumber)
{
btnFuncChar.SetFuncButtonCount(2, 5);
btnFuncChar.DisplayFuncButton("1");
}
else if (sender == btnRegInOut)
{
// Add, 2017.09.04, 로그인화면에 근태등록 바로가기 추가
if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT307), "1") == "0")
{
//해당 기능은 POS 옵션에서 미사용으로 되어 있습니다.
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0414);
}
else
{
WinBasic.ShowForm(new string[] { FormManager.FORM_ETC_CHECK_EMP, PosKey.MENU_KEY.REG_IN_OUT });
}
}
}
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 txtEditBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
txtEditBox_EditBoxKeyDownEvent(sender, PosKey.MENU_KEY.ENTER);
}
}
///
/// 텍스트 박스 입력 완료 처리
///
///
///
private void txtEditBox_EditBoxKeyDownEvent(object sender, string sFuncValue)
{
try
{
switch (sFuncValue)
{
case PosKey.MENU_KEY.FORWARD:
if (sender == txtCashierNo)
{
txtPassword.Focus();
txtPassword.SelectAll();
}
break;
case PosKey.MENU_KEY.ENTER:
if (CheckTxtInput(sender) == false) return;
if (sender == txtCashierNo)
{
if (m_sPosMenuKey == PosKey.MENU_KEY.REGISTER_SERVER)
{
if (txtCashierNo.Text.Length == 0 || txtCashierNo.Text != m_sCashierNo)
SearchTxtInPut();
else
CompleteTxtInPut();
}
else
{
SearchTxtInPut();
}
}
if (sender == null || sender == txtPassword)
{
CompleteTxtInPut();
}
break;
case PosKey.MENU_KEY.BACKWARD:
if (sender == txtPassword) txtCashierNo.Select();
break;
case PosKey.MENU_KEY.CLEAR:
if (sender is TextBox)
{
TextBox tb = (TextBox)sender;
if (tb.ReadOnly == false)
{
tb.Text = "";
if (sender == txtCashierNo) txtCashierNm.Text = "";
}
}
break;
case PosKey.MENU_KEY.ESC_PREVIOUS:
this.DialogResult = DialogResult.Cancel;
this.Close();
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);
}
}
private void txtEditBox_Enter(object sender, EventArgs e)
{
//ActiveControl = (Control)sender;
ActiveTxtBox = (Control)sender;
}
private void InputPad(object sender, string sFuncValue)
{
try
{
if (sender is TextBox)
{
var txtBox = (TextBox)sender;
var selStart = txtBox.SelectionStart;
var value1st = (selStart >= 0) ? txtBox.Text.Substring(0, selStart) : string.Empty;
var value2nd = txtBox.Text.Substring(selStart + txtBox.SelectionLength);
var value = string.Format("{0}{1}{2}", value1st, sFuncValue, value2nd);
if (value.Length > txtBox.MaxLength) return;
txtBox.Text = value;
if (txtBox.Text.Length > 0 && selStart >= txtBox.Text.Length)
txtBox.SelectionStart = txtBox.Text.Length;
else
txtBox.SelectionStart = selStart + 1;
txtBox.SelectionLength = 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);
}
}
private void btnFuncChar_FuncClickHandler(object sender, string sFuncCode)
{
try
{
InputPad(ActiveTxtBox, sFuncCode);
}
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 bool CheckTxtInput(object sender)
{
try
{
// POS 마스터 유무 체크
DataRow dr = PosMstManager.GetMstPos();
if (dr == null)
{
// POS 마스터가 존재 하지 않습니다. \n 고객센터에 문의하여 주시기 바랍니다.
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0604);
return false;
}
if(sender == null || sender == txtCashierNo) //캐셔번호 입력체크
{
if (txtCashierNo.Text.Length == 0)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0001);
txtCashierNo.Focus();
txtCashierNo.SelectAll();
return false;
}
if (sender == txtCashierNo)
{
if (m_sPosMenuKey != PosKey.MENU_KEY.REGISTER_SERVER)
{
txtPassword.Focus();
txtPassword.SelectAll();
}
}
}
if (sender == null || sender == txtPassword) //비밀번호 입력체크
{
if (m_sPosMenuKey != PosKey.MENU_KEY.REGISTER_SERVER)
{
if (txtPassword.Text.Length == 0)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0002);
txtPassword.Focus();
txtPassword.SelectAll();
return false;
}
}
}
return true;
}
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 false;
}
}
///
/// 캐셔 마스터 조회 처리
///
///
private bool SearchTxtInPut()
{
DataTable dtCashierInfo;
try
{
if (CheckTxtInput(txtCashierNo) == false) return false;
m_sCashierNo = "";
m_sCashierPwd = "";
txtCashierNm.Text = "";
// 캐셔마스터 조회
IMasterUs cService = (IMasterUs)sManager.InitServiceInstance(ServiceLists.ASV_MASTER.DLL, ServiceLists.ASV_MASTER.CASHIER_MASTER);
// 판매원 조회
dtCashierInfo = cService.Select(new string[] { m_cPosStatus.Base.StoreNo, txtCashierNo.Text });
if (dtCashierInfo == null || dtCashierInfo.Rows.Count == 0)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0006);
txtCashierNo.Focus();
txtCashierNo.SelectAll();
return false;
}
if (m_sPosMenuKey == PosKey.MENU_KEY.REGISTER_ADMIN)
{
string sDiv = CmUtil.GetDataRowStr(dtCashierInfo.Rows[0], PosMst.MST_USER.DATA.CASHIER_DIV);
if ( sDiv != PosConst.CASHIER_DIV.OWNER && sDiv != PosConst.CASHIER_DIV.MANAGER)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0309);
txtCashierNo.Focus();
txtCashierNo.SelectAll();
return false;
}
}
m_sCashierNo = txtCashierNo.Text;
m_sCashierPwd = CmUtil.GetDataRowStr(dtCashierInfo.Rows[0], PosMst.MST_USER.DATA.CASHIER_PWD);
txtCashierNm.Text = CmUtil.GetDataRowStr(dtCashierInfo.Rows[0], PosMst.MST_USER.DATA.CASHIER_NM);
return true;
}
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 false;
}
}
///
/// 텍스트박스 입력 완료 처리
///
///
///
private bool CompleteTxtInPut()
{
try
{
if (CheckTxtInput(null) == false) return false;
if (txtCashierNo.Text != m_sCashierNo)
{
if (SearchTxtInPut() == false) return false;
}
if (m_sPosMenuKey == PosKey.MENU_KEY.LOG_ON || m_sPosMenuKey == PosKey.MENU_KEY.SIMPLE_LOG_ON)
{
// 캐셔 로그인 처리
IServiceUs cService = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.CASHIER_LOG_ON);
// 캐셔번호(0), 비밀번호(1)
string sRet = cService.Execute(new string[] { txtCashierNo.Text, txtPassword.Text,""});
if (sRet != UserCom.RST_OK)
{
txtPassword.Text = "";
return false;
}
}
else if (m_sPosMenuKey == PosKey.MENU_KEY.TEST_MODE)
{
// 시험모드 판매원 등록 처리
if (txtPassword.Text.Length == 0 || txtPassword.Text != m_sCashierPwd)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0002);
txtPassword.Focus();
txtPassword.SelectAll();
return false;
}
}
//#20171107 통제관리 start, phj
else if (m_sPosMenuKey == PosKey.MENU_KEY.AUTHORITY_CNTL)
{
// 캐셔 로그인 처리
IServiceUs cService = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.CASHIER_LOG_ON);
// 캐셔번호(0), 비밀번호(1)
string sRet = cService.Execute(new string[] { txtCashierNo.Text, txtPassword.Text, "", PosKey.MENU_KEY.AUTHORITY_CNTL });
if (sRet != UserCom.RST_OK)
{
//WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0310);
txtPassword.Text = "";
txtPassword.Focus();
txtPassword.SelectAll();
return false;
}
}
//#20171107 통제관리 end, phj
else if (m_sPosMenuKey == PosKey.MENU_KEY.REGISTER_ADMIN)
{
// 판매원 권한 관리
if (txtPassword.Text.Length == 0 || txtPassword.Text != m_sCashierPwd)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0310);
txtPassword.Focus();
txtPassword.SelectAll();
return false;
}
}
else if (m_sPosMenuKey == PosKey.MENU_KEY.REGISTER_SERVER)
{
// 주문 담당자 등록 처리
m_cTrnStatus.Head.OrderPicNo = m_cPosStatus.Base.StoreNo + txtCashierNo.Text;
m_cTrnStatus.Head.OrderPicNm = txtCashierNm.Text;
}
m_sCashierInfo = m_cPosStatus.Base.StoreNo + txtCashierNo.Text + "|" + txtCashierNm.Text;
this.DialogResult = DialogResult.OK;
this.Close();
return true;
}
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 false;
}
}
///
/// 고객 미디어 재 로드
///
private void CustDspReLoad()
{
try
{
//이미지인 경우 리플레이스 되면서 검은색으로 표시되어 로그인시 재 로드 해 준다
ICustDisplayUs m_cCustDisp = (ICustDisplayUs)sManager.InitServiceInstance(ServiceLists.ASV_CUSTDISPLAY.DLL, ServiceLists.ASV_CUSTDISPLAY.CUST_DISPLAY);
if (m_cCustDisp != null)
m_cCustDisp.StartCustDisplay(); // 고객용화면 시작
}
catch (Exception ex)
{
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
}
}