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
119 lines
3.4 KiB
C#
119 lines
3.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using System.Linq;
|
|
using Tanshu.Accounts.Contracts;
|
|
using Tanshu.Data;
|
|
using Tanshu.Accounts.Entities.Auth;
|
|
|
|
namespace Tanshu.Accounts.Helpers
|
|
{
|
|
public class SelectUser : Tanshu.Data.BaseSelector<User>
|
|
{
|
|
public event UserEventHandler UserEvent;
|
|
public SelectUser(GetData<User> getData, bool autoClose) : base (getData, true, "Select a User")
|
|
{
|
|
var filters = new List<string> {"Name"};
|
|
SetFilterColumns(filters);
|
|
grid.Columns["UserID"].Visible = false;
|
|
}
|
|
|
|
protected override void FilterChanged(Dictionary<string, string> filter)
|
|
{
|
|
//data = originalData.Where(d => d.Name.ToLower().Contains(filter["Name"].ToLower())).ToList();
|
|
data = getData(filter);
|
|
bindingSource.DataSource = data;
|
|
}
|
|
protected override void UpdateDisplay(User item)
|
|
{
|
|
DisplayLabel = item == null ? "" : string.Format("User Name: {0}", item.Name);
|
|
}
|
|
|
|
protected override User HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
|
{
|
|
var user = bindingSource.Current as User;
|
|
|
|
if (UserEvent == null)
|
|
{
|
|
e.Handled = false;
|
|
return user;
|
|
}
|
|
if ((e.KeyCode != Keys.F1) && (e.KeyCode != Keys.F2))
|
|
{
|
|
e.Handled = false;
|
|
return user;
|
|
}
|
|
if ((user == null) && (e.KeyCode == Keys.F2))
|
|
{
|
|
e.Handled = false;
|
|
return user;
|
|
}
|
|
|
|
if (e.KeyCode == Keys.F1)
|
|
user = new User();
|
|
var userEventArgs = new UserEventArgs(user);
|
|
user = UserEvent(sender, userEventArgs);
|
|
|
|
e.Handled = userEventArgs.Handled;
|
|
return user;
|
|
}
|
|
#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 User UserEventHandler(object sender, UserEventArgs e);
|
|
public class UserEventArgs : EventArgs
|
|
{
|
|
public UserEventArgs(User user)
|
|
{
|
|
User = user;
|
|
Handled = false;
|
|
}
|
|
|
|
public User User
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
public bool Handled
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
}
|
|
}
|