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.

98 lines
2.8 KiB
C#

9 months ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using POSV.Entity;
using POSV.ShoppingCart;
namespace POSV.Business
{
public partial class SuitDialogForm : BusinessForm
{
private SuitPanelEx suitPanelEx;
/// <summary>
/// 选中行数据
/// </summary>
private readonly List<OrderItem> _selected = null;
/// <summary>
/// 权限控制码
/// </summary>
private string _permissionCode = string.Empty;
/// <summary>
/// 授权人信息
/// </summary>
private Tuple<decimal , decimal , List<string> , Worker> _authz = null;
public SuitDialogForm(List<OrderItem> selected , string permissionCode , Tuple<decimal , decimal , List<string> , Worker> authz = null)
{
InitializeComponent();
this._selected = selected;
this._permissionCode = permissionCode;
this._authz = authz;
//套餐主菜的信息,道菜加价后主菜单价会改变
var _parent = this._selected.Find(x => string.IsNullOrEmpty(x.ParentId));
if (_parent != null)
{
this.bottomPanel.Text = _parent.Name;
}
this.mainPanel.Controls.Clear();
this.suitPanelEx = new POSV.Business.SuitPanelEx(this._selected , permissionCode , authz);
this.suitPanelEx.Dock = System.Windows.Forms.DockStyle.Fill;
this.suitPanelEx.Location = new System.Drawing.Point(0 , 0);
this.suitPanelEx.Name = "suitPanelEx";
this.suitPanelEx.Padding = new System.Windows.Forms.Padding(2);
this.mainPanel.Controls.Add(this.suitPanelEx);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (this.DesignMode) return;
this.SetStyle(ControlStyles.Selectable , true);
this.ActiveControl = this.suitPanelEx;
this.suitPanelEx.NotifyChanged += OnNotifyChanged;
this.suitPanelEx.CancelButtonClick += OnCancelButtonClick;
}
private void OnNotifyChanged(object sender , FlyoutEventArgs e)
{
this.OnAcceptButtonClick(new TransparentEventArgs(TransparentAction.Accept , e.KeyCode , e.Data));
}
private void OnCancelButtonClick(object sender , FlyoutEventArgs e)
{
OnControlBoxCloseClick(sender , EventArgs.Empty);
}
private void OnControlBoxCloseClick(object sender , EventArgs e)
{
if (this.Owner != null)
{
this.Owner.Close();
}
this.Close();
}
}
}