Initial Commit
This commit is contained in:
103
Tanshu.Accounts.Helpers/ControlFactory.cs
Normal file
103
Tanshu.Accounts.Helpers/ControlFactory.cs
Normal file
@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
public static class ControlFactory
|
||||
{
|
||||
public static void GenerateButtons(ref Panel panel, Rectangle clientArea, int x, int y, int border, List<ProductDisplaySmallBO> list, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
int width = (clientArea.Width - (border * (x - 1))) / x;
|
||||
int height = (clientArea.Height - (border * (y - 1))) / y;
|
||||
int left = 0, top = 0, count = 0;
|
||||
for (int i = 0; i < x; i++)
|
||||
{
|
||||
left = clientArea.Left + (i * (width + border));
|
||||
for (int j = 0; j < y; j++)
|
||||
{
|
||||
count++;
|
||||
if (list.Count < count)
|
||||
break;
|
||||
top = clientArea.Top + (j * (height + border));
|
||||
ProductDisplaySmallBO item = list[(i * x) + j];
|
||||
Button btn = GetButton(string.Format("{0}-{1}", i, j), item.Name, width, height, left, top, item.ProductID, bcDelegate);
|
||||
panel.Controls.Add(btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void GenerateButtons(ref Panel panel, Rectangle clientArea, int x, int y, int border, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
int width = (clientArea.Width - (border * (x - 1))) / x;
|
||||
int height = (clientArea.Height - (border * (y - 1))) / y;
|
||||
for (int i = 0; i < x; i++)
|
||||
{
|
||||
int left = clientArea.Left + (i * (width + border));
|
||||
for (int j = 0; j < y; j++)
|
||||
{
|
||||
int top = clientArea.Top + (j * (height + border));
|
||||
Button btn = GetButton(string.Format("{0}-{1}", i, j), string.Format("{0}-{1}", i, j), width, height, left, top, string.Format("{0}-{1} Clicked", i, j), bcDelegate);
|
||||
panel.Controls.Add(btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
private static TextBox GetTextBox(string name, string text, int width, int height, int x, int y, object tag, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
TextBox textBox = CreateControl(ControlType.TextBox, name, text, width, height, x, y) as TextBox;
|
||||
textBox.Tag = tag;
|
||||
if (bcDelegate != null)
|
||||
textBox.Click += new EventHandler(bcDelegate);
|
||||
return textBox;
|
||||
}
|
||||
private static Button GetButton(string name, string text, int width, int height, int x, int y, object tag, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
Button button = CreateControl(ControlType.Button, name, text, width, height, x, y) as Button;
|
||||
button.Tag = tag;
|
||||
if (bcDelegate != null)
|
||||
button.Click += new EventHandler(bcDelegate);
|
||||
return button;
|
||||
}
|
||||
private static Control CreateControl(ControlType controlType, string name, string text, int width, int height, int x, int y)
|
||||
{
|
||||
switch (controlType)
|
||||
{
|
||||
case ControlType.TextBox:
|
||||
{
|
||||
TextBox textBox = new TextBox();
|
||||
textBox.Name = name;
|
||||
textBox.Text = text;
|
||||
textBox.Width = width;
|
||||
textBox.Height = height;
|
||||
textBox.Left = x;
|
||||
textBox.Top = y;
|
||||
return textBox;
|
||||
}
|
||||
case ControlType.Button:
|
||||
{
|
||||
Button button = new Button();
|
||||
button.Name = name;
|
||||
button.Text = text;
|
||||
button.Width = width;
|
||||
button.Height = height;
|
||||
button.Left = x;
|
||||
button.Top = y;
|
||||
return button;
|
||||
}
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public enum ControlType
|
||||
{
|
||||
TextBox = 1,
|
||||
Button = 2
|
||||
}
|
||||
public delegate void ButtonClickDelegate(object sender, EventArgs e);
|
||||
}
|
||||
24
Tanshu.Accounts.Helpers/CustomStructs.cs
Normal file
24
Tanshu.Accounts.Helpers/CustomStructs.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.Serialization;
|
||||
using Tanshu.Common;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
public class StringType
|
||||
{
|
||||
string description;
|
||||
public StringType(string description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public string Description
|
||||
{
|
||||
get { return description; }
|
||||
set { description = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Tanshu.Accounts.Helpers/Properties/AssemblyInfo.cs
Normal file
36
Tanshu.Accounts.Helpers/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Tanshu.Accounts.Library")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Tanshu.Accounts.Library")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2008")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("81ae2a4e-3508-4031-8868-0fced349f818")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
73
Tanshu.Accounts.Helpers/SelectBill.cs
Normal file
73
Tanshu.Accounts.Helpers/SelectBill.cs
Normal file
@ -0,0 +1,73 @@
|
||||
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;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
public class SelectBill : Tanshu.Data.BaseSelector<PendingBillsBO>
|
||||
{
|
||||
public SelectBill(GetData<PendingBillsBO> getData, bool autoClose)
|
||||
: base(getData, true, "List of Bills")
|
||||
{
|
||||
//grid.Columns["CustomerID"].Visible = false;
|
||||
//grid.Columns["LedgerID"].Visible = false;
|
||||
}
|
||||
|
||||
protected override void FilterChanged(Dictionary<string, string> filter)
|
||||
{
|
||||
//data = CustomerProxy.GetCustomers(filter["Universal"].Split(' ')).ToList();
|
||||
//bindingSource.DataSource = data;
|
||||
}
|
||||
protected override void UpdateDisplay(PendingBillsBO item)
|
||||
{
|
||||
//if (item == null)
|
||||
// DisplayLabel = "";
|
||||
//else
|
||||
// DisplayLabel = string.Format("Chosen Customer is {0} with phone number {1}", item.Name, item.Phone);
|
||||
}
|
||||
protected override PendingBillsBO HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
{
|
||||
e.Handled = false;
|
||||
return null;
|
||||
}
|
||||
#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
|
||||
}
|
||||
}
|
||||
112
Tanshu.Accounts.Helpers/SelectCustomer.cs
Normal file
112
Tanshu.Accounts.Helpers/SelectCustomer.cs
Normal file
@ -0,0 +1,112 @@
|
||||
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.Accounts.BI;
|
||||
using Tanshu.Data;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
public class SelectCustomer : Tanshu.Data.BaseSelector<CustomerBO>
|
||||
{
|
||||
public event CustomerEventHandler customerEvent;
|
||||
public SelectCustomer(GetData<CustomerBO> getData, bool autoClose) : base(getData, true, "List of Products")
|
||||
{
|
||||
List<string> filters = new List<string>();
|
||||
filters.Add("Universal");
|
||||
SetFilterColumns(filters);
|
||||
grid.Columns["CustomerID"].Visible = false;
|
||||
grid.Columns["LedgerID"].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(CustomerBO item)
|
||||
{
|
||||
if (item == null)
|
||||
DisplayLabel = "";
|
||||
else
|
||||
DisplayLabel = string.Format("Chosen Customer is {0} with phone number {1}", item.Name, item.Phone);
|
||||
}
|
||||
protected override CustomerBO HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
{
|
||||
CustomerBO customer = bindingSource.Current as CustomerBO;
|
||||
|
||||
if (customerEvent == null)
|
||||
{
|
||||
e.Handled = false;
|
||||
return customer;
|
||||
}
|
||||
Guid? 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 CustomerBO CustomerEventHandler(object sender, CustomerEventArgs e);
|
||||
public class CustomerEventArgs : EventArgs
|
||||
{
|
||||
public CustomerEventArgs(Guid? customerID, string phone)
|
||||
{
|
||||
CustomerID = customerID;
|
||||
Phone = phone;
|
||||
}
|
||||
public Guid? CustomerID
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string Phone
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
}
|
||||
}
|
||||
77
Tanshu.Accounts.Helpers/SelectProduct.cs
Normal file
77
Tanshu.Accounts.Helpers/SelectProduct.cs
Normal file
@ -0,0 +1,77 @@
|
||||
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;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
public class SelectProduct : Tanshu.Data.BaseSelector<ProductDisplaySmallBO>
|
||||
{
|
||||
public SelectProduct(GetData<ProductDisplaySmallBO> getData, bool autoClose)
|
||||
: base(getData, true, "List of Products")
|
||||
{
|
||||
List<string> filters = new List<string>();
|
||||
filters.Add("Name");
|
||||
filters.Add("Type");
|
||||
SetFilterColumns(filters);
|
||||
grid.Columns["ProductID"].Visible = false;
|
||||
}
|
||||
|
||||
protected override void FilterChanged(Dictionary<string, string> filter)
|
||||
{
|
||||
data = getData(filter);
|
||||
bindingSource.DataSource = data;
|
||||
}
|
||||
|
||||
protected override void UpdateDisplay(ProductDisplaySmallBO item)
|
||||
{
|
||||
if (item == null)
|
||||
DisplayLabel = "";
|
||||
else
|
||||
DisplayLabel = string.Format("Chosen Product {0} with rate Rs. {1}", item.Name, item.Price);
|
||||
}
|
||||
protected override ProductDisplaySmallBO HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
{
|
||||
e.Handled = false;
|
||||
return null;
|
||||
}
|
||||
#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
|
||||
}
|
||||
}
|
||||
121
Tanshu.Accounts.Helpers/SelectUser.cs
Normal file
121
Tanshu.Accounts.Helpers/SelectUser.cs
Normal file
@ -0,0 +1,121 @@
|
||||
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;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
public class SelectUser : Tanshu.Data.BaseSelector<UserBO>
|
||||
{
|
||||
public event UserEventHandler userEvent;
|
||||
public SelectUser(GetData<UserBO> getData, bool autoClose) : base (getData, true, "Select a User")
|
||||
{
|
||||
List<string> filters = new List<string>();
|
||||
filters.Add("Name");
|
||||
SetFilterColumns(filters);
|
||||
grid.Columns["UserID"].Visible = false;
|
||||
grid.Columns["timestamp"].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(UserBO item)
|
||||
{
|
||||
if (item == null)
|
||||
DisplayLabel = "";
|
||||
else
|
||||
DisplayLabel = string.Format("User Name: {0}", item.Name);
|
||||
}
|
||||
protected override UserBO HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
{
|
||||
UserBO user = bindingSource.Current as UserBO;
|
||||
|
||||
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 UserBO();
|
||||
UserEventArgs 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 UserBO UserEventHandler(object sender, UserEventArgs e);
|
||||
public class UserEventArgs : EventArgs
|
||||
{
|
||||
public UserEventArgs(UserBO user)
|
||||
{
|
||||
User = user;
|
||||
Handled = false;
|
||||
}
|
||||
|
||||
public UserBO User
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public bool Handled
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
76
Tanshu.Accounts.Helpers/SelectVoidReason.cs
Normal file
76
Tanshu.Accounts.Helpers/SelectVoidReason.cs
Normal file
@ -0,0 +1,76 @@
|
||||
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.Data;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
|
||||
public class SelectVoidReason : Tanshu.Data.BaseSelector<StringType>
|
||||
{
|
||||
public SelectVoidReason(GetData<StringType> getData, bool autoClose)
|
||||
: base(getData, autoClose, "Reason for Voiding Bill")
|
||||
{
|
||||
List<string> filters = new List<string>();
|
||||
filters.Add("Name");
|
||||
SetFilterColumns(filters);
|
||||
}
|
||||
|
||||
protected override void FilterChanged(Dictionary<string, string> filter)
|
||||
{
|
||||
//data = originalData.Where(d => d.Description.ToLower().Contains(filter["Name"].ToLower())).ToList();
|
||||
data = getData(filter);
|
||||
bindingSource.DataSource = data;
|
||||
}
|
||||
protected override void UpdateDisplay(StringType item)
|
||||
{
|
||||
if (item == null)
|
||||
DisplayLabel = "";
|
||||
else
|
||||
DisplayLabel = string.Format("Reason for Voiding: {0}", item);
|
||||
}
|
||||
protected override StringType HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
{
|
||||
e.Handled = false;
|
||||
return null;
|
||||
}
|
||||
#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
|
||||
|
||||
}
|
||||
}
|
||||
139
Tanshu.Accounts.Helpers/SelectWaiter.cs
Normal file
139
Tanshu.Accounts.Helpers/SelectWaiter.cs
Normal file
@ -0,0 +1,139 @@
|
||||
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;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
public class SelectWaiter : Tanshu.Data.BaseSelector<WaiterBO>
|
||||
{
|
||||
public event WaiterEventHandler waiterEvent;
|
||||
public SelectWaiter(GetData<WaiterBO> getData, bool autoClose) : base(getData, true, "Select a Waiter")
|
||||
{
|
||||
List<string> filters = new List<string>();
|
||||
filters.Add("Name");
|
||||
SetFilterColumns(filters);
|
||||
grid.Columns["WaiterID"].Visible = false;
|
||||
grid.Columns["timestamp"].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(WaiterBO item)
|
||||
{
|
||||
if (item == null)
|
||||
DisplayLabel = "";
|
||||
else
|
||||
DisplayLabel = string.Format("Waiter Name: {0}", item.Name);
|
||||
}
|
||||
protected override WaiterBO HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
{
|
||||
WaiterBO waiter = bindingSource.Current as WaiterBO;
|
||||
|
||||
if (waiterEvent == null)
|
||||
{
|
||||
e.Handled = false;
|
||||
return waiter;
|
||||
}
|
||||
|
||||
WaiterEventArgs eventArgs = new WaiterEventArgs(null, 1);
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.F1:
|
||||
{
|
||||
waiter = new WaiterBO { Name = base.filterColumns["Name"].Trim() };
|
||||
eventArgs = new WaiterEventArgs(waiter, 1);
|
||||
break;
|
||||
}
|
||||
case Keys.F2:
|
||||
{
|
||||
if (waiter != null)
|
||||
waiter.Name = base.filterColumns["Name"].Trim();
|
||||
eventArgs = new WaiterEventArgs(waiter, 2);
|
||||
break;
|
||||
}
|
||||
case Keys.F8:
|
||||
{
|
||||
if (waiter != null)
|
||||
eventArgs = new WaiterEventArgs(waiter, 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((waiter != null) && ((e.KeyCode == Keys.F1) || (e.KeyCode == Keys.F2) || (e.KeyCode == Keys.F8)))
|
||||
waiter = waiterEvent(sender, eventArgs);
|
||||
|
||||
e.Handled = eventArgs.Handled;
|
||||
return waiter;
|
||||
}
|
||||
#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 WaiterBO WaiterEventHandler(object sender, WaiterEventArgs e);
|
||||
public class WaiterEventArgs : EventArgs
|
||||
{
|
||||
public WaiterEventArgs(WaiterBO waiter, int action)
|
||||
{
|
||||
Waiter = waiter;
|
||||
Action = action;
|
||||
Handled = false;
|
||||
}
|
||||
|
||||
public WaiterBO Waiter
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public int Action
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public bool Handled
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
110
Tanshu.Accounts.Helpers/Tanshu.Accounts.Helpers.csproj
Normal file
110
Tanshu.Accounts.Helpers/Tanshu.Accounts.Helpers.csproj
Normal file
@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{3E28AAA5-A493-4446-8188-C615245943B4}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Tanshu.Accounts.Helpers</RootNamespace>
|
||||
<AssemblyName>Tanshu.Accounts.Helpers</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\Bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\Bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.configuration" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Runtime.Serialization">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Tanshu.Common, Version=1.0.3382.27403, Culture=neutral, PublicKeyToken=fd89fe1d2351f8b5, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Include\Tanshu.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Tanshu.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fd89fe1d2351f8b5, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Include\Tanshu.Data.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ControlFactory.cs" />
|
||||
<Compile Include="SelectUser.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CustomStructs.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SelectBill.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SelectVoidReason.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SelectCustomer.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SelectWaiter.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SelectProduct.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{3259AA49-8AA1-44D3-9025-A0B520596A8C}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Tanshu.Accounts.Contracts\Tanshu.Accounts.Contracts.csproj">
|
||||
<Project>{59A6F8B8-12EE-4D8E-BEBB-61CB665A2C17}</Project>
|
||||
<Name>Tanshu.Accounts.Contracts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Tanshu.Accounts.BI\Tanshu.Accounts.BI.csproj">
|
||||
<Project>{0B43ECD4-3701-4CD3-82EC-617D7D590BBB}</Project>
|
||||
<Name>Tanshu.Accounts.BI</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Reference in New Issue
Block a user