using System; using System.Collections.Generic; using System.ComponentModel; using POSV.Bean; using POSV.Entity; namespace POSV.WaiMai { [ToolboxItem(false)] public partial class TelephoneNotifyPanelEx : AbstractNotifyPanelEx { //当前传入的来电号码 private string _telphone = string.Empty; public TelephoneNotifyPanelEx(string telphone) { InitializeComponent(); this._telphone = telphone; //this.ButtonWaimaiAccept.Enabled = true; this.ButtonWaimaiOrder.Enabled = true; this.ButtonWaimaiClose.Enabled = true; } protected override void OnLoad(EventArgs e) { base.OnLoad(e); Tuple , List> visitor = DeliveryUtils.GetVisitor(this._telphone); //新客 if(visitor.Item1 == null) { this.lblTelephone.Text = string.Format(this.lblTelephone.Tag.ToString(),this._telphone); this.lblCustomer.Text = string.Format(this.lblCustomer.Tag.ToString() , ""); this.lblAddress.Text = string.Format(this.lblAddress.Tag.ToString() , ""); } else { this.lblTelephone.Text = string.Format(this.lblTelephone.Tag.ToString() , this._telphone); this.lblCustomer.Text = string.Format(this.lblCustomer.Tag.ToString() , visitor.Item1.Name); if (visitor.Item2 != null && visitor.Item2.Count > 0) { this.lblAddress.Text = string.Format(this.lblAddress.Tag.ToString() , visitor.Item2[0].Address); } else { this.lblAddress.Text = string.Format(this.lblAddress.Tag.ToString() , ""); } } } /// /// 获取来电电话 /// /// public string GetPhoneNo() { return this._telphone; } /// /// 取消外卖订单 /// /// /// private void OnWaimaiCancel(object sender , EventArgs e) { } /// /// 外卖接单 /// /// /// private void OnWaimaiAccept(object sender , EventArgs e) { } /// /// 生成外卖订单 /// /// /// private void OnWaimaiOrder(object sender , EventArgs e) { //this.ButtonWaimaiAccept.Enabled = false; this.ButtonWaimaiOrder.Enabled = true; this.ButtonWaimaiClose.Enabled = true; var obj = new TelephoneNotifyObject(); obj.Telephone = this._telphone; long messageId = -1; long.TryParse(this.Name , out messageId); obj.MessageId = messageId; this.OnButtonClick(new NotifyEventArgs(NotifyAction.OK , "ok" , obj)); } private void touchButtonX1_Click(object sender, EventArgs e) { var obj = new TelephoneNotifyObject(); obj.Telephone = this._telphone; long messageId = -1; long.TryParse(this.Name, out messageId); obj.MessageId = messageId; this.OnButtonClick(new NotifyEventArgs(NotifyAction.Cancel, "cancel", obj)); } private void ButtonWaimaiOrder_Click(object sender, EventArgs e) { //this.ButtonWaimaiAccept.Enabled = false; this.ButtonWaimaiOrder.Enabled = true; this.ButtonWaimaiClose.Enabled = true; var obj = new TelephoneNotifyObject(); obj.Telephone = this._telphone; long messageId = -1; long.TryParse(this.Name, out messageId); obj.MessageId = messageId; this.OnButtonClick(new NotifyEventArgs(NotifyAction.Accept, "accept", obj)); } } }