108 lines
3.7 KiB
C#
108 lines
3.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.ComponentModel;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
using SPC.Kiosk.Base;
|
|
using SPC.Kiosk.Common;
|
|
using SPC.Kiosk.PB.Model;
|
|
|
|
namespace SPC.Kiosk.PB
|
|
{
|
|
/// <summary>
|
|
/// DiscountAndValue.xaml에 대한 상호 작용 논리
|
|
/// </summary>
|
|
public partial class DiscountAndValue : UserControl
|
|
{
|
|
#region [ Members ]
|
|
/// <summary>
|
|
/// ItemData
|
|
/// </summary>
|
|
public static readonly DependencyProperty ItemDataProperty =
|
|
DependencyProperty.Register(nameof(ItemData), typeof(M_DiscountAndAddValues), typeof(DiscountAndValue), new PropertyMetadata(null, new PropertyChangedCallback(OnItemDataPropertyChanged)));
|
|
/// <summary>
|
|
/// Display Language
|
|
/// </summary>
|
|
public static readonly DependencyProperty DisplayLanguagePropery =
|
|
DependencyProperty.Register(nameof(DisplayLanguage), typeof(SupportLanguageType), typeof(DiscountAndValue), new PropertyMetadata(SupportLanguageType.ko));
|
|
|
|
|
|
/// <summary>
|
|
/// ItemData
|
|
/// </summary>
|
|
public M_DiscountAndAddValues ItemData
|
|
{
|
|
get { return (M_DiscountAndAddValues)GetValue(ItemDataProperty); }
|
|
set { SetValue(ItemDataProperty, value); }
|
|
}
|
|
/// <summary>
|
|
/// Display Language
|
|
/// </summary>
|
|
public SupportLanguageType DisplayLanguage
|
|
{
|
|
get { return (SupportLanguageType)GetValue(DisplayLanguagePropery); }
|
|
set { SetValue(DisplayLanguagePropery, value); }
|
|
}
|
|
|
|
#endregion Members
|
|
|
|
#region [ Ctor & Etc ]
|
|
/// <summary>
|
|
/// Ctor
|
|
/// </summary>
|
|
public DiscountAndValue()
|
|
{
|
|
//this.ItemName.Text = string.Empty;
|
|
InitializeComponent();
|
|
}
|
|
#endregion Ctor & Etc
|
|
|
|
#region [ Methods ]
|
|
#endregion Methods
|
|
|
|
#region [ Event Handlers ]
|
|
private static void OnItemDataPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (e.NewValue is M_DiscountAndAddValues newValue)
|
|
{
|
|
var target = d as DiscountAndValue;
|
|
switch (newValue.DiscountType)
|
|
{
|
|
case PaymentsDiscountAndAddType.BonusGift:
|
|
target.ItemPrice.Foreground = new SolidColorBrush(Colors.Black);
|
|
target.ItemCount.Text = newValue.AddCount.ToString("#0");
|
|
target.ItemPrice.Text = (newValue.AddCount * newValue.AddValue).ToString("#,##0");
|
|
break;
|
|
case PaymentsDiscountAndAddType.None:
|
|
default:
|
|
target.ItemPrice.Foreground = new SolidColorBrush(Color.FromRgb(0xFE, 0x3E, 0x3E));
|
|
target.ItemCount.Text = string.Empty;
|
|
target.ItemPrice.Text = (newValue.DiscountValue * -1).ToString("#,##0");
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
CommonLog.ErrorLogWrite(d, "OnItemDataPropertyChanged()", "Fail !!", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
|
|
}
|
|
}
|
|
|
|
#endregion Event Handlers
|
|
|
|
}
|
|
}
|