964d0a78bf
Added Voucher Type During Printing Added Discount Report Fixed Void bill table not getting cleared error Added PAX to table Removed Itital Setup button in MainForm as it was not doing anything
103 lines
3.2 KiB
C#
103 lines
3.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Windows.Forms;
|
|
using Tanshu.Data;
|
|
using Tanshu.Accounts.Entities;
|
|
|
|
namespace Tanshu.Accounts.Helpers
|
|
{
|
|
public class SelectCustomer : Tanshu.Data.BaseSelector<Customer>
|
|
{
|
|
public event CustomerEventHandler CustomerEvent;
|
|
public SelectCustomer(GetData<Customer> getData, bool autoClose) : base(getData, true, "List of Products")
|
|
{
|
|
var filters = new List<string> {"Universal"};
|
|
SetFilterColumns(filters);
|
|
grid.Columns["CustomerID"].Visible = false;
|
|
}
|
|
|
|
protected override void FilterChanged(Dictionary<string, string> filter)
|
|
{
|
|
//data = new CustomerBI().GetFilteredCustomers(filter["Universal"].Split(' ')).ToList();
|
|
data = getData(filter);
|
|
bindingSource.DataSource = data;
|
|
}
|
|
protected override void UpdateDisplay(Customer item)
|
|
{
|
|
DisplayLabel = item == null ? "" : string.Format("Chosen Customer is {0} with phone number {1}", item.Name, item.Phone);
|
|
}
|
|
|
|
protected override Customer HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
|
{
|
|
var customer = bindingSource.Current as Customer;
|
|
|
|
if (CustomerEvent == null)
|
|
{
|
|
e.Handled = false;
|
|
return customer;
|
|
}
|
|
int? id = null;
|
|
if ((customer != null) && (e.KeyCode == Keys.F2))
|
|
id = customer.CustomerID;
|
|
|
|
if ((e.KeyCode == Keys.F1) || (e.KeyCode == Keys.F2))
|
|
{
|
|
customer = CustomerEvent(sender, new CustomerEventArgs(id, base.filterColumns["Universal"]));
|
|
e.Handled = customer != null;
|
|
}
|
|
return customer;
|
|
}
|
|
#region Designer Code
|
|
/// <summary>
|
|
/// Required designer variable.
|
|
/// </summary>
|
|
private System.ComponentModel.IContainer components = null;
|
|
|
|
/// <summary>
|
|
/// Clean up any resources being used.
|
|
/// </summary>
|
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing && (components != null))
|
|
{
|
|
components.Dispose();
|
|
}
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
#region Windows Form Designer generated code
|
|
|
|
/// <summary>
|
|
/// Required method for Designer support - do not modify
|
|
/// the contents of this method with the code editor.
|
|
/// </summary>
|
|
private void InitializeComponent()
|
|
{
|
|
this.components = new System.ComponentModel.Container();
|
|
}
|
|
|
|
#endregion
|
|
#endregion
|
|
}
|
|
public delegate Customer CustomerEventHandler(object sender, CustomerEventArgs e);
|
|
public class CustomerEventArgs : EventArgs
|
|
{
|
|
public CustomerEventArgs(int? customerID, string phone)
|
|
{
|
|
CustomerID = customerID;
|
|
Phone = phone;
|
|
}
|
|
public int? CustomerID
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
public string Phone
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
}
|
|
}
|