You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.8 KiB
C#

9 months ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using POSV.ShoppingCart;
using POS.Language.Language;
namespace POSV.Component
{
[ToolboxItem(false)]
public partial class PromotionItemControl : AbstractNotifyPanelEx
{
private PromotionEntity _currentProm = null;
public PromotionItemControl()
{
InitializeComponent();
}
public void RefreshView(PromotionEntity prom, bool isUse)
{
_currentProm = prom;
this.labelX1.Text = prom.Type.ToString();
this.labelX2.Text = prom.PromotionDesc;
this.labelX3.Text = prom.DiscountAmount.ToString();
if (isUse)
{
this.touchButtonX1.BackColor1 = Color.OrangeRed;
this.touchButtonX1.Text = LangProxy.ToLang("使用中");
this.touchButtonX1.Tag = "true";
}
else
{
this.touchButtonX1.BackColor1 = Color.Teal;
this.touchButtonX1.Text = LangProxy.ToLang("使用");
this.touchButtonX1.Tag = "false";
}
this.touchButtonX1.Tag = isUse.ToString().ToLower();
}
private void OnTouchClick(object sender, TouchEventArgs e)
{
var isUse = this.touchButtonX1.Tag as string;
if(isUse == "true")
{
//当前已使用,变更为取消使用
this.OnButtonClick(new NotifyEventArgs(NotifyAction.Cancel, _currentProm));
}
else
{
//当前未使用,变更为使用
this.OnButtonClick(new NotifyEventArgs(NotifyAction.Accept, _currentProm));
}
}
}
}