using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.IO;
using System.ComponentModel;
using System.Windows.Input;
using System.Windows.Media.Animation;
using System.Windows;
using System.Collections.ObjectModel;
//using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Threading;
#region SPC.Kiosk
using SPC.Kiosk.Common;
using SPC.Kiosk.Base;
using SPC.Kiosk.PB.Model;
using SPC.Kiosk.Popup;
using SPC.Kiosk.Popup.Model;
using SPC.Kiosk.Popup.ViewModel;
using SPC.Kiosk.Payments;
using SPC.Kiosk.DataHelper;
#endregion
namespace SPC.Kiosk.PB.ViewModel
{
///
/// PBPaymentsWindow View Model
///
public class PBPaymentsViewModel : PopupViewModelBase
{
#region [ Members ]
private PosDataService posDataService = null;
public bool FirstLoaded { get; set; } = true;
private PopupManager popupManager = PopupManager.GetInstance;
///
/// Wait Wiondow
///
public WaitWindow WaitWindowFrom { get; set; }
private PBPaymentPageType defaultPage = PBPaymentPageType.DetailBasket;
private NhsFuncInfoItem nhsFuncInfo;
///
/// NHS Func Info
///
public NhsFuncInfoItem NhsFuncInfo
{
get { return nhsFuncInfo; }
set { nhsFuncInfo = value; PropertyChange("NhsFuncInfo"); }
}
///
/// Default Page
///
public PBPaymentPageType DefaultPage
{
get { return defaultPage; }
set { defaultPage = value; PropertyChange("DefaultPage"); }
}
private string optionValue802;
///
/// 진동벨 사용유무
///
public string OptionValue802
{
get { return optionValue802; }
set { optionValue802 = value; PropertyChange("OptionValue802"); }
}
private string optionValue803;
///
/// 알림톡 사용유무
///
public string OptionValue803
{
get { return optionValue803; }
set { optionValue803 = value; PropertyChange("OptionValue803"); }
}
private string optionValue804;
///
/// 대기번호 사용유무
///
public string OptionValue804
{
get { return optionValue804; }
set { optionValue804 = value; PropertyChange("OptionValue804"); }
}
#region BaseValue
private ObservableCollection detailBasketData;
///
/// Detail Basket Data
///
public ObservableCollection DetailBasketData
{
get { return detailBasketData; }
set
{
if (detailBasketData is ObservableCollection
&& detailBasketData.Count > 0)
{
foreach (var DetailItem in detailBasketData)
{
DetailItem.PropertyChanged -= DetailItem_PropertyChanged;
}
}
detailBasketData = value;
PropertyChange("DetailBasketData");
}
}
private ObservableCollection discountValues;
///
/// 할인 금액,결제 금액,사은품
///
public ObservableCollection DiscountValues
{
get { return discountValues; }
set { discountValues = value; PropertyChange("DiscountValues"); }
}
private ObservableCollection scanBarcodeBasketData;
///
/// ScanBarcode Detail Basket Data
///
public ObservableCollection ScanBarcodeBasketData
{
get { return scanBarcodeBasketData; }
set
{
scanBarcodeBasketData = value; PropertyChange("ScanBarcodeBasketData");
}
}
private ObservableCollection orderBasketData;
///
/// Order Detail Basket Data
///
public ObservableCollection OrderBasketData
{
get { return orderBasketData; }
set
{
orderBasketData = value; PropertyChange("OrderBasketData");
}
}
private M_HappyPointReturn happyPointReturn;
///
/// HappyPoint Data
///
public M_HappyPointReturn HappyPointReturn
{
get { return happyPointReturn; }
set { happyPointReturn = value; PropertyChange("HappyPointReturn"); }
}
private M_OkCashBagReturn okCashBagReturn;
///
/// Ok CashBag Data
///
public M_OkCashBagReturn OkCashBagReturn
{
get { return okCashBagReturn; }
set { okCashBagReturn = value; PropertyChange("OkCashBagReturn"); }
}
private M_MobileCompanyReturn mobileCompanyReturn;
///
/// MobileCompany Discount Data
///
public M_MobileCompanyReturn MobileCompanyReturn
{
get { return mobileCompanyReturn; }
set { mobileCompanyReturn = value; PropertyChange("MobileCompanyReturn"); }
}
private M_PaymentReturn paymentReturn;
///
/// Payments Return
///
public M_PaymentReturn PaymentReturn
{
get { return paymentReturn; }
set { paymentReturn = value; PropertyChange("PaymentReturn"); }
}
///
/// Payments End Return
///
private M_PaymentEndReturn paymentEndReturn;
///
/// Payments Return
///
public M_PaymentEndReturn PaymentEndReturn
{
get { return paymentEndReturn; }
set { paymentEndReturn = value; PropertyChange("PaymentEndReturn"); }
}
private M_MobileCouponReturn mobileCouponReturn;
///
/// Mobile Coupon Return
///
public M_MobileCouponReturn MobileCouponReturn
{
get { return mobileCouponReturn; }
set { mobileCouponReturn = value; PropertyChange("MobileCouponReturn"); }
}
private M_HappyCoupon usingHappyAppCoupon;
///
/// Used Happy Coupon
///
public M_HappyCoupon UsingHappyAppCoupon
{
get { return usingHappyAppCoupon; }
set { usingHappyAppCoupon = value; PropertyChange("UsingHappyAppCoupon"); }
}
#endregion
#region GMB
#region GMB Left
///
/// Gmb Logo
///
public string GmbLogo { get; set; } = ResourceManager.GetNximagePathAdd("Img_main_logo.png", CommonValue.PBdesignImagesPath);
#endregion
#region GMB Center
private List gMBHeaderText;
///
/// Top Header Text
///
public List GMBHeaderText
{
get { return gMBHeaderText; }
set { gMBHeaderText = value; PropertyChange("GMBHeaderText"); }
}
private string gmbMemberName;
///
/// Gmb Member Name
/// ///
public string GmbMemberName
{
get { return gmbMemberName; }
set { gmbMemberName = value; PropertyChange("GmbMemberName"); }
}
private bool memberLoginOK = false;
///
/// Member Login OK
///
public bool MemberLoginOK
{
get { return memberLoginOK; }
set { memberLoginOK = value; PropertyChange("MemberLoginOK"); }
}
#endregion
#region GMB Right
///
/// GMB HappyPoint image
///
public string GmbHappyPointimage { get; set; } = ResourceManager.GetNximagePathAdd("btn_happypoint_d.png", CommonValue.PBdesignImagesPath);
///
/// GMB HappyPoint Disable Image
///
public string GmbHappyPointDisable { get; set; } = ResourceManager.GetNximagePathAdd("btn_happypoint_n.png", CommonValue.PBdesignImagesPath);
///
/// GMB Call Employee Image
///
public string GmbCallimage { get; set; } = ResourceManager.GetNximagePathAdd("btn_help.png", CommonValue.PBdesignImagesPath);
///
/// GMB Goto Home Image
///
public string GmbHomeimage { get; set; } = ResourceManager.GetNximagePathAdd("btn_reset.png", CommonValue.PBdesignImagesPath);
private string gmbLanguageimage = ResourceManager.GetNximagePathAdd("btn_language_kor.png", CommonValue.PBdesignImagesPath);
///
/// GMB Language Image
///
public string GmbLanguageimage
{
get { return gmbLanguageimage; }
set { gmbLanguageimage = value; PropertyChange("GmbLanguageimage"); }
}
private bool gmbHome = true;
///
/// GMB Goto Home Enabled
/// GMB Language
///
public bool GmbHome
{
get { return gmbHome; }
set { gmbHome = value; PropertyChange("GmbHome"); }
}
private bool gmbHappyPointEnable = true;
///
/// Gmb Happy Point Button Enable
///
public bool GmbHappyPointEnable
{
get { return gmbHappyPointEnable; }
set { gmbHappyPointEnable = value; PropertyChange("GmbHappyPointEnable"); }
}
private bool gmbEmpCall = true;
///
/// GMB Call Employee Enabled
///
public bool GmbEmpCall
{
get { return gmbEmpCall; }
set { gmbEmpCall = value; PropertyChange("GmbEmpCall"); }
}
private bool gmbLanguage = true;
///
/// GMB Language Enabled
///
public bool GmbLanguage
{
get { return gmbLanguage; }
set { gmbLanguage = value; PropertyChange("GmbLanguage"); }
}
///
/// GMB Call Employee Command
///
public ICommand CallEmployeeCommand { get; protected set; } = null;
///
/// GMB Language Command
///
public ICommand LanguageCommand { get; protected set; } = null;
///
/// GMB Goto Intro Page Commad
///
public ICommand GotoIntroPageCommad { get; protected set; } = null;
#endregion
#endregion
#region Contents
///
/// Info Logo
///
public string InfoLogo { get; set; } = ResourceManager.GetNximagePathAdd("ic_info.png", CommonValue.PBdesignImagesPath);
///
/// Info x mark Logo
///
public string InfoLogoX { get; set; } = ResourceManager.GetNximagePathAdd("ic_info_x.png", CommonValue.PBdesignImagesPath);
///
/// Step Buttons Background
///
public string ButtonBackground { get; set; } = ResourceManager.GetNximagePathAdd("step_bg.png", CommonValue.PBdesignImagesPath);
///
/// Step1 Selected Brush
///
public string Step1DisableBrush { get; set; } = ResourceManager.GetNximagePathAdd("step01.png", CommonValue.PBdesignImagesPath);
///
/// Step2 Selected Brush
///
public string Step2DisableBrush { get; set; } = ResourceManager.GetNximagePathAdd("step02.png", CommonValue.PBdesignImagesPath);
///
/// Step3 Selected Brush
///
public string Step3DisableBrush { get; set; } = ResourceManager.GetNximagePathAdd("step03.png", CommonValue.PBdesignImagesPath);
///
/// Basket All Delete Brush
///
public string BasketDeleteBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_basket_delete.png", CommonValue.PBdesignImagesPath);
///
/// Basket EMpty Brush
///
public string BasketNoneBrush { get; set; } = ResourceManager.GetNximagePathAdd("bg_basket_none.png", CommonValue.PBdesignImagesPath);
private bool gotoPointsDisCountsEnable = true;
///
/// Goto Point & Discount Enabled
///
public bool GotoPointsDisCountsEnable
{
get { return gotoPointsDisCountsEnable; }
set { gotoPointsDisCountsEnable = value; PropertyChange("GotoPointsDisCountsEnable"); }
}
///
/// Goto Point & Discount Command
///
public ICommand GotoPointsDisCountsCommand { get; protected set; } = null;
private bool gotoCouponUsePointsEnable = true;
///
/// Goto Coupon & Using Points Enabled
///
public bool GotoCouponUsePointsEnable
{
get { return gotoCouponUsePointsEnable; }
set { gotoCouponUsePointsEnable = value; PropertyChange("GotoCouponUsePointsEnable"); }
}
///
/// Goto Coupon & Using Points Command
///
public ICommand GotoCouponUsePointsCommand { get; protected set; } = null;
private bool gotoPaymentExcuteEnable = true;
///
/// Goto Payment Execute Enabled
///
public bool GotoPaymentExcuteEnable
{
get { return gotoPaymentExcuteEnable; }
set { gotoPaymentExcuteEnable = value; PropertyChange("GotoPaymentExcuteEnable"); }
}
///
/// Goto Payment Execute Command
///
public ICommand GotoPaymentExcuteCommand { get; protected set; } = null;
#region Detail Basket
///
/// Page to Left Normal Image
///
public string Page2LeftNormalImage { get; set; } = ResourceManager.GetNximagePathAdd("btn_page_before_n.png", CommonValue.PBdesignImagesPath);
///
/// Page to Right Normal Image
///
public string Page2RightNormalImage { get; set; } = ResourceManager.GetNximagePathAdd("btn_page_after_n.png", CommonValue.PBdesignImagesPath);
private bool scanPage2LeftEnable;
///
/// Scan Page 2 Left Button Enabled
///
public bool ScanPage2LeftEnable
{
get { return scanPage2LeftEnable; }
set { scanPage2LeftEnable = value; PropertyChange("ScanPage2LeftEnable"); }
}
private bool scanPage2RightEnable;
///
/// Scan Page to Right Button Enabled
///
public bool ScanPage2RightEnable
{
get { return scanPage2RightEnable; }
set { scanPage2RightEnable = value; PropertyChange("ScanPage2RightEnable"); }
}
private bool orderPage2LeftEnable;
///
/// Order Page to Left Button Enabled
///
public bool OrderPage2LeftEnable
{
get { return orderPage2LeftEnable; }
set { orderPage2LeftEnable = value; PropertyChange("OrderPage2LeftEnable"); }
}
private bool orderPage2RightEnable;
///
/// Order Page to Right Button Enabled
///
public bool OrderPage2RightEnable
{
get { return orderPage2RightEnable; }
set { orderPage2RightEnable = value; PropertyChange("OrderPage2RightEnable"); }
}
private int scanItemCount;
///
/// Scan Items Count
///
public int ScanItemCount
{
get { return scanItemCount; }
set { scanItemCount = value; PropertyChange("ScanItemCount"); }
}
private int scanItemPageNo;
///
/// Scan Items Page No
///
public int ScanItemPageNo
{
get { return scanItemPageNo; }
set { scanItemPageNo = value; PropertyChange("ScanItemPageNo"); }
}
private int scanItemPageCount;
///
/// Scan Items Page Count
///
public int ScanItemPageCount
{
get { return scanItemPageCount; }
set { scanItemPageCount = value; PropertyChange("ScanItemPageCount"); }
}
private int orderItemCount;
///
/// Order Items Count
///
public int OrderItemCount
{
get { return orderItemCount; }
set { orderItemCount = value; PropertyChange("OrderItemCount"); }
}
private int orderItemPageNo;
///
/// Order Items PageNo
///
public int OrderItemPageNo
{
get { return orderItemPageNo; }
set { orderItemPageNo = value; PropertyChange("OrderItemPageNo"); }
}
private int orderItemPageCount;
///
/// Order Items Page Count
///
public int OrderItemPageCount
{
get { return orderItemPageCount; }
set { orderItemPageCount = value; PropertyChange("OrderItemPageCount"); }
}
private ObservableCollection scanItemPageStatus;
///
/// Scan Items Page Selector Data
///
public ObservableCollection ScanItemPageStatus
{
get { return scanItemPageStatus; }
set { scanItemPageStatus = value; PropertyChange("ScanItemPageStatus"); }
}
private ObservableCollection orderItemPageStatus;
///
/// Order Items Page Salector Data
///
public ObservableCollection OrderItemPageStatus
{
get { return orderItemPageStatus; }
set { orderItemPageStatus = value; PropertyChange("OrderItemPageStatus"); }
}
private int scanPageStatusColumnCount;
///
/// Scan Item Page Selector Column Count
///
public int ScanPageStatusColumnCount
{
get { return scanPageStatusColumnCount; }
set { scanPageStatusColumnCount = value; PropertyChange("ScanPageStatusColumnCount"); }
}
private int orderPageStatusColumnCount;
///
/// Order Items Page Selector Column Count
///
public int OrderPageStatusColumnCount
{
get { return orderPageStatusColumnCount; }
set { orderPageStatusColumnCount = value; PropertyChange("OrderPageStatusColumnCount"); }
}
///
/// Scan Item Page to Left Command
///
public ICommand ScanPage2LeftCommand { get; protected set; } = null;
///
/// Scan Item Page to Right Command
///
public ICommand ScanPage2RightCommand { get; protected set; } = null;
///
/// Order Item Page to left Command
///
public ICommand OrderPage2LeftCommand { get; protected set; } = null;
///
/// Order Item Page to right Command
///
public ICommand OrderPage2RightCommand { get; protected set; } = null;
///
/// Scan Page Selector Command
///
public ICommand ScanPageSelectCommand { get; protected set; } = null;
///
/// Order Page Selector Command
///
public ICommand OrderPageSelectCommand { get; protected set; } = null;
///
/// Scan Items Delete Command
///
public ICommand ScanBarcodeDeleteCommand { get; protected set; } = null;
///
/// Order Item Delete Command
///
public ICommand OrderDeleteCommand { get; protected set; } = null;
///
/// Scan Items All Delete Command
///
public ICommand ScanBarcodeAllDeleteCommand { get; protected set; } = null;
///
/// Order Items All Delete Command
///
public ICommand OrderAllDeleteCommand { get; protected set; } = null;
#endregion
#region PointsDisCounts
///
/// Happy Point Resrve Noraml Brush
///
public string HappyPointResrveNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_happypoint_n.png", CommonValue.PBdesignImagesPath);
///
/// Happy Point Resrve SwitchOn Brush
///
public string HappyPointResrveSwitchOnBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_happypoint_f.png", CommonValue.PBdesignImagesPath);
///
/// Happy Point Resrve Disabled Brush
///
public string HappyPointResrveDisableBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_happypoint_d.png", CommonValue.PBdesignImagesPath);
private bool happyPointResrveSwitch;
///
/// Happy Point Resrve Switch
///
public bool HappyPointResrveSwitch
{
get { return happyPointResrveSwitch; }
set { happyPointResrveSwitch = value; PropertyChange("HappyPointResrveSwitch"); }
}
private bool happyPointResrveEnable = true;
///
/// Happy Point Resrve Enable
///
public bool HappyPointResrveEnable
{
get { return happyPointResrveEnable; }
set { happyPointResrveEnable = value; PropertyChange("HappyPointResrveEnable"); }
}
///
/// Happy Point Resrve Command
///
public ICommand HappyPointResrveCommand { get; protected set; } = null;
///
/// OkCashBag Resrve Noraml Brush
///
public string OkCashBagResrveNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_ocb_n.png", CommonValue.PBdesignImagesPath);
///
/// OkCashBag Resrve SwitchOn Brush
///
public string OkCashBagResrveSwitchOnBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_ocb_f.png", CommonValue.PBdesignImagesPath);
///
/// OkCashBag Resrve Disabled Brush
///
public string OkCashBagResrveDisableBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_ocb_d.png", CommonValue.PBdesignImagesPath);
private bool okCashBagResrveSwitch;
///
/// OkCashBag Resrve Switch
///
public bool OkCashBagResrveSwitch
{
get { return okCashBagResrveSwitch; }
set { okCashBagResrveSwitch = value; PropertyChange("OkCashBagResrveSwitch"); }
}
private bool okCashBagResrveEnable = true;
///
/// OkCashBag Resrve Enabled
///
public bool OkCashBagResrveEnable
{
get { return okCashBagResrveEnable; }
set { okCashBagResrveEnable = value; PropertyChange("OkCashBagResrveEnable"); }
}
///
/// OkCashBag Resrve Command
///
public ICommand OkCashBagResrveCommand { get; protected set; } = null;
///
/// Discount SK Noraml Brush
///
public string DiscountSKNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_sk_n.png", CommonValue.PBdesignImagesPath);
///
/// Discount SK SwitchOn Brush
///
public string DiscountSKSwitchOnBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_sk_f.png", CommonValue.PBdesignImagesPath);
///
/// Discount SK Disables Brush
///
public string DiscountSKDisableBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_sk_d.png", CommonValue.PBdesignImagesPath);
private bool discountSKSwitch;
///
/// Discount SK Switch
///
public bool DiscountSKSwitch
{
get { return discountSKSwitch; }
set { discountSKSwitch = value; PropertyChange("DiscountSKSwitch"); }
}
private bool discountSKEnable = true;
///
/// Discount SK Enable
///
public bool DiscountSKEnable
{
get { return discountSKEnable; }
set { discountSKEnable = value; PropertyChange("DiscountSKEnable"); }
}
///
/// Discount SK Command
///
public ICommand DiscountSKCommand { get; protected set; } = null;
///
/// Discount KT Noraml Brush
///
public string DiscountKTNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_kt_n.png", CommonValue.PBdesignImagesPath);
///
/// Discount KT SwitchOn Brush
///
public string DiscountKTSwitchOnBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_kt_f.png", CommonValue.PBdesignImagesPath);
///
/// Discount KT Disabled Brush
///
public string DiscountKTDisableBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_kt_d.png", CommonValue.PBdesignImagesPath);
private bool discountKTSwitch;
///
/// Discount KT Switch
///
public bool DiscountKTSwitch
{
get { return discountKTSwitch; }
set { discountKTSwitch = value; PropertyChange("DiscountKTSwitch"); }
}
private bool discountKTEnable = true;
///
/// Discount KT Enabled
///
public bool DiscountKTEnable
{
get { return discountKTEnable; }
set { discountKTEnable = value; PropertyChange("DiscountKTEnable"); }
}
///
/// Discount KT Command
///
public ICommand DiscountKTCommand { get; protected set; } = null;
///
/// Discount LG Noraml Brush
///
public string DiscountLGNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_lg_n.png", CommonValue.PBdesignImagesPath);
///
/// Discount LG SwitchOn Brush
///
public string DiscountLGSwitchOnBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_lg_f.png", CommonValue.PBdesignImagesPath);
///
/// Discount LG Disables Brush
///
public string DiscountLGDisableBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_lg_d.png", CommonValue.PBdesignImagesPath);
private bool discountLGSwitch;
///
/// Discount LG Switch
///
public bool DiscountLGSwitch
{
get { return discountLGSwitch; }
set { discountLGSwitch = value; PropertyChange("DiscountLGSwitch"); }
}
private bool discountLGEnable = true;
///
/// Discount LG Enabled
///
public bool DiscountLGEnable
{
get { return discountLGEnable; }
set { discountLGEnable = value; PropertyChange("DiscountLGEnable"); }
}
///
/// Discount LG Command
///
public ICommand DiscountLGCommand { get; protected set; } = null;
///
/// SpcDiscount2 Noraml Brush
///
public string SpcDiscount2NoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_spc2_n.png", CommonValue.PBdesignImagesPath);
///
/// SpcDiscount2 SwitchOn Brush
///
public string SpcDiscount2SwitchOnBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_spc2_f.png", CommonValue.PBdesignImagesPath);
///
/// OkCashBag Resrve Disabled Brush
///
public string SpcDiscount2DisableBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_spc2_d.png", CommonValue.PBdesignImagesPath);
private bool spcDiscount2Switch;
///
/// SpcDiscount2 Switch
///
public bool SpcDiscount2Switch
{
get { return spcDiscount2Switch; }
set { spcDiscount2Switch = value; PropertyChange("SpcDiscount2Switch"); }
}
private bool spcDiscount2Enable = true;
///
/// SpcDiscount2 Resrve Enabled
///
public bool SpcDiscount2Enable
{
get { return spcDiscount2Enable; }
set { spcDiscount2Enable = value; PropertyChange("SpcDiscount2Enable"); }
}
///
/// SpcDiscount2 Command
///
public ICommand SpcDiscount2Command { get; protected set; } = null;
#endregion
#region CouponUsePoints
///
/// Happy Point Using Noraml Brush
///
public string HappyPointUsingNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_happypoint_n.png", CommonValue.PBdesignImagesPath);
///
/// Happy Point Using SwitchOn Brush
///
public string HappyPointUsingSwitchOnBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_happypoint_f.png", CommonValue.PBdesignImagesPath);
///
/// Happy Point Using Disabled Brush
///
public string HappyPointUsingDisableBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_happypoint_d.png", CommonValue.PBdesignImagesPath);
private bool happyPointUsingSwitch;
///
/// Happy Point Using Switch
///
public bool HappyPointUsingSwitch
{
get { return happyPointUsingSwitch; }
set { happyPointUsingSwitch = value; PropertyChange("HappyPointUsingSwitch"); }
}
///
/// Happy Point Using Command
///
public ICommand HappyPointUsingCommand { get; protected set; } = null;
///
/// OkCashBag Using Noraml Brush
///
public string OkCashBagUsingNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_ocb_n.png", CommonValue.PBdesignImagesPath);
///
/// OkCashBag Using SwitchOn Brush
///
public string OkCashBagUsingSwitchOnBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_ocb_f.png", CommonValue.PBdesignImagesPath);
///
/// OkCashBag Using Disabled Brush
///
public string OkCashBagUsingDisableBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_ocb_d.png", CommonValue.PBdesignImagesPath);
private bool okCashBagUsingSwitch;
///
/// OkCashBag Using Switch
///
public bool OkCashBagUsingSwitch
{
get { return okCashBagUsingSwitch; }
set { okCashBagUsingSwitch = value; PropertyChange("OkCashBagUsingSwitch"); }
}
///
/// OkCashBag Using Command
///
public ICommand OkCashBagUsingCommand { get; protected set; } = null;
///
/// SamsungPointUsing Noraml Brush
///
public string SamsungPointUsingNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_samsung_n.png", CommonValue.PBdesignImagesPath);
///
/// SamsungPointUsing Command
///
public ICommand SamsungPointUsingCommand { get; protected set; } = null;
///
/// HyundaiPointUsing Noraml Brush
///
public string HyundaiPointUsingNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_hyundai_n.png", CommonValue.PBdesignImagesPath);
///
/// HyundaiPointUsing Command
///
public ICommand HyundaiPointUsingCommand { get; protected set; } = null;
///
/// MoreView Noraml Brush
///
public string MoreViewNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_more_n.png", CommonValue.PBdesignImagesPath);
///
/// MoreView Command
///
public ICommand MoreViewCommand { get; protected set; } = null;
///
/// ShinHanCardPointUsing Noraml Brush
///
public string ShinHanCardPointUsingNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_shinhan_n.png", CommonValue.PBdesignImagesPath);
///
/// ShinHanCardPointUsing Command
///
public ICommand ShinHanCardPointUsingCommand { get; protected set; } = null;
///
/// HyundaiOilBankUsing Noraml Brush
///
public string HyundaiOilBankUsingNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_hyundaioilbank_n.png", CommonValue.PBdesignImagesPath);
///
/// HyundaiOilBankUsing Command
///
public ICommand HyundaiOilBankUsingCommand { get; protected set; } = null;
///
/// HyundaiBlueMembersUsing Noraml Brush
///
public string HyundaiBlueMembersUsingNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_bluemembers_n.png", CommonValue.PBdesignImagesPath);
///
/// HyundaiBlueMembersUsing Command
///
public ICommand HyundaiBlueMembersUsingCommand { get; protected set; } = null;
///
/// KiaMembersUsing Noraml Brush
///
public string KiaMembersUsingNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_kiaredmembers_n.png", CommonValue.PBdesignImagesPath);
///
/// KiaMembersUsing Command
///
public ICommand KiaMembersUsingCommand { get; protected set; } = null;
///
/// MoreViewReturn Noraml Brush
///
public string MoreViewReturnNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_back_n.png", CommonValue.PBdesignImagesPath);
///
/// MoreViewReturn Command
///
public ICommand MoreViewReturnCommand { get; protected set; } = null;
///
/// Happy App My Coupon Noraml Brush
///
public string HappyAppMyCouponNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_happyapp_n.png", CommonValue.PBdesignImagesPath);
///
/// Happy App My Coupon SwitchOn Brush
///
public string HappyAppMyCouponSwitchOnBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_happyapp_f.png", CommonValue.PBdesignImagesPath);
///
/// Happy App My Coupon Disabled Brush
///
public string HappyAppMyCouponDisableBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_happyapp_d.png", CommonValue.PBdesignImagesPath);
private bool happyAppMyCouponSwitch;
///
/// Happy App My Coupon Switch
///
public bool HappyAppMyCouponSwitch
{
get { return happyAppMyCouponSwitch; }
set { happyAppMyCouponSwitch = value; PropertyChange("HappyAppMyCouponSwitch"); }
}
///
/// Happy App My Coupon Command
///
public ICommand HappyAppMyCouponCommand { get; protected set; } = null;
///
/// Mobile Coupon Noraml Brush
///
public string MobileCouponNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_mobilecoupon_n.png", CommonValue.PBdesignImagesPath);
///
/// Mobile Coupon SwitchOn Brush
///
public string MobileCouponSwitchOnBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_mobilecoupon_f.png", CommonValue.PBdesignImagesPath);
///
/// Mobile Coupon Disabled Brush
///
public string MobileCouponDisableBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_mobilecoupon_d.png", CommonValue.PBdesignImagesPath);
private bool mobileCouponSwitch;
///
/// Mobile Coupon Switch
///
public bool MobileCouponSwitch
{
get { return mobileCouponSwitch; }
set { mobileCouponSwitch = value; PropertyChange("MobileCouponSwitch"); }
}
///
/// Mobile Coupon Command
///
public ICommand MobileCouponCommand { get; protected set; } = null;
#endregion
#region PaymentExcute
///
/// ICcard Noraml Brush
///
public string ICcardNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_creditcard_n.png", CommonValue.PBdesignImagesPath);
///
/// ICcard Command
///
public ICommand ICcardCommand { get; protected set; } = null;
///
/// LGSSpay Noraml Brush
///
public string LGSSpayNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_samsunglg_n.png", CommonValue.PBdesignImagesPath);
///
/// LGSSpay Command
///
public ICommand LGSSpayCommand { get; protected set; } = null;
///
/// CashBee Noraml Brush
///
public string CashBeeNoramlBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_cashbee_n.png", CommonValue.PBdesignImagesPath);
///
/// CashBee Command
///
public ICommand CashBeeCommand { get; protected set; } = null;
///
/// HappyGift Brush
///
public string HappyGiftBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_happygift_n.png", CommonValue.PBdesignImagesPath);
///
/// HappyGift Command
///
public ICommand HappyGiftCommand { get; protected set; } = null;
///
/// Tmoney Brush
///
public string TmoneyBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_tmoney_n.png", CommonValue.PBdesignImagesPath);
///
/// Tmoney Command
///
public ICommand TmoneyCommand { get; protected set; } = null;
///
/// SPCemployee Brush
///
public string SPCemployeeBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_spc_n.png", CommonValue.PBdesignImagesPath);
///
/// KakaoPay Brush
///
public string KakaoPayBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_kakao_n.png", CommonValue.PBdesignImagesPath);
///
/// SPCemployee Command
///
public ICommand SPCemployeeCommand { get; protected set; } = null;
///
/// KakaoPay Command
///
public ICommand KakaoPayCommand { get; protected set; } = null;
///
/// SmilePay Brush
///
public string SmilePayBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_smile_n.png", CommonValue.PBdesignImagesPath);
///
/// SmilePay Command
///
public ICommand SmilePayCommand { get; protected set; } = null;
///
/// AliPay Brush
///
public string AliPayBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_ali_n.png", CommonValue.PBdesignImagesPath);
///
/// AliPay Command
///
public ICommand AliPayCommand { get; protected set; } = null;
///
/// ZeroPay Brush
///
public string ZeroPayBrush { get; set; } = ResourceManager.GetNximagePathAdd("btn_pay_zero_n.png", CommonValue.PBdesignImagesPath);
///
/// ZeroPay Command
///
public ICommand ZeroPayCommand { get; protected set; } = null;
#endregion
#endregion
#region PaymentsList
///
/// Detail Basket Delete All Image
///
public string DetailBasketDeleteAllImage { get; set; } = ResourceManager.GetNximagePathAdd("btn_delete.png", CommonValue.PBdesignImagesPath);
///
/// Discount Bar Brush
///
public string DiscountBarBrush { get; set; } = ResourceManager.GetNximagePathAdd("discount_bar.png", CommonValue.PBdesignImagesPath);
///
/// Detail Basket Delete All Command
///
public ICommand DetailBasketDeleteAllCommand { get; protected set; } = null;
private bool detailBasketDeleteAllShow = false;
///
/// Detail Basket Delete All Show
///
public bool DetailBasketDeleteAllShow
{
get { return detailBasketDeleteAllShow; }
set { detailBasketDeleteAllShow = value; PropertyChange("DetailBasketDeleteAllShow"); }
}
#region PaymentValue
private int totalItemCount;
///
/// Total Item Count
///
public int TotalItemCount
{
get { return totalItemCount; }
set { totalItemCount = value; PropertyChange("TotalItemCount"); }
}
private double totalItemsPrice;
///
/// Total Items Price
///
public double TotalItemsPrice
{
get { return totalItemsPrice; }
set { totalItemsPrice = value; PropertyChange("TotalItemsPrice"); }
}
private double totalDiscountValue = 0d;
///
/// Total Discount Value
///
public double TotalDiscountValue
{
get { return totalDiscountValue; }
set { totalDiscountValue = value; PropertyChange("TotalDiscountValue"); }
}
private double totalPriceForPayments;
///
/// Total Price For Payments
///
public double TotalPriceForPayments
{
get { return totalPriceForPayments; }
set { totalPriceForPayments = value; PropertyChange("TotalPriceForPayments"); }
}
///
/// Order Total Payment Icon
///
public string OrderTotalPaymentIcon { get; set; } = ResourceManager.GetNximagePathAdd("Ic_totalcost.png", CommonValue.PBdesignImagesPath);
#endregion
#region Button
private List gotoLeftText;
///
/// GotoLeft Button Text
///
public List GotoLeftText
{
get { return gotoLeftText; }
set { gotoLeftText = value; PropertyChange("GotoLeftText"); }
}
private double gotoLeftWidth = 136d;
///
/// Goto Left Button Width
///
public double GotoLeftWidth
{
get { return gotoLeftWidth; }
set { gotoLeftWidth = value; PropertyChange("GotoLeftWidth"); }
}
private bool gotoLeftEnable = true;
///
/// Goto Left Button Enabled
///
public bool GotoLeftEnable
{
get { return gotoLeftEnable; }
set { gotoLeftEnable = value; PropertyChange("GotoLeftEnable"); }
}
///
/// Goto Left Command
///
public ICommand GotoLeftCommand { get; protected set; } = null;
private List gotoRightText;
///
/// GotoRight Button Text
///
public List GotoRightText
{
get { return gotoRightText; }
set { gotoRightText = value; PropertyChange("GotoRightText"); }
}
private double gotoRightWidth = 254d;
///
/// Goto Right Button Width
///
public double GotoRightWidth
{
get { return gotoRightWidth; }
set { gotoRightWidth = value; PropertyChange("GotoRightWidth"); }
}
private bool gotoRightEnable = true;
///
/// Goto Right Button Enabled
///
public bool GotoRightEnable
{
get { return gotoRightEnable; }
set { gotoRightEnable = value; PropertyChange("GotoRightEnable"); }
}
///
/// Goto Right Command
///
public ICommand GotoRightCommand { get; protected set; } = null;
#endregion
#endregion PaymentsList
private PaymentsDiscountAndAddType CurrentRollBakType;
///
/// SPC 임직원 유무
///
private bool isCompanyMember;
public bool IsCompanyMember
{
get { return isCompanyMember; }
set { isCompanyMember = value; PropertyChange("IsCompanyMember"); }
}
#endregion Members
#region [ Ctor/Etc ]
///
/// Ctor
///
public PBPaymentsViewModel()
{
InitViewModel();
}
///
/// Dispose
///
public new void Dispose()
{
this.PropertyChanged -= PBPaymentsViewModel_PropertyChanged;
if (posDataService != null)
{
posDataService.Dispose();
posDataService = null;
}
if (popupManager != null)
{
popupManager = null;
}
base.Dispose();
GC.SuppressFinalize(this);
}
#endregion Ctor/Etc
#region [ Methods ]
private void InitViewModel()
{
try
{
posDataService = new PosDataService();
WaitWindowFrom = WaitWindow.GetInstance;
WaitWindowFrom.CloseWaitWindow();
//GMB Right
LanguageCommand = new Command(LanguageCommandHandler);
CallEmployeeCommand = new Command(CallEmployeeCommandHandler);
GotoIntroPageCommad = new Command(GotoIntroPageCommadHandler);
//Contents
GotoPointsDisCountsCommand = new Command(GotoPointsDisCountsCommandHandler);
GotoCouponUsePointsCommand = new Command(GotoCouponUsePointsCommandHandler);
GotoPaymentExcuteCommand = new Command(GotoPaymentExcuteCommandHandler);
//Detail Basket
ScanPage2LeftCommand = new Command(ScanPage2LeftCommandHandler);
ScanPage2RightCommand = new Command(ScanPage2RightCommandHandler);
OrderPage2LeftCommand = new Command(OrderPage2LeftCommandHandler);
OrderPage2RightCommand = new Command(OrderPage2RightCommandHandler);
ScanPageSelectCommand = new Command(ScanPageSelectCommandHandler);
OrderPageSelectCommand = new Command(OrderPageSelectCommandHandler);
ScanBarcodeDeleteCommand = new Command(ScanBarcodeDeleteCommandHandler);
OrderDeleteCommand = new Command(OrderDeleteCommandHandler);
ScanBarcodeAllDeleteCommand = new Command(ScanBarcodeAllDeleteCommandHandler);
OrderAllDeleteCommand = new Command(OrderAllDeleteCommandHandler);
//Reserve
HappyPointResrveCommand = new Command(HappyPointResrveCommadHandler);
OkCashBagResrveCommand = new Command(OkCashBagResrveCommandHandler);
//Discount
DiscountSKCommand = new Command(DiscountSKCommandHandler);
DiscountKTCommand = new Command(DiscountKTCommandHandler);
DiscountLGCommand = new Command(DiscountLGCommandHandler);
//PointUsing
HappyPointUsingCommand = new Command(HappyPointUsingCommandHandler);
OkCashBagUsingCommand = new Command(OkCashBagUsingCommandHandler);
//PointUsing MoreView
MoreViewCommand = new Command(MoreViewCommandHandler);
//PointUsing MoreViewReturn
MoreViewReturnCommand = new Command(MoreViewReturnCommandHandler);
//Coupon
HappyAppMyCouponCommand = new Command(HappyAppMyCouponCommandHandler);
MobileCouponCommand = new Command(MobileCouponCommandHandler);
//PaymentsKind
ICcardCommand = new Command(ICcardCommandHandler);
LGSSpayCommand = new Command(LGSSpayCommandHandler);
CashBeeCommand = new Command(CashBeeCommandHandler);
HappyGiftCommand = new Command(HappyGiftCommandHandler);
TmoneyCommand = new Command(TmoneyCommandHandler);
SPCemployeeCommand = new Command(SPCemployeeCommandHandler);
KakaoPayCommand = new Command(KakaoPayCommandHandler);
SmilePayCommand = new Command(SmilePayCommandHandler);
AliPayCommand = new Command(AliPayCommandHandler);
ZeroPayCommand = new Command(ZeroPayCommandHandler);
//PaymentsList
DetailBasketDeleteAllCommand = new Command(DetailBasketDeleteAllCommandHandler);
GotoLeftCommand = new Command(GotoLeftCommandHandler);
GotoRightCommand = new Command(GotoRightCommandHandler);
this.GetPosOption();
this.GetNhsFuncInfo();
this.IsCompanyMember = new posHappyPoint().IsCompanyMember;
this.PropertyChanged += PBPaymentsViewModel_PropertyChanged;
ShowLanguageType = CommonValue.CommonLanguageType;
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "InitViewModel()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
}
}
private void GetPosOption()
{
//PosOption 값 획득
using (var backDataService = new BackDataService())
{
this.OptionValue802 = backDataService.GetPosOption(nameof(PosOptionType.OPT802));
this.OptionValue803 = backDataService.GetPosOption(nameof(PosOptionType.OPT803));
this.OptionValue804 = backDataService.GetPosOption(nameof(PosOptionType.OPT804));
}
}
private void GetNhsFuncInfo()
{
using (var commonDataHelper = new CommonDataHelper())
{
//Get NHS_FUNC_INFO Data Dictionary
var nhsFuncInfoData = commonDataHelper.GetNhsFuncInfo();
//고유식별 Type
var nhsFuncInfoType = new NhsFuncInfoType();
//View Binding 데이터
if (NhsFuncInfo == null) { NhsFuncInfo = new NhsFuncInfoItem(); }
//전체 const로 잡힌 필드를 돌며 DB에서 받아온 Key와 매칭
foreach (var item in nhsFuncInfoType.GetType().GetFields())
{
if (nhsFuncInfoData.ContainsKey(item.GetValue(nhsFuncInfoType)?.ToString()))
{
//받아온 데이터 키와 고유식별 Type을 매칭해 View Binding데이터와 일치하게 삽입
NhsFuncInfo.GetType().GetProperty(item.Name).SetValue(NhsFuncInfo, nhsFuncInfoData[item.GetValue(nhsFuncInfoType)?.ToString()], System.Reflection.BindingFlags.SetField, null, null, null);
}
}
}
}
#region Contents
private void InitailizeDetailBasket()
{
GMBHeaderText = Languages.GetMessages("LBL0098");
GotoLeftWidth = 136d;
GotoRightWidth = 254d;
GotoLeftText = Languages.GetMessages("BTN0026");
GotoRightText = Languages.GetMessages("BTN0004");
DetailBasketDeleteAllShow = true;
}
private void SubDataReset()
{
if (DetailBasketData is ObservableCollection
&& DetailBasketData.Count > 0)
{
ScanBarcodeBasketData = new ObservableCollection(DetailBasketData.Where(r => r.ItemType.Equals(BasketItemType.Barcode) || r.ItemType.Equals(BasketItemType.Scan)).ToList());
OrderBasketData = new ObservableCollection(DetailBasketData.Where(r => r.ItemType.Equals(BasketItemType.Order)).ToList());
}
else
{
ScanBarcodeBasketData = null;
OrderBasketData = null;
}
ScanItemPageNo = 0;
OrderItemPageNo = 0;
}
private ObservableCollection SetPageNumber(int _pageCount)
{
var pageNumbers = new ObservableCollection();
try
{
if (_pageCount > 0)
{
for (int index = 0; index < _pageCount; index++)
{
pageNumbers.Add(new M_ItemData
{
Index = index,
DataParameter = new M_AnimationButton
{
NormalBrush = ResourceManager.GetNximagePathAdd("Img_page_dot_off.png", CommonValue.PBdesignImagesPath),
SwitchOnBrush = ResourceManager.GetNximagePathAdd("Img_page_dot_on.png", CommonValue.PBdesignImagesPath),
Width = 20,
Height = 20,
BrushStretch = Stretch.Fill,
ClickAnimationType = ButtonAnimationType.SizeDown,
CircleBackBrush = "Transparent",
CircleTextBruch = "Transparent",
CircleText = string.Empty,
TextVisible = Visibility.Collapsed,
}
});
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "SetPageNumber()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
pageNumbers = new ObservableCollection();
}
return pageNumbers;
}
private void DeleteBasketItem(M_BasketItem _deleteItem)
{
if (DetailBasketData is ObservableCollection)
{
var newBasketData = DetailBasketData.ToList();
using (var posDataService = new PosDataService())
{
if (posDataService.DelItem(_deleteItem))
{
newBasketData.Remove(_deleteItem);
}
}
newBasketData.Remove(_deleteItem);
DetailBasketData = new ObservableCollection(newBasketData);
}
}
private void DeleteScanAndBarcordItem()
{
if (DetailBasketData is ObservableCollection)
{
var newBasketData = DetailBasketData.ToList();
using (var posDataService = new PosDataService())
{
foreach (var aitem in newBasketData.Where(r => r.ItemType.Equals(BasketItemType.Scan)
|| r.ItemType.Equals(BasketItemType.Barcode)).ToList())
{
if (posDataService.DelItem(aitem))
{
newBasketData.Remove(aitem);
}
}
}
DetailBasketData = new ObservableCollection(newBasketData);
}
}
private void DeleteSelfOrderItem()
{
if (DetailBasketData is ObservableCollection)
{
var newBasketData = DetailBasketData.ToList();
using (var posDataService = new PosDataService())
{
foreach (var aitem in newBasketData.Where(r => r.ItemType.Equals(BasketItemType.Order)).ToList())
{
if (posDataService.DelItem(aitem))
{
newBasketData.Remove(aitem);
}
}
}
DetailBasketData = new ObservableCollection(newBasketData);
}
}
public void DeledteAllBasket()
{
using (var posDataService = new PosDataService())
{
foreach (var aitem in DetailBasketData)
{
posDataService.DelItem(aitem);
}
}
DetailBasketData = null;
}
private void InitailizePointsDisCounts()
{
GMBHeaderText = Languages.GetMessages("LBL0035");
GotoPointsDisCountsEnable = false;
GotoCouponUsePointsEnable = true;
GotoPaymentExcuteEnable = true;
GotoLeftWidth = 136d;
GotoRightWidth = 254d;
GotoLeftText = Languages.GetMessages("BTN0028");
GotoRightText = Languages.GetMessages("BTN0008");
DetailBasketDeleteAllShow = false;
}
private void InitailizeCouponUsePoints()
{
GMBHeaderText = Languages.GetMessages("LBL0035");
GotoPointsDisCountsEnable = true;
GotoCouponUsePointsEnable = false;
GotoPaymentExcuteEnable = true;
GotoLeftWidth = 136d;
GotoRightWidth = 254d;
GotoLeftText = Languages.GetMessages("BTN0028");
GotoRightText = Languages.GetMessages("BTN0008");
DetailBasketDeleteAllShow = false;
}
private void InitailizeMoreView()
{
GMBHeaderText = Languages.GetMessages("LBL0035");
GotoPointsDisCountsEnable = true;
GotoCouponUsePointsEnable = false;
GotoPaymentExcuteEnable = true;
GotoLeftWidth = 136d;
GotoRightWidth = 254d;
GotoLeftText = Languages.GetMessages("BTN0028");
GotoRightText = Languages.GetMessages("BTN0008");
DetailBasketDeleteAllShow = false;
}
private void InitailizePaymentExcute()
{
GMBHeaderText = Languages.GetMessages("LBL0035");
GotoPointsDisCountsEnable = true;
GotoPointsDisCountsEnable = true;
GotoCouponUsePointsEnable = true;
GotoPaymentExcuteEnable = false;
GotoLeftWidth = 390d;
GotoRightWidth = 0d;
GotoLeftText = Languages.GetMessages("BTN0028");
DetailBasketDeleteAllShow = false;
}
public void OpenFistPopup()
{
FirstLoaded = false;
var setPosItems = false;
using (var newPosDataService = new PosDataService())
{
setPosItems = newPosDataService.ResetItems(DetailBasketData.ToList());
}
if (setPosItems)
{
popupManager.OpenStepInfoPopup();
}
else
{
PopupMessageBox.ShowMessageBox(ShowLanguageType
, Languages.GetMessages("LBL0077")
, null
, MessageBoxButton.OK
, OpenCloseAnimationType.FullSizeUp
, OpenCloseAnimationType.FullSizeDown
, 0.5, 0.2, 10);
RollBacklEnd();
}
}
private void OpenReserveHappyPoint()
{
TimerEnabled = false;
try
{
var popupReturn = popupManager.OpenHappyPointCertify(false, false, ParentPage.PBPaymentsWindow);
if (popupReturn is M_PopupReturn)
{
if (popupReturn.OKAnswer)
{
if (popupReturn.PopupArgs is M_HappyPointReturn _HappyPointReturn)
{
HappyPointReturn = _HappyPointReturn;
}
else
{
HappyPointReturn = null;
}
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenReserveHappyPoint()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
TimerEnabled = true;
}
}
private void OpenReserveOkCashBag()
{
TimerEnabled = false;
try
{
var popupReturn = popupManager.OpenOkCashBagCertify();
if (popupReturn is M_PopupReturn)
{
if (popupReturn.OKAnswer)
{
if (popupReturn.PopupArgs is M_OkCashBagReturn okCashBagReturnValue)
{
OkCashBagReturn = okCashBagReturnValue;
}
else
{
OkCashBagReturn = null;
}
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenReserveOkCashBag()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
TimerEnabled = true;
}
}
private bool OpenRollbackConfirmDiscountOrPayments(PaymentsDiscountAndAddType _discountType)
{
bool result = false;
TimerEnabled = false;
try
{
var miniPopup = new M_MiniPopup
{
Icon = MiniPopupIcon.DiscountCancel,
DisplayLanguage = ShowLanguageType,
Message = GetPaymentsDiscountAndAddTypeText(_discountType).CombineLanguageData(Languages.GetMessages("LBL0080")),
CencalButtonText = Languages.GetMessages("BTN0021"),
OkButtonText = Languages.GetMessages("BTN0005"),
IsCencalButton = true,
TimeoutSeconds = 10,
};
var popupReturn = popupManager.OpenMiniPopup(miniPopup);
if (popupReturn is M_PopupReturn)
{
result = popupReturn.OKAnswer;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenRollbackConfirmDiscountOrPayments()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = false;
}
finally
{
TimerEnabled = true;
}
return result;
}
private List GetPaymentsDiscountAndAddTypeText(PaymentsDiscountAndAddType _discountType)
{
var result = new List();
try
{
switch (_discountType)
{
case PaymentsDiscountAndAddType.HappyPoint:
result = new List
{
new M_Language
{
Type=SupportLanguageType.ko,
LanguageData = "해피포인트 사용"
}
};
break;
case PaymentsDiscountAndAddType.HappyCoupon:
result = new List
{
new M_Language
{
Type=SupportLanguageType.ko,
LanguageData = "해피앱 쿠폰"
}
};
break;
case PaymentsDiscountAndAddType.MobileCoupon:
result = new List
{
new M_Language
{
Type=SupportLanguageType.ko,
LanguageData = "모바일 쿠폰 사용"
}
};
break;
case PaymentsDiscountAndAddType.SkTelecomDiscount:
result = new List
{
new M_Language
{
Type=SupportLanguageType.ko,
LanguageData = "SKT 멤버쉽 할인"
}
};
break;
case PaymentsDiscountAndAddType.AllehKTDiscount:
result = new List
{
new M_Language
{
Type=SupportLanguageType.ko,
LanguageData = "KT 멤버쉽 할인"
}
};
break;
case PaymentsDiscountAndAddType.LGUPlusDisCount:
result = new List
{
new M_Language
{
Type=SupportLanguageType.ko,
LanguageData = "LG U+ 멤버쉽 할인"
}
};
break;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "GetPaymentsDiscountAndAddTypeText()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = new List();
}
return result;
}
private void MobileCompanyDiscountExcute(MobileCompanyType _mobileCompany)
{
if (MobileCompanyReturn is M_MobileCompanyReturn mobileCompanyReturn
&& mobileCompanyReturn.Company.Equals(_mobileCompany)
&& mobileCompanyReturn.DiscountValue > 0)
{
var paymentsDiscountType = PaymentsDiscountAndAddType.None;
switch (_mobileCompany)
{
case MobileCompanyType.KT_Mobile:
paymentsDiscountType = PaymentsDiscountAndAddType.AllehKTDiscount;
break;
case MobileCompanyType.SK_Telecom:
paymentsDiscountType = PaymentsDiscountAndAddType.SkTelecomDiscount;
break;
case MobileCompanyType.LG_Uplus:
paymentsDiscountType = PaymentsDiscountAndAddType.LGUPlusDisCount;
break;
}
if (!paymentsDiscountType.Equals(PaymentsDiscountAndAddType.None) && OpenRollbackConfirmDiscountOrPayments(paymentsDiscountType))
{
TimerEnabled = false;
WaitWindowFrom.ShowWaitWindow();
RollBackExcute(paymentsDiscountType, MobileCompanyReturn.PaySEQ);
WaitWindowFrom.CloseWaitWindow();
TimerEnabled = true;
}
}
else
{
OpenMobileCompanyDiscount(_mobileCompany);
}
}
private void OpenMobileCompanyDiscount(MobileCompanyType _mobileCompany)
{
TimerEnabled = false;
try
{
var popupReturn = popupManager.OpenMobileCompanyCertify(_mobileCompany, TotalItemsPrice);
if (popupReturn is M_PopupReturn)
{
if (popupReturn.OKAnswer)
{
if (popupReturn.PopupArgs is M_MobileCompanyReturn mobileCompanyReturnValue)
{
MobileCompanyReturn = mobileCompanyReturnValue;
var discountType = PaymentsDiscountAndAddType.None;
switch (MobileCompanyReturn.Company)
{
case MobileCompanyType.SK_Telecom:
discountType = PaymentsDiscountAndAddType.SkTelecomDiscount;
break;
case MobileCompanyType.KT_Mobile:
discountType = PaymentsDiscountAndAddType.AllehKTDiscount;
break;
case MobileCompanyType.LG_Uplus:
discountType = PaymentsDiscountAndAddType.LGUPlusDisCount;
break;
}
AddDiscountValue
(
new M_DiscountAndAddValues
{
DiscountType = discountType,
DiscountName = GetPaymentsDiscountAndAddTypeText(discountType),
DiscountValue = MobileCompanyReturn.DiscountValue,
IsCanRollBack = true
}
);
}
else
{
MobileCompanyReturn = null;
}
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenMobileCompanyDiscount()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
TimerEnabled = true;
}
}
private void OpenHappyPointUsing()
{
TimerEnabled = false;
try
{
var popupReturn = popupManager.OpenHappyPointUsing(HappyPointReturn, TotalPriceForPayments);
if (popupReturn is M_PopupReturn)
{
if (popupReturn.OKAnswer)
{
if (popupReturn.PopupArgs is M_HappyPointReturn _HappyPointReturn)
{
HappyPointReturn = _HappyPointReturn;
if (HappyPointReturn.PointUse)
{
HappyPointUsingSwitch = true;
AddDiscountValue(new M_DiscountAndAddValues
{
DiscountType = PaymentsDiscountAndAddType.HappyPoint,
DiscountName = GetPaymentsDiscountAndAddTypeText(PaymentsDiscountAndAddType.HappyPoint),
DiscountValue = HappyPointReturn.UsingPoints,
IsCanRollBack = true
});
if (TotalPriceForPayments.Equals(HappyPointReturn.UsingPoints))
{
HappyPointReturn.ReservePoint = false;
HappyPointResrveSwitch = false;
}
else if (!GetReserveOKChashBag())
{
HappyPointReturn.ReservePoint = true;
HappyPointResrveSwitch = true;
}
}
}
else
{
HappyPointReturn = null;
}
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenHappyPointUsing()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
TimerEnabled = true;
}
}
private void OpenHappyAppCoupon()
{
TimerEnabled = false;
try
{
var popupReturn = popupManager.OpenHappyAppCoupon(HappyPointReturn, TotalItemsPrice);
if (popupReturn is M_PopupReturn)
{
if (popupReturn.OKAnswer)
{
if (popupReturn.PopupArgs is M_HappyCoupon _usingHappyAppCoupon)
{
UsingHappyAppCoupon = _usingHappyAppCoupon;
HappyAppMyCouponSwitch = true;
AddDiscountValue(new M_DiscountAndAddValues
{
DiscountType = PaymentsDiscountAndAddType.HappyCoupon,
DiscountName = GetPaymentsDiscountAndAddTypeText(PaymentsDiscountAndAddType.HappyCoupon),
DiscountValue = UsingHappyAppCoupon.UseAmount,
IsCanRollBack = true
});
}
else
{
UsingHappyAppCoupon = null;
}
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenHappyAppCoupon()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
TimerEnabled = true;
}
}
private void OpenMobileCoupon()
{
try
{
var popupReturn = popupManager.OpenMobileHappyCoupon(DetailBasketData.ToList(), TotalPriceForPayments);
if (popupReturn is M_PopupReturn)
{
if (popupReturn.OKAnswer)
{
if (popupReturn.PopupArgs is M_MobileCouponReturn _mobileCouponReturn)
{
MobileCouponReturn = _mobileCouponReturn;
if (MobileCouponReturn.TotalUseAmount > 0)
{
MobileCouponSwitch = true;
AddDiscountValue(new M_DiscountAndAddValues
{
DiscountType = PaymentsDiscountAndAddType.MobileCoupon,
DiscountName = GetPaymentsDiscountAndAddTypeText(PaymentsDiscountAndAddType.MobileCoupon),
DiscountValue = MobileCouponReturn.TotalUseAmount,
IsCanRollBack = true
});
}
}
else
{
MobileCouponReturn = null;
}
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenMobileCoupon()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
TimerEnabled = true;
}
}
private void OpenPaymetsProcess(LastPaymentsType _paymentType)
{
TimerEnabled = false;
try
{
var popupReturn = popupManager.OpenPaymentProcess(_paymentType, TotalPriceForPayments);
if (popupReturn is M_PopupReturn)
{
if (popupReturn.OKAnswer)
{
if (popupReturn.PopupArgs is M_PaymentReturn paymentReturn)
{
PaymentReturn = paymentReturn;
AddDiscountValue(new M_DiscountAndAddValues
{
DiscountType = PaymentsDiscountAndAddType.LastPayment,
DiscountName = Languages.GetMessages("BTN0031"),
DiscountValue = PaymentReturn.PaymentsTotal,
IsCanRollBack = false
});
}
else
{
PaymentReturn = null;
}
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenPaymetsProcess()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
TimerEnabled = true;
}
}
private void OpenPaymentEndProcess()
{
TimerEnabled = false;
try
{
PaymentEndWindowEndType paymentEndType;
//var paymentEndType = DetailBasketData.Where(r => r.ItemType.Equals(BasketItemType.Order)).Count().Equals(0)
// ? PaymentEndWindowEndType.None
// : CommonValue.PaymentEndType;
var happyPointReturn = HappyPointReturn is M_HappyPointReturn
&& !string.IsNullOrEmpty(HappyPointReturn.MemberNumber)
&& HappyPointReturn.IsAppMamber
? HappyPointReturn
: null;
if (DetailBasketData.Where(r => r.ItemType.Equals(BasketItemType.Order)).Count().Equals(0))
{
paymentEndType = PaymentEndWindowEndType.None;
}
else if (OptionValue802 == "1")
{
paymentEndType = PaymentEndWindowEndType.Bell;
}
else if (OptionValue803 == "1")
{
paymentEndType = PaymentEndWindowEndType.Talk;
}
else if (OptionValue804 == "1")
{
paymentEndType = PaymentEndWindowEndType.WaitNumber;
}
else
{
paymentEndType = PaymentEndWindowEndType.None;
}
popupManager.OpenPaymentsEnd(paymentEndType, DetailBasketData.ToList(), GetReserveHappyPoint(), GetReserveOKChashBag(), happyPointReturn);
WaitWindowFrom.ShowWaitWindow();
ProcessOK();
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenPaymentEndProcess()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
TimerEnabled = true;
WaitWindowFrom.CloseWaitWindow();
}
}
#endregion
#region Total Values
private void SetBasketSum()
{
if (DetailBasketData is ObservableCollection)
{
TotalItemCount = DetailBasketData.Sum(r => r.Count)
+ (DiscountValues is ObservableCollection
? DiscountValues.Sum(r=>r.AddCount)
: 0) ;
TotalItemsPrice = DetailBasketData.Sum(r => r.Count * r.Price)
+ (DiscountValues is ObservableCollection
? DiscountValues.Sum(r=> r.AddCount * r.AddValue)
: 0) ;
}
else
{
TotalItemCount = 0;
TotalItemsPrice = 0;
}
ScanItemCount = ScanBarcodeBasketData is ObservableCollection && DetailBasketData.Count > 0
? ScanBarcodeBasketData.Sum(r => r.Count)
: 0;
OrderItemCount = OrderBasketData is ObservableCollection && OrderBasketData.Count > 0
? OrderBasketData.Sum(r => r.Count)
: 0;
}
private void SetDiscountValue()
{
if (DiscountValues is ObservableCollection)
{
TotalDiscountValue = DiscountValues.Sum(r => r.DiscountValue);
}
else
{
TotalDiscountValue = 0;
}
}
#endregion
#region DiscountValue
private void AddDiscountValue(M_DiscountAndAddValues _discountValues)
{
var listDiscountValues = DiscountValues is ObservableCollection
? DiscountValues.ToList()
: new List();
if (!listDiscountValues.Exists(r => r.DiscountType.Equals(_discountValues.DiscountType)))
{
listDiscountValues.Add(_discountValues);
DiscountValues = new ObservableCollection(listDiscountValues);
}
else
{
CommonLog.ErrorLogWrite(this, "AddDiscountValue()", "Duplicate Discount", string.Format("Type:{0}", _discountValues.DiscountType));
}
}
private void RemoveDiscountValue(PaymentsDiscountAndAddType _discountType)
{
if (DiscountValues is ObservableCollection)
{
var listDiscountValues = DiscountValues.ToList();
listDiscountValues.Remove(listDiscountValues.Find(r => r.DiscountType.Equals(_discountType)));
DiscountValues = new ObservableCollection(listDiscountValues);
}
}
private void DiscountsRollBack()
{
if (DiscountValues is ObservableCollection)
{
foreach (var aDiscountValue in DiscountValues)
{
switch (aDiscountValue.DiscountType)
{
case PaymentsDiscountAndAddType.HappyPoint:
if (HappyPointReturn is M_HappyPointReturn happyPointReturn)
{
RollBackExcute(aDiscountValue.DiscountType, HappyPointReturn.PaySEQ);
}
break;
case PaymentsDiscountAndAddType.OkCashBagPoint:
break;
case PaymentsDiscountAndAddType.HappyCoupon:
RollBackExcute(PaymentsDiscountAndAddType.HappyCoupon, UsingHappyAppCoupon.PaySEQ);
break;
case PaymentsDiscountAndAddType.MobileCoupon:
if (MobileCouponReturn is M_MobileCouponReturn mobileCouponReturn)
{
foreach (var aCoupon in mobileCouponReturn.VirtureCoupons)
{
if (aCoupon.PaySEQ > -1) RollBackExcute(PaymentsDiscountAndAddType.MobileCoupon, HappyPointReturn.PaySEQ);
}
}
break;
case PaymentsDiscountAndAddType.SkTelecomDiscount:
case PaymentsDiscountAndAddType.AllehKTDiscount:
case PaymentsDiscountAndAddType.LGUPlusDisCount:
if (MobileCompanyReturn is M_MobileCompanyReturn mobileCompanyReturn)
{
RollBackExcute(aDiscountValue.DiscountType,MobileCompanyReturn.PaySEQ);
}
break;
}
}
}
}
#endregion
#region Discount RollBack Process
private void RollBackExcute(PaymentsDiscountAndAddType _discountType, long _paySEQ)
{
TimerEnabled = false;
try
{
using (var posRollBack = new posPaymentsCancel())
{
CurrentRollBakType = _discountType;
if (posRollBack != null)
{
posRollBack.ReadEnd += posRollBack_ReadEnd;
posRollBack.ErrorEvent += posRollBack_ErrorEvent;
posRollBack.ErrorMessageEvent += posRollBack_ErrorMessageEvent;
posRollBack.StartProcessing(_paySEQ);
posRollBack.ReadEnd -= posRollBack_ReadEnd;
posRollBack.ErrorEvent -= posRollBack_ErrorEvent;
posRollBack.ErrorMessageEvent -= posRollBack_ErrorMessageEvent;
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "RollBackExcute()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
TimerEnabled = true;
}
}
#endregion
private bool GetReserveHappyPoint()
{
bool result = false;
try
{
if (HappyPointReturn is M_HappyPointReturn)
{
result = HappyPointReturn.ReservePoint;
}
}
catch
{
result = false;
}
return result;
}
private bool GetReserveOKChashBag()
{
bool result = false;
try
{
if (OkCashBagReturn is M_OkCashBagReturn)
{
result = OkCashBagReturn.ReservePoint;
}
}
catch
{
result = false;
}
return result;
}
private void TimeOutEnd()
{
DiscountsRollBack();
ReturnValue = new M_PopupReturn
{
OKAnswer = false,
TimeOut = true,
ReturnLanguage = ShowLanguageType,
PopupArgs = DetailBasketData is ObservableCollection
? DetailBasketData.ToList()
: null ,
};
CanWindowClose = true;
}
private void RollBacklEnd()
{
DiscountsRollBack();
ReturnValue = new M_PopupReturn
{
OKAnswer = false,
TimeOut = false,
ReturnLanguage = ShowLanguageType,
PopupArgs = DetailBasketData is ObservableCollection
? DetailBasketData.ToList()
: null,
};
CanWindowClose = true;
}
private void ProcessOK()
{
ReturnValue = new M_PopupReturn
{
OKAnswer = true,
TimeOut = false,
ReturnLanguage = ShowLanguageType,
PopupArgs = null
};
CanWindowClose = true;
}
#endregion Methods
#region [ Event Handlers ]
private void PBPaymentsViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
switch (e.PropertyName)
{
case "IsTimeout":
if (IsTimeout) TimeOutEnd();
break;
case "ShowLanguageType":
switch (ShowLanguageType)
{
case SupportLanguageType.ko:
GmbLanguageimage = ResourceManager.GetNximagePathAdd("btn_language_kor.png", CommonValue.PBdesignImagesPath);
break;
case SupportLanguageType.en:
GmbLanguageimage = ResourceManager.GetNximagePathAdd("btn_language_eng.png", CommonValue.PBdesignImagesPath);
break;
case SupportLanguageType.ja:
GmbLanguageimage = ResourceManager.GetNximagePathAdd("btn_language_jap.png", CommonValue.PBdesignImagesPath);
break;
case SupportLanguageType.zh:
GmbLanguageimage = ResourceManager.GetNximagePathAdd("btn_language_chi.png", CommonValue.PBdesignImagesPath);
break;
}
break;
case "DefaultPage":
switch (DefaultPage)
{
case PBPaymentPageType.DetailBasket:
InitailizeDetailBasket();
break;
case PBPaymentPageType.PointsDisCounts:
InitailizePointsDisCounts();
break;
case PBPaymentPageType.CouponUsePoints:
InitailizeCouponUsePoints();
break;
case PBPaymentPageType.MoreVIewPoints:
InitailizeMoreView();
break;
case PBPaymentPageType.PaymentExcute:
InitailizePaymentExcute();
break;
}
break;
case "DetailBasketData":
SubDataReset();
if (DetailBasketData is ObservableCollection
&& DetailBasketData.Count > 0)
{
foreach (var DetailItem in DetailBasketData)
{
DetailItem.PropertyChanged += DetailItem_PropertyChanged;
}
SetBasketSum();
}
else
{
RollBacklEnd();
}
break;
case "ScanItemPageNo":
ScanPage2LeftEnable = !ScanItemPageNo.Equals(0);
ScanPage2RightEnable = !ScanItemPageNo.Equals(ScanItemPageCount.Equals(0) ? 0: ScanItemPageCount-1);
break;
case "OrderItemPageNo":
OrderPage2LeftEnable = !OrderItemPageNo.Equals(0);
OrderPage2RightEnable = !OrderItemPageNo.Equals(OrderItemPageCount.Equals(0) ? 0 : OrderItemPageCount - 1);
break;
case "ScanItemPageCount":
ScanPageStatusColumnCount = ScanItemPageCount;
ScanItemPageStatus = SetPageNumber(ScanItemPageCount);
break;
case "OrderItemPageCount":
OrderPageStatusColumnCount = OrderItemPageCount;
OrderItemPageStatus = SetPageNumber(OrderItemPageCount);
break;
case "DiscountValues":
SetDiscountValue();
break;
case "MemberLoginOK":
GmbHappyPointEnable = !MemberLoginOK;
break;
case "HappyPointReturn":
if (HappyPointReturn is M_HappyPointReturn happyPointReturn)
{
HappyPointResrveSwitch = happyPointReturn.ReservePoint;
}
else
{
HappyPointResrveSwitch = false;
}
break;
case "HappyPointResrveSwitch":
OkCashBagResrveEnable = !HappyPointResrveSwitch;
break;
case "OkCashBagReturn":
if (OkCashBagReturn is M_OkCashBagReturn okCashBagReturn)
{
OkCashBagResrveSwitch = okCashBagReturn.ReservePoint;
}
else
{
OkCashBagResrveSwitch = false;
}
break;
case "OkCashBagResrveSwitch":
HappyPointResrveEnable = !OkCashBagResrveSwitch;
break;
case "MobileCompanyReturn":
if (MobileCompanyReturn is M_MobileCompanyReturn mobileCompanyReturn)
{
if (mobileCompanyReturn.DiscountValue > 0)
{
switch (mobileCompanyReturn.Company)
{
case MobileCompanyType.SK_Telecom:
DiscountSKSwitch = true;
break;
case MobileCompanyType.KT_Mobile:
DiscountKTSwitch = true;
break;
case MobileCompanyType.LG_Uplus:
DiscountLGSwitch = true;
break;
}
}
}
break;
case "DiscountSKSwitch":
DiscountKTEnable = !DiscountSKSwitch;
DiscountLGEnable = !DiscountSKSwitch;
break;
case "DiscountKTSwitch":
DiscountSKEnable = !DiscountKTSwitch;
DiscountLGEnable = !DiscountKTSwitch;
break;
case "DiscountLGSwitch":
DiscountSKEnable = !DiscountLGSwitch;
DiscountKTEnable = !DiscountLGSwitch;
break;
case "TotalItemsPrice":
case "TotalDiscountValue":
TotalPriceForPayments = TotalItemsPrice - TotalDiscountValue;
break;
case "TotalPriceForPayments":
if (TotalPriceForPayments.Equals(0d)) OpenPaymentEndProcess();
break;
}
}
private void DetailItem_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
LastAccessTime = DateTime.Now;
if (sender is M_BasketItem updatedItem)
{
using (var posDataService = new PosDataService())
{
posDataService.UpdatedItem(updatedItem);
}
}
SetBasketSum();
}
#region GMB Right Click
private void CallEmployeeCommandHandler(object obj)
{
TimerEnabled = false;
try
{
var popupReturn = popupManager.OpenCallEmployee();
if (popupReturn is M_PopupReturn)
{
if (popupReturn.TimeOut)
{
TimeOutEnd();
return;
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "CallEmployeeCommandHandler()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
TimerEnabled = true;
}
}
private void LanguageCommandHandler(object obj)
{
TimerEnabled = false;
try
{
var popupReturn = popupManager.OpenLanguageSelector(ShowLanguageType);
if (popupReturn is M_PopupReturn)
{
if (popupReturn.TimeOut)
{
TimeOutEnd();
return;
}
else
{
ShowLanguageType = popupReturn.ReturnLanguage;
}
}
}
catch
{
throw;
}
finally
{
TimerEnabled = true;
}
}
private void GotoIntroPageCommadHandler(object obj)
{
TimerEnabled=false;
try
{
var miniPopup = new M_MiniPopup
{
Icon = MiniPopupIcon.Cancel,
DisplayLanguage = ShowLanguageType,
Message = Languages.GetMessages("LBL0085"),
CencalButtonText = Languages.GetMessages("BTN0021"),
OkButtonText = Languages.GetMessages("BTN0005"),
IsCencalButton = true,
TimeoutSeconds = 10,
};
var popupReturn = popupManager.OpenMiniPopup(miniPopup);
if (popupReturn is M_PopupReturn && popupReturn.OKAnswer)
{
TimeOutEnd();
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "GotoIntroPageCommadHandler()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
{
TimerEnabled = true;
}
}
#endregion
#region Contents Click
private void GotoPointsDisCountsCommandHandler(object obj)
{
DefaultPage = PBPaymentPageType.PointsDisCounts;
}
private void GotoCouponUsePointsCommandHandler(object obj)
{
DefaultPage = PBPaymentPageType.CouponUsePoints;
}
private void GotoPaymentExcuteCommandHandler(object obj)
{
DefaultPage = PBPaymentPageType.PaymentExcute;
}
private void ScanPage2LeftCommandHandler(object obj)
{
ScanItemPageNo -= 1;
}
private void ScanPage2RightCommandHandler(object obj)
{
ScanItemPageNo += 1;
}
private void OrderPage2LeftCommandHandler(object obj)
{
OrderItemPageNo -= 1;
}
private void OrderPage2RightCommandHandler(object obj)
{
OrderItemPageNo += 1;
}
private void ScanPageSelectCommandHandler(object obj)
{
if (obj is AnimationButton targetButton && targetButton.DataParameter is M_ItemData _ItemData)
{
ScanItemPageNo = ScanItemPageStatus.IndexOf(_ItemData);
}
}
private void OrderPageSelectCommandHandler(object obj)
{
if (obj is AnimationButton targetButton && targetButton.DataParameter is M_ItemData _ItemData)
{
OrderItemPageNo = OrderItemPageStatus.IndexOf(_ItemData);
}
}
private void ScanBarcodeDeleteCommandHandler(object obj)
{
if (obj is M_BasketItem deleteItem)
{
DeleteBasketItem(deleteItem);
}
}
private void OrderDeleteCommandHandler(object obj)
{
if (obj is M_BasketItem deleteItem)
{
DeleteBasketItem(deleteItem);
}
}
private void ScanBarcodeAllDeleteCommandHandler(object obj)
{
TimerEnabled = false;
try
{
var miniPopup = new M_MiniPopup
{
Icon = MiniPopupIcon.Delete,
DisplayLanguage = ShowLanguageType,
Message = Languages.GetMessages("LBL0094"),
CencalButtonText = Languages.GetMessages("BTN0021"),
OkButtonText = Languages.GetMessages("BTN0005"),
IsCencalButton = true,
TimeoutSeconds = 10,
};
var popupReturn = popupManager.OpenMiniPopup(miniPopup);
if (popupReturn is M_PopupReturn && popupReturn.OKAnswer)
{
DeleteScanAndBarcordItem();
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "ScanBarcodeAllDeleteCommandHandler()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
TimerEnabled = true;
}
}
private void OrderAllDeleteCommandHandler(object obj)
{
TimerEnabled = false;
try
{
var topMessage = new List
{
new M_Language
{
Type = SupportLanguageType.ko,
LanguageData = "커피주문 제품들을 삭제하시겠습니까?"
},
new M_Language
{
Type = SupportLanguageType.en,
LanguageData = "en커피주문 제품들을 삭제하시겠습니까?"
},
};
var miniPopup = new M_MiniPopup
{
Icon = MiniPopupIcon.Delete,
DisplayLanguage = ShowLanguageType,
Message = topMessage,
CencalButtonText = Languages.GetMessages("BTN0021"),
OkButtonText = Languages.GetMessages("BTN0005"),
IsCencalButton = true,
TimeoutSeconds = 10,
};
var popupReturn = popupManager.OpenMiniPopup(miniPopup);
if (popupReturn is M_PopupReturn && popupReturn.OKAnswer)
{
DeleteSelfOrderItem();
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OrderAllDeleteCommandHandler()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
TimerEnabled = true;
}
}
private void HappyPointResrveCommadHandler(object _param)
{
if (HappyPointReturn is M_HappyPointReturn happyPointReturn)
{
if (happyPointReturn.ReservePoint)
{
happyPointReturn.ReservePoint = false;
HappyPointResrveSwitch = false;
}
else
{
happyPointReturn.ReservePoint = true;
HappyPointResrveSwitch = true;
}
}
else
{
OpenReserveHappyPoint();
}
}
private void OkCashBagResrveCommandHandler(object _param)
{
if (OkCashBagReturn is M_OkCashBagReturn okCashBagReturn
&& okCashBagReturn.ReservePoint)
{
OkCashBagReturn = null; //적립 취소
}
else
{
OpenReserveOkCashBag();
}
}
private void DiscountSKCommandHandler(object _param)
{
MobileCompanyDiscountExcute(MobileCompanyType.SK_Telecom);
}
private void DiscountKTCommandHandler(object _param)
{
MobileCompanyDiscountExcute(MobileCompanyType.KT_Mobile);
}
private void DiscountLGCommandHandler(object _param)
{
MobileCompanyDiscountExcute(MobileCompanyType.LG_Uplus);
}
private void HappyPointUsingCommandHandler(object _param)
{
if (HappyPointReturn is M_HappyPointReturn happyPointReturn
&& happyPointReturn.PointUse
&& happyPointReturn.UsingPoints > 0
&& HappyPointUsingSwitch)
{
if (OpenRollbackConfirmDiscountOrPayments(PaymentsDiscountAndAddType.HappyPoint))
{
TimerEnabled = false;
WaitWindowFrom.ShowWaitWindow();
RollBackExcute(PaymentsDiscountAndAddType.HappyPoint, HappyPointReturn.PaySEQ);
WaitWindowFrom.CloseWaitWindow();
TimerEnabled = true;
}
}
else
{
OpenHappyPointUsing();
}
}
private void OkCashBagUsingCommandHandler(object _param)
{
}
private void MoreViewCommandHandler(object _param)
{
DefaultPage = PBPaymentPageType.MoreVIewPoints;
}
private void MoreViewReturnCommandHandler(object _param)
{
DefaultPage = PBPaymentPageType.CouponUsePoints;
}
private void HappyAppMyCouponCommandHandler(object _param)
{
if (UsingHappyAppCoupon is M_HappyCoupon happyAppCoupon
&& happyAppCoupon.IsUsed)
{
if (OpenRollbackConfirmDiscountOrPayments(PaymentsDiscountAndAddType.HappyCoupon))
{
TimerEnabled = false;
WaitWindowFrom.ShowWaitWindow();
RollBackExcute(PaymentsDiscountAndAddType.HappyCoupon, UsingHappyAppCoupon.PaySEQ);
WaitWindowFrom.CloseWaitWindow();
TimerEnabled = true;
}
}
else
{
OpenHappyAppCoupon();
}
}
private void MobileCouponCommandHandler(object _param)
{
if (MobileCouponReturn is M_MobileCouponReturn mobileCouponReturn
&& mobileCouponReturn.TotalUseAmount > 0)
{
if (OpenRollbackConfirmDiscountOrPayments(PaymentsDiscountAndAddType.MobileCoupon))
{
TimerEnabled = false;
WaitWindowFrom.ShowWaitWindow();
foreach (var aCoupon in mobileCouponReturn.VirtureCoupons)
{
if (aCoupon.PaySEQ > -1) RollBackExcute(PaymentsDiscountAndAddType.MobileCoupon, aCoupon.PaySEQ);
}
WaitWindowFrom.CloseWaitWindow();
TimerEnabled = true;
}
}
else
{
OpenMobileCoupon();
}
}
private void ICcardCommandHandler(object _param)
{
OpenPaymetsProcess(LastPaymentsType.IcCard);
}
private void LGSSpayCommandHandler(object _param)
{
OpenPaymetsProcess(LastPaymentsType.SsLgPay);
}
private void CashBeeCommandHandler(object _param)
{
}
private void HappyGiftCommandHandler(object _param)
{
}
private void TmoneyCommandHandler(object _param)
{
}
private void SPCemployeeCommandHandler(object _param)
{
}
private void KakaoPayCommandHandler(object _param)
{
}
private void SmilePayCommandHandler(object _param)
{
OpenPaymetsProcess(LastPaymentsType.SmilePay);
}
private void AliPayCommandHandler(object _param)
{
}
private void ZeroPayCommandHandler(object _param)
{
}
#endregion
#region PaymentsList Click
private void DetailBasketDeleteAllCommandHandler(object _param)
{
TimerEnabled = false;
try
{
var miniPopup = new M_MiniPopup
{
Icon = MiniPopupIcon.ListCancel,
DisplayLanguage = ShowLanguageType,
Message = Languages.GetMessages("LBL0099"),
CencalButtonText = Languages.GetMessages("BTN0021"),
OkButtonText = Languages.GetMessages("BTN0005"),
IsCencalButton = true,
TimeoutSeconds = 10,
};
var popupReturn = popupManager.OpenMiniPopup(miniPopup);
if (popupReturn is M_PopupReturn && popupReturn.OKAnswer)
{
DeledteAllBasket();
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "DetailBasketDeleteAllCommandHandler()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
TimerEnabled = true;
}
}
private void GotoLeftCommandHandler(object _param)
{
switch (DefaultPage)
{
case PBPaymentPageType.DetailBasket:
RollBacklEnd();
break;
case PBPaymentPageType.PointsDisCounts:
case PBPaymentPageType.CouponUsePoints:
case PBPaymentPageType.PaymentExcute:
TimerEnabled = false;
try
{
var miniPopup = new M_MiniPopup
{
Icon = MiniPopupIcon.OrderCancel,
DisplayLanguage = ShowLanguageType,
Message = Languages.GetMessages("LBL0100"),
CencalButtonText = Languages.GetMessages("BTN0021"),
OkButtonText = Languages.GetMessages("BTN0005"),
IsCencalButton = true,
TimeoutSeconds = 10,
};
var popupReturn = popupManager.OpenMiniPopup(miniPopup);
if (popupReturn is M_PopupReturn && popupReturn.OKAnswer)
{
RollBacklEnd();
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "GotoLeftCommandHandler()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
TimerEnabled = true;
}
break;
}
}
private void GotoRightCommandHandler(object _param)
{
switch (DefaultPage)
{
case PBPaymentPageType.DetailBasket:
DefaultPage = PBPaymentPageType.PointsDisCounts;
break;
case PBPaymentPageType.PointsDisCounts:
DefaultPage = PBPaymentPageType.CouponUsePoints;
break;
case PBPaymentPageType.CouponUsePoints:
DefaultPage = PBPaymentPageType.PaymentExcute;
break;
}
}
#region Discount Rollback Events
private void posRollBack_ReadEnd(object sender)
{
if (sender is posPaymentsCancel getRollBack)
{
if (getRollBack.ProcessOK)
{
RemoveDiscountValue(CurrentRollBakType);
switch (CurrentRollBakType)
{
case PaymentsDiscountAndAddType.HappyPoint:
if (HappyPointReturn is M_HappyPointReturn happyPointReturn)
{
HappyPointReturn.PaySEQ = -1L;
HappyPointReturn.PointUse = false;
HappyPointReturn.UsingPoints = 0d;
}
HappyPointUsingSwitch = false;
break;
case PaymentsDiscountAndAddType.OkCashBagPoint:
break;
case PaymentsDiscountAndAddType.HappyCoupon:
HappyAppMyCouponSwitch = false;
UsingHappyAppCoupon = null;
break;
case PaymentsDiscountAndAddType.MobileCoupon:
MobileCouponSwitch = false;
MobileCouponReturn = null;
break;
case PaymentsDiscountAndAddType.SkTelecomDiscount:
DiscountSKSwitch = false;
MobileCompanyReturn = null;
break;
case PaymentsDiscountAndAddType.AllehKTDiscount:
DiscountKTSwitch = false;
MobileCompanyReturn = null;
break;
case PaymentsDiscountAndAddType.LGUPlusDisCount:
DiscountLGSwitch = false;
MobileCompanyReturn = null;
break;
}
}
}
}
private void posRollBack_ErrorEvent(posPaymentsCancel.ErrorCode _errorCode)
{
var errorText = new List
{
new M_Language
{
Type = SupportLanguageType.ko,
LanguageData = _errorCode.ToString()
},
};
KioskMessageBox.ShowMessageBox(errorText
, MessageBoxButton.OK
, OpenCloseAnimationType.FullSizeUp
, OpenCloseAnimationType.FullSizeDown
, 0.5, 0.2, 5);
}
#endregion
#region Common Rollback Error Message Popup Event
private void posRollBack_ErrorMessageEvent(string ErrorString)
{
var errorText = new List
{
new M_Language
{
Type = SupportLanguageType.ko,
LanguageData = ErrorString.Replace("\n"," ").Replace("\r","")
},
};
KioskMessageBox.ShowMessageBox(errorText
, MessageBoxButton.OK
, OpenCloseAnimationType.FullSizeUp
, OpenCloseAnimationType.FullSizeDown
, 0.5, 0.2, 5);
}
#endregion
#endregion
#endregion Event Handlers
}
}