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.

146 lines
4.2 KiB
C#

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<Visitor , List<VisitorAddress> , List<VisitorTag>> 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() , "");
}
}
}
/// <summary>
/// 获取来电电话
/// </summary>
/// <returns></returns>
public string GetPhoneNo()
{
return this._telphone;
}
/// <summary>
/// 取消外卖订单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnWaimaiCancel(object sender , EventArgs e)
{
}
/// <summary>
/// 外卖接单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnWaimaiAccept(object sender , EventArgs e)
{
}
/// <summary>
/// 生成外卖订单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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));
}
}
}