Numpad User Control and Login Changes

This commit is contained in:
unknown committed 2011-01-06 12:47:00 +05:30
1 parent 232a62f8ca
commit e32e9f9e74
47 files changed
+1536 -714

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
*/[Oo]bj/
*/[Bb]in/
*.suo
[Bb]in/
+61 -39
View File
@@ -11,64 +11,86 @@ namespace Tanshu.Accounts.BI
{
string roleID;
Guid userID;
bool elevated;
AccountsPrincipal originalUser;
AuthenticateUser authenticateUser;
//bool elevated;
//AccountsPrincipal originalUser;
//AuthenticateUser authenticateUser;
public RoleBI(string roleID, Guid userID)
{
this.roleID = roleID;
this.userID = userID;
elevated = false;
originalUser = null;
authenticateUser = null;
//elevated = false;
//originalUser = null;
//authenticateUser = null;
disposed = false;
}
public bool IsAllowed
{
get
{
if (userID == new Guid())
return false;
return new MembershipBI().IsUserInRole(userID, roleID);
}
}
public bool IsElevated
//public bool IsElevated
//{
// get
// {
// return elevated;
// }
//}
//public void Evelvate(AuthenticateUser authenticateUser)
//{
// this.authenticateUser = authenticateUser;
// string userName;
// if (this.authenticateUser(out userName))
// {
// originalUser = (AccountsPrincipal)Thread.CurrentPrincipal;
// SetElevation(userName);
// }
//}
//private void SetElevation(string userName)
//{
// if (userName.Contains(":"))
// userName = userName.Substring(userName.IndexOf(":") + 1);
// Session.User = new MembershipBI().GetUserFromName(userName));
// // bind the generic principal to the thread
// Thread.CurrentPrincipal = principal;
// userName = ((AccountsIdentity)principal.Identity).UserInfo.Name;
// userID = ((AccountsIdentity)principal.Identity).UserInfo.UserID;
// elevated = true;
//}
#region IDisposable
bool disposed;
~RoleBI()
{
get
{
return elevated;
}
// call Dispose with false. Since we're in the
// destructor call, the managed resources will be
// disposed of anyways.
Dispose(false);
}
public void Evelvate(AuthenticateUser authenticateUser)
{
this.authenticateUser = authenticateUser;
string userName;
if (this.authenticateUser(out userName))
{
originalUser = (AccountsPrincipal)Thread.CurrentPrincipal;
SetElevation(userName);
}
}
private void SetElevation(string userName)
{
if (userName.Contains(":"))
userName = userName.Substring(userName.IndexOf(":") + 1);
AccountsPrincipal principal = AccountsPrincipal.CreateAccountsPrincipal(new Tanshu.Accounts.BI.MembershipBI().GetRolesForUser(userName),
new MembershipBI().GetUserFromName(userName));
// bind the generic principal to the thread
Thread.CurrentPrincipal = principal;
userName = ((AccountsIdentity)principal.Identity).UserInfo.Name;
userID = ((AccountsIdentity)principal.Identity).UserInfo.UserID;
elevated = true;
}
public void Dispose()
{
if (elevated)
Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
if (!this.disposed)
{
Thread.CurrentPrincipal = originalUser;
//if (elevated)
// Thread.CurrentPrincipal = originalUser;
// Note disposing has been done.
disposed = true;
}
}
#endregion
}
}
-97
View File
@@ -1,97 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Security.Principal;
using System.Globalization;
using System.Threading;
using Tanshu.Accounts.Contracts;
namespace Tanshu.Accounts.BI
{
public class AccountsIdentity : IIdentity
{
// the authentication type for us is always database
private static string AuthenticationTypeString = "Database";
// hash table with all the user info we have
private UserBO userInfo;
// create the user identity; all user information is in the
// hashtable passed along
private AccountsIdentity(UserBO UserInfo)
{
this.userInfo = UserInfo;
}
//create a user identity and return it to the caller
public static AccountsIdentity CreateUserIdentity(UserBO UserInfo)
{
return new AccountsIdentity(UserInfo);
}
// returns the name of the identity
public string Name { get { return UserInfo.Name; } }
// returns the userID of the identity
public UserBO UserInfo { get { return userInfo; } }
// returns whether or not identity is authenticated
public bool IsAuthenticated { get { return true; } }
// the type of authentication
public string AuthenticationType { get { return AuthenticationTypeString; } }
}
public class AccountsPrincipal : IPrincipal
{
// stores the list of roles user has
private string[] userRoles;
// the user identity we create and associate with this principal
private AccountsIdentity userIdentity;
// constructor: stores role and permission info and creates
// custom identity
private AccountsPrincipal(string[] userRoles, UserBO userInfo)
{
this.userRoles = userRoles;
// creates the IIdentity for the user and associates it with
// this IPrincipal
userIdentity = AccountsIdentity.CreateUserIdentity(userInfo);
}
// create the security principal and return it to the caller
public static AccountsPrincipal CreateAccountsPrincipal(string[] userRoles, UserBO userInfo)
{
return new AccountsPrincipal(userRoles, userInfo);
}
// returns the Identity object associated with the principal
public IIdentity Identity
{
get
{
return userIdentity;
}
}
// checks whether user belongs to role
public bool IsInRole(string Role)
{
//return userRoles.Where(ur => ur.ToLower() == Role.ToLower()).Count() > 1;
return (userRoles.Where(ur => ur.Trim().ToLower() == Role.Trim().ToLower()).Count() > 0 ? true : false);
}
}
public static class CurrentUser
{
public static UserBO user
{
get
{
AccountsIdentity identity = (AccountsIdentity)Thread.CurrentPrincipal.Identity;
return identity.UserInfo;
}
}
}
}
@@ -67,7 +67,6 @@
<Compile Include="CustomerBI.cs" />
<Compile Include="ManagementBI.cs" />
<Compile Include="RoleBI.cs" />
<Compile Include="SecurityBI.cs" />
<Compile Include="WaiterBI.cs" />
<Compile Include="LedgerBI.cs" />
<Compile Include="MembershipBI.cs" />
+18
View File
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Tanshu.Accounts.Contracts
{
public static class Roles
{
public const string SALES_CHECKOUT = "Sales/Checkout";
public const string SALES_SALES_BILL = "Sales/SalesBill";
public const string SECURITY_MANAGE_ROLES = "Security/ManageRoles";
public const string SALES_SALE_DETAIL = "Sales/SaleDetail";
public const string MASTER_PRODUCTS = "Master/Products";
public const string LOG_VIEW = "Log/View";
public const string MASTER_OWNER = "Master/Owner";
}
}
@@ -106,6 +106,7 @@
<Compile Include="Data Contracts\SaleVoucherBO.cs" />
<Compile Include="Data Contracts\UserBO.cs" />
<Compile Include="Data Contracts\VoucherBO.cs" />
<Compile Include="Roles.cs" />
<Compile Include="Service Contracts\AdvanceBI.cs" />
<Compile Include="Service Contracts\CheckoutBI.cs" />
<Compile Include="Service Contracts\CustomerBI.cs" />
+1 -2
View File
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="connection" connectionString="Server=.;Initial Catalog=AccountsBF;User ID=sa;Password=123456" />
<add name="connection" connectionString="Server=.;Initial Catalog=PeithoPOS;User ID=sa;Password=123456" />
</connectionStrings>
<appSettings>
<add key ="Factory" value ="SqlServer"/>
<add key ="LogConnection" value ="connection"/>
<add key ="LogLevel" value ="Warn"/>
<add key="Printer" value="Posiflex" />
</appSettings>
</configuration>
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Tanshu.Accounts.PointOfSale
{
interface ILogin
{
bool LoginUser();
bool LogoutUser();
}
}
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tanshu.Accounts.BI;
using System.Threading;
namespace Tanshu.Accounts.PointOfSale
{
class KeyboardLogin : ILogin
{
private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public bool LoginUser()
{
return LoginUser(true);
}
bool LoginUser(bool setThreadPrincipal)
{
using (LoginForm login = new LoginForm())
{
string userName;
login.ShowDialog();
bool authenticated = login.UserName(out userName);
if (authenticated && setThreadPrincipal)
SetThreadPrincipal(userName);
return authenticated;
}
}
public bool LogoutUser()
{
Session.User = null;
return true;
}
static void SetThreadPrincipal(string userName)
{
log.Warn(string.Format("User Login: '{0}'", userName));
if (userName.Contains(":"))
userName = userName.Substring(userName.IndexOf(":") + 1);
Session.User = new MembershipBI().GetUserFromName(userName);
}
}
}
@@ -34,6 +34,7 @@
this.Label2 = new System.Windows.Forms.Label();
this.txtUserName = new System.Windows.Forms.TextBox();
this.Label1 = new System.Windows.Forms.Label();
this.numpadControl1 = new Tanshu.Common.KeyboardControl.NumpadControl();
this.SuspendLayout();
//
// btnExit
@@ -90,12 +91,21 @@
this.Label1.TabIndex = 4;
this.Label1.Text = "Username";
//
// numpadControl1
//
this.numpadControl1.Location = new System.Drawing.Point(35, 93);
this.numpadControl1.Name = "numpadControl1";
this.numpadControl1.Size = new System.Drawing.Size(224, 224);
this.numpadControl1.TabIndex = 6;
this.numpadControl1.TabStop = false;
//
// LoginForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnExit;
this.ClientSize = new System.Drawing.Size(290, 99);
this.ClientSize = new System.Drawing.Size(290, 329);
this.Controls.Add(this.numpadControl1);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.Label2);
this.Controls.Add(this.txtUserName);
@@ -119,5 +129,6 @@
internal System.Windows.Forms.Label Label2;
internal System.Windows.Forms.TextBox txtUserName;
internal System.Windows.Forms.Label Label1;
private Tanshu.Common.KeyboardControl.NumpadControl numpadControl1;
}
}
@@ -8,14 +8,17 @@ namespace Tanshu.Accounts.PointOfSale
{
public partial class LoginForm : Form
{
//size: 296, 123
private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private bool isAuthenticated;
private string userName;
private bool cancelled;
public LoginForm()
{
InitializeComponent();
isAuthenticated = false;
userName = null;
cancelled = true;
}
private void txtUserName_KeyDown(object sender, KeyEventArgs e)
@@ -36,7 +39,9 @@ namespace Tanshu.Accounts.PointOfSale
isAuthenticated = new MembershipBI().ValidateUser(userName, Tanshu.Common.Md5.Hash(txtPassword.Text, "Salt"));
if (isAuthenticated)
{
this.Close();
}
else
MessageBox.Show("Username or password is not valid");
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tanshu.Accounts.Contracts;
namespace Tanshu.Accounts.PointOfSale
{
static class Session
{
private static UserBO currentUser;
public static bool IsAuthenticated { get; private set; }
public static UserBO User
{
get
{
return currentUser;
}
set
{
if (value != null)
{
currentUser = value;
IsAuthenticated = true;
}
else
{
currentUser = null;
IsAuthenticated = false;
}
}
}
static public string printer()
{
return "";
}
}
}
+291
View File
@@ -0,0 +1,291 @@
namespace Tanshu.Accounts.PointOfSale
{
partial class CurrencyCounter
{
/// <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.txtTotal = new System.Windows.Forms.TextBox();
this.txt1 = new System.Windows.Forms.TextBox();
this.txt2 = new System.Windows.Forms.TextBox();
this.txt5 = new System.Windows.Forms.TextBox();
this.txt10 = new System.Windows.Forms.TextBox();
this.txt20 = new System.Windows.Forms.TextBox();
this.txt50 = new System.Windows.Forms.TextBox();
this.txt100 = new System.Windows.Forms.TextBox();
this.txt500 = new System.Windows.Forms.TextBox();
this.txt1000 = new System.Windows.Forms.TextBox();
this.btnPrint = new System.Windows.Forms.Button();
this.lblTotal = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// txtTotal
//
this.txtTotal.Location = new System.Drawing.Point(54, 282);
this.txtTotal.Name = "txtTotal";
this.txtTotal.ReadOnly = true;
this.txtTotal.Size = new System.Drawing.Size(100, 20);
this.txtTotal.TabIndex = 42;
//
// txt1
//
this.txt1.Location = new System.Drawing.Point(54, 252);
this.txt1.Name = "txt1";
this.txt1.Size = new System.Drawing.Size(100, 20);
this.txt1.TabIndex = 41;
this.txt1.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt2
//
this.txt2.Location = new System.Drawing.Point(54, 222);
this.txt2.Name = "txt2";
this.txt2.Size = new System.Drawing.Size(100, 20);
this.txt2.TabIndex = 40;
this.txt2.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt5
//
this.txt5.Location = new System.Drawing.Point(54, 192);
this.txt5.Name = "txt5";
this.txt5.Size = new System.Drawing.Size(100, 20);
this.txt5.TabIndex = 39;
this.txt5.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt10
//
this.txt10.Location = new System.Drawing.Point(54, 162);
this.txt10.Name = "txt10";
this.txt10.Size = new System.Drawing.Size(100, 20);
this.txt10.TabIndex = 38;
this.txt10.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt20
//
this.txt20.Location = new System.Drawing.Point(54, 132);
this.txt20.Name = "txt20";
this.txt20.Size = new System.Drawing.Size(100, 20);
this.txt20.TabIndex = 37;
this.txt20.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt50
//
this.txt50.Location = new System.Drawing.Point(54, 102);
this.txt50.Name = "txt50";
this.txt50.Size = new System.Drawing.Size(100, 20);
this.txt50.TabIndex = 36;
this.txt50.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt100
//
this.txt100.Location = new System.Drawing.Point(54, 72);
this.txt100.Name = "txt100";
this.txt100.Size = new System.Drawing.Size(100, 20);
this.txt100.TabIndex = 35;
this.txt100.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt500
//
this.txt500.Location = new System.Drawing.Point(54, 42);
this.txt500.Name = "txt500";
this.txt500.Size = new System.Drawing.Size(100, 20);
this.txt500.TabIndex = 34;
this.txt500.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt1000
//
this.txt1000.Location = new System.Drawing.Point(54, 12);
this.txt1000.Name = "txt1000";
this.txt1000.Size = new System.Drawing.Size(100, 20);
this.txt1000.TabIndex = 33;
this.txt1000.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// btnPrint
//
this.btnPrint.Location = new System.Drawing.Point(54, 313);
this.btnPrint.Name = "btnPrint";
this.btnPrint.Size = new System.Drawing.Size(100, 20);
this.btnPrint.TabIndex = 32;
this.btnPrint.Text = "Print";
this.btnPrint.UseVisualStyleBackColor = true;
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
//
// lblTotal
//
this.lblTotal.AutoSize = true;
this.lblTotal.Location = new System.Drawing.Point(16, 285);
this.lblTotal.Name = "lblTotal";
this.lblTotal.Size = new System.Drawing.Size(31, 13);
this.lblTotal.TabIndex = 31;
this.lblTotal.Text = "Total";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(29, 258);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(18, 13);
this.label10.TabIndex = 30;
this.label10.Text = "1x";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(28, 227);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(18, 13);
this.label9.TabIndex = 29;
this.label9.Text = "2x";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(28, 197);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(18, 13);
this.label8.TabIndex = 28;
this.label8.Text = "5x";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(22, 167);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(24, 13);
this.label7.TabIndex = 27;
this.label7.Text = "10x";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(22, 137);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(24, 13);
this.label6.TabIndex = 26;
this.label6.Text = "20x";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(21, 108);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(24, 13);
this.label5.TabIndex = 25;
this.label5.Text = "50x";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(17, 75);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(30, 13);
this.label3.TabIndex = 24;
this.label3.Text = "100x";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(18, 46);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(30, 13);
this.label2.TabIndex = 23;
this.label2.Text = "500x";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(36, 13);
this.label1.TabIndex = 22;
this.label1.Text = "1000x";
//
// CurrencyCounter
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(173, 354);
this.Controls.Add(this.txtTotal);
this.Controls.Add(this.txt1);
this.Controls.Add(this.txt2);
this.Controls.Add(this.txt5);
this.Controls.Add(this.txt10);
this.Controls.Add(this.txt20);
this.Controls.Add(this.txt50);
this.Controls.Add(this.txt100);
this.Controls.Add(this.txt500);
this.Controls.Add(this.txt1000);
this.Controls.Add(this.btnPrint);
this.Controls.Add(this.lblTotal);
this.Controls.Add(this.label10);
this.Controls.Add(this.label9);
this.Controls.Add(this.label8);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "CurrencyCounter";
this.Text = "CurrencyCounter";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox txtTotal;
private System.Windows.Forms.TextBox txt1;
private System.Windows.Forms.TextBox txt2;
private System.Windows.Forms.TextBox txt5;
private System.Windows.Forms.TextBox txt10;
private System.Windows.Forms.TextBox txt20;
private System.Windows.Forms.TextBox txt50;
private System.Windows.Forms.TextBox txt100;
private System.Windows.Forms.TextBox txt500;
private System.Windows.Forms.TextBox txt1000;
private System.Windows.Forms.Button btnPrint;
private System.Windows.Forms.Label lblTotal;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
}
}
@@ -0,0 +1,57 @@
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;
namespace Tanshu.Accounts.PointOfSale
{
public partial class CurrencyCounter : Form
{
public CurrencyCounter()
{
InitializeComponent();
}
private void btnPrint_Click(object sender, EventArgs e)
{
Dictionary<int, int> amounts = new Dictionary<int, int>();
if (txt1000.Text != "") amounts.Add(1000, Convert.ToInt32(txt1000.Text));
if (txt500.Text != "") amounts.Add(500, Convert.ToInt32(txt500.Text));
if (txt100.Text != "") amounts.Add(100, Convert.ToInt32(txt100.Text));
if (txt50.Text != "") amounts.Add(50, Convert.ToInt32(txt50.Text));
if (txt20.Text != "") amounts.Add(20, Convert.ToInt32(txt20.Text));
if (txt10.Text != "") amounts.Add(10, Convert.ToInt32(txt10.Text));
if (txt5.Text != "") amounts.Add(5, Convert.ToInt32(txt5.Text));
if (txt2.Text != "") amounts.Add(2, Convert.ToInt32(txt2.Text));
if (txt1.Text != "") amounts.Add(1, Convert.ToInt32(txt1.Text));
Accounts.Print.Thermal.PrintCash(Session.printer(), amounts, Session.User.Name);
}
private void txt1000_TextChanged(object sender, EventArgs e)
{
try
{
int Amount = 0;
Amount += 1000 * (txt1000.Text == "" ? 0 : Convert.ToInt16(txt1000.Text));
Amount += 500 * (txt500.Text == "" ? 0 : Convert.ToInt16(txt500.Text));
Amount += 100 * (txt100.Text == "" ? 0 : Convert.ToInt16(txt100.Text));
Amount += 50 * (txt50.Text == "" ? 0 : Convert.ToInt16(txt50.Text));
Amount += 20 * (txt20.Text == "" ? 0 : Convert.ToInt16(txt20.Text));
Amount += 10 * (txt10.Text == "" ? 0 : Convert.ToInt16(txt10.Text));
Amount += 5 * (txt5.Text == "" ? 0 : Convert.ToInt16(txt5.Text));
Amount += 2 * (txt2.Text == "" ? 0 : Convert.ToInt16(txt2.Text));
Amount += 1 * (txt1.Text == "" ? 0 : Convert.ToInt16(txt1.Text));
txtTotal.Text = Amount.ToString();
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("Error Number " + ex.Source + "\n\r" + ex.Message);
}
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+97 -186
View File
@@ -16,86 +16,28 @@ namespace Tanshu.Accounts.PointOfSale
InitializeComponent();
}
private void btnPrint_Click(object sender, EventArgs e)
{
MessageBox.Show(CurrentUser.user.Name);
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI("Sales/Checkout"))
{
if (roleBI.IsAllowed)
using (Cashier_Checkout_Form frmChashierCheckOut = new Cashier_Checkout_Form())
{
frmChashierCheckOut.ShowDialog();
}
}
//Dictionary<int, int> amounts = new Dictionary<int, int>();
//if (txt1000.Text != "") amounts.Add(1000, Convert.ToInt32(txt1000.Text));
//if (txt500.Text != "") amounts.Add(500, Convert.ToInt32(txt500.Text));
//if (txt100.Text != "") amounts.Add(100, Convert.ToInt32(txt100.Text));
//if (txt50.Text != "") amounts.Add(50, Convert.ToInt32(txt50.Text));
//if (txt20.Text != "") amounts.Add(20, Convert.ToInt32(txt20.Text));
//if (txt10.Text != "") amounts.Add(10, Convert.ToInt32(txt10.Text));
//if (txt5.Text != "") amounts.Add(5, Convert.ToInt32(txt5.Text));
//if (txt2.Text != "") amounts.Add(2, Convert.ToInt32(txt2.Text));
//if (txt1.Text != "") amounts.Add(1, Convert.ToInt32(txt1.Text));
//Accounts.Print.Thermal.PrintCash(amounts);
}
private void saleToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!Thread.CurrentPrincipal.IsInRole("Sales/SalesBill"))
{
MessageBox.Show("You are not authorized to access");
}
else
{
new ProductBI().UpdateShortName();
using (SalesForm frmSale = new SalesForm())
frmSale.ShowDialog();
}
}
private void txt1000_TextChanged(object sender, EventArgs e)
{
try
{
int Amount = 0;
Amount += 1000 * Convert.ToInt16(txt1000.Text);
Amount += 500 * (txt500.Text == "" ? 0 : Convert.ToInt16(txt500.Text));
Amount += 100 * (txt100.Text == "" ? 0 : Convert.ToInt16(txt100.Text));
Amount += 50 * (txt50.Text == "" ? 0 : Convert.ToInt16(txt50.Text));
Amount += 20 * (txt20.Text == "" ? 0 : Convert.ToInt16(txt20.Text));
Amount += 10 * (txt10.Text == "" ? 0 : Convert.ToInt16(txt10.Text));
Amount += 5 * (txt5.Text == "" ? 0 : Convert.ToInt16(txt5.Text));
Amount += 2 * (txt2.Text == "" ? 0 : Convert.ToInt16(txt2.Text));
Amount += 1 * (txt1.Text == "" ? 0 : Convert.ToInt16(txt1.Text));
txtTotal.Text = Amount.ToString();
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("Error Number " + ex.Source + "\n\r" + ex.Message);
}
}
private void advancesToolStripMenuItem_Click(object sender, EventArgs e)
{
RecieveAdvanceForm frmReceivedAdvance = new RecieveAdvanceForm();
frmReceivedAdvance.ShowDialog();
frmReceivedAdvance.Dispose();
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_SALES_BILL))
{
if (roleBI.IsAllowed)
{
using (RecieveAdvanceForm frm = new RecieveAdvanceForm())
frm.ShowDialog();
}
}
}
private void paymentsToolStripMenuItem_Click(object sender, EventArgs e)
{
AdjustAdvanceForm frmAdjustAdvancesForm = new AdjustAdvanceForm();
frmAdjustAdvancesForm.ShowDialog();
frmAdjustAdvancesForm.Dispose();
}
private void paymentsToolStripMenuItem1_Click(object sender, EventArgs e)
{
LogViewerForm frmPayments = new LogViewerForm();
frmPayments.ShowDialog();
frmPayments.Dispose();
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_SALES_BILL))
{
if (roleBI.IsAllowed)
{
using (AdjustAdvanceForm frm = new AdjustAdvanceForm())
frm.ShowDialog();
}
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
@@ -105,15 +47,14 @@ namespace Tanshu.Accounts.PointOfSale
private void createNewUserToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!Thread.CurrentPrincipal.IsInRole("Security/ManageRoles"))
MessageBox.Show("You are not authorized to access");
else
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SECURITY_MANAGE_ROLES))
{
using (SelectUser form = new SelectUser(new UserBI().GetFilteredUsers, true))
{
form.userEvent += new UserEventHandler(form_userEvent);
form.ShowDialog();
}
if (roleBI.IsAllowed)
using (SelectUser form = new SelectUser(new UserBI().GetFilteredUsers, true))
{
form.userEvent += new UserEventHandler(form_userEvent);
form.ShowDialog();
}
}
}
@@ -141,20 +82,18 @@ namespace Tanshu.Accounts.PointOfSale
private void changePasswordToolStripMenuItem_Click(object sender, EventArgs e)
{
ChangePassword frm = new ChangePassword();
frm.ShowDialog();
frm.Dispose();
using (ChangePassword frm = new ChangePassword())
frm.ShowDialog();
}
private void assignRolesToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!Thread.CurrentPrincipal.IsInRole("Security/ManageRoles"))
MessageBox.Show("You are not authorized to access");
else
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SECURITY_MANAGE_ROLES))
{
AssignRoles frm = new AssignRoles();
frm.ShowDialog();
frm.Dispose();
if (roleBI.IsAllowed)
using (AssignRoles frm = new AssignRoles())
frm.ShowDialog();
}
}
@@ -166,34 +105,24 @@ namespace Tanshu.Accounts.PointOfSale
}
}
private void MainForm_Load(object sender, EventArgs e)
{
this.Text = "Main Menu - User: " + CurrentUser.user.Name;
}
private void salesAnalysisToolStripMenuItem1_Click(object sender, EventArgs e)
{
if (!Thread.CurrentPrincipal.IsInRole("Sales/SaleDetail"))
MessageBox.Show("You are not authorized to access");
else
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_SALE_DETAIL))
{
frmSaleAnalysisForm frmSalesAnalysis = new frmSaleAnalysisForm();
frmSalesAnalysis.ShowDialog();
frmSalesAnalysis.Dispose();
if (roleBI.IsAllowed)
using (frmSaleAnalysisForm frm = new frmSaleAnalysisForm())
frm.ShowDialog();
}
}
private void cashierCheckoutToolStripMenuItem1_Click(object sender, EventArgs e)
{
if (!Thread.CurrentPrincipal.IsInRole("Sales/Checkout"))
MessageBox.Show("You are not authorized to access");
else
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_CHECKOUT))
{
Cashier_Checkout_Form frmChashierCheckOut = new Cashier_Checkout_Form();
frmChashierCheckOut.ShowDialog();
frmChashierCheckOut.Dispose();
if (roleBI.IsAllowed)
using (Cashier_Checkout_Form frm = new Cashier_Checkout_Form())
frm.ShowDialog();
}
}
private void customersToolStripMenuItem_Click(object sender, EventArgs e)
@@ -207,15 +136,11 @@ namespace Tanshu.Accounts.PointOfSale
private void productsToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!Thread.CurrentPrincipal.IsInRole("Master/Products"))
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.MASTER_PRODUCTS))
{
MessageBox.Show("You are not authorized to access");
}
else
{
ProductsForm form = new ProductsForm();
form.ShowDialog();
form.Dispose();
if (roleBI.IsAllowed)
using (ProductsForm frm = new ProductsForm())
frm.ShowDialog();
}
}
@@ -226,100 +151,86 @@ namespace Tanshu.Accounts.PointOfSale
ProductType.Dispose();
}
private void toolStripMenuItem1_Click(object sender, EventArgs e)
{
//ProductNewRates ProductRates = new ProductNewRates();
//ProductRates.ShowDialog();
//ProductRates.Dispose();
}
private void applyNewRatesToolStripMenuItem_Click(object sender, EventArgs e)
{
//ApplyRates ApplyRate = new ApplyRates();
//ApplyRate.ShowDialog();
//ApplyRate.Dispose();
}
private void masterToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void complexProductsToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!Thread.CurrentPrincipal.IsInRole("Master/Products"))
{
MessageBox.Show("You are not authorized to access");
}
else
{
//ComplexProductForm form = new ComplexProductForm();
//form.ShowDialog();
//form.Dispose();
}
}
private void viewLogToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!Thread.CurrentPrincipal.IsInRole("Log/View"))
MessageBox.Show("You are not authorized to access");
else
using (LogViewerForm form = new LogViewerForm())
form.ShowDialog();
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.LOG_VIEW))
{
if (roleBI.IsAllowed)
using (LogViewerForm frm = new LogViewerForm())
frm.ShowDialog();
}
}
private void updateToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!Thread.CurrentPrincipal.IsInRole("Master/Products"))
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.MASTER_OWNER))
{
MessageBox.Show("You are not authorized to access");
}
else
{
using (UpdateForm form = new UpdateForm())
{
form.ShowDialog();
}
if (roleBI.IsAllowed)
using (UpdateForm frm = new UpdateForm())
frm.ShowDialog();
}
}
private void reportToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!Thread.CurrentPrincipal.IsInRole("Master/Products"))
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.MASTER_OWNER))
{
MessageBox.Show("You are not authorized to access");
}
else
{
using (SaleTaxReportForm form = new SaleTaxReportForm())
{
form.ShowDialog();
}
if (roleBI.IsAllowed)
using (SaleTaxReportForm frm = new SaleTaxReportForm())
frm.ShowDialog();
}
}
private void updateBillsToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!Thread.CurrentPrincipal.IsInRole("Master/Products"))
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.MASTER_OWNER))
{
MessageBox.Show("You are not authorized to access");
}
else
{
using (UpdateSales form = new UpdateSales())
{
form.ShowDialog();
}
if (roleBI.IsAllowed)
using (UpdateSales frm = new UpdateSales())
frm.ShowDialog();
}
}
private void autoToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!Thread.CurrentPrincipal.IsInRole("Master/Products"))
MessageBox.Show("You are not authorized to access");
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.MASTER_OWNER))
{
if (roleBI.IsAllowed)
using (ReplaceForm frm = new ReplaceForm())
frm.ShowDialog();
}
}
private void btnLogin_Click(object sender, EventArgs e)
{
ILogin login = new KeyboardLogin();
if (!Session.IsAuthenticated)
{
if (login.LoginUser())
{
this.Text = "Main Menu - User: " + Session.User.Name;
btnLogin.Text = "Logout";
}
}
else
using (ReplaceForm form = new ReplaceForm())
form.ShowDialog();
{
login.LogoutUser();
this.Text = "Main Menu - Login";
btnLogin.Text = "Login";
}
}
private void btnSale_Click(object sender, EventArgs e)
{
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_SALES_BILL))
{
if (roleBI.IsAllowed)
{
new ProductBI().UpdateShortName();
using (SalesForm frmSale = new SalesForm())
frmSale.ShowDialog();
}
}
}
}
}
+26 -281
View File
@@ -28,29 +28,6 @@
/// </summary>
private void InitializeComponent()
{
this.CashCalculator = new System.Windows.Forms.GroupBox();
this.txtTotal = new System.Windows.Forms.TextBox();
this.txt1 = new System.Windows.Forms.TextBox();
this.txt2 = new System.Windows.Forms.TextBox();
this.txt5 = new System.Windows.Forms.TextBox();
this.txt10 = new System.Windows.Forms.TextBox();
this.txt20 = new System.Windows.Forms.TextBox();
this.txt50 = new System.Windows.Forms.TextBox();
this.txt100 = new System.Windows.Forms.TextBox();
this.txt500 = new System.Windows.Forms.TextBox();
this.txt1000 = new System.Windows.Forms.TextBox();
this.btnPrint = new System.Windows.Forms.Button();
this.lblTotal = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.masterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.prToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -62,7 +39,6 @@
this.autoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.updateBillsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.transactionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.advancesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.paymentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.paymentsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
@@ -75,228 +51,11 @@
this.salesAnalysisToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.viewLogToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.CashCalculator.SuspendLayout();
this.btnLogin = new System.Windows.Forms.Button();
this.btnSale = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// CashCalculator
//
this.CashCalculator.Controls.Add(this.txtTotal);
this.CashCalculator.Controls.Add(this.txt1);
this.CashCalculator.Controls.Add(this.txt2);
this.CashCalculator.Controls.Add(this.txt5);
this.CashCalculator.Controls.Add(this.txt10);
this.CashCalculator.Controls.Add(this.txt20);
this.CashCalculator.Controls.Add(this.txt50);
this.CashCalculator.Controls.Add(this.txt100);
this.CashCalculator.Controls.Add(this.txt500);
this.CashCalculator.Controls.Add(this.txt1000);
this.CashCalculator.Controls.Add(this.btnPrint);
this.CashCalculator.Controls.Add(this.lblTotal);
this.CashCalculator.Controls.Add(this.label10);
this.CashCalculator.Controls.Add(this.label9);
this.CashCalculator.Controls.Add(this.label8);
this.CashCalculator.Controls.Add(this.label7);
this.CashCalculator.Controls.Add(this.label6);
this.CashCalculator.Controls.Add(this.label5);
this.CashCalculator.Controls.Add(this.label4);
this.CashCalculator.Controls.Add(this.label3);
this.CashCalculator.Controls.Add(this.label2);
this.CashCalculator.Controls.Add(this.label1);
this.CashCalculator.Location = new System.Drawing.Point(13, 33);
this.CashCalculator.Name = "CashCalculator";
this.CashCalculator.Size = new System.Drawing.Size(174, 346);
this.CashCalculator.TabIndex = 25;
this.CashCalculator.TabStop = false;
//
// txtTotal
//
this.txtTotal.Location = new System.Drawing.Point(51, 286);
this.txtTotal.Name = "txtTotal";
this.txtTotal.ReadOnly = true;
this.txtTotal.Size = new System.Drawing.Size(100, 20);
this.txtTotal.TabIndex = 21;
//
// txt1
//
this.txt1.Location = new System.Drawing.Point(51, 256);
this.txt1.Name = "txt1";
this.txt1.Size = new System.Drawing.Size(100, 20);
this.txt1.TabIndex = 20;
this.txt1.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt2
//
this.txt2.Location = new System.Drawing.Point(51, 226);
this.txt2.Name = "txt2";
this.txt2.Size = new System.Drawing.Size(100, 20);
this.txt2.TabIndex = 19;
this.txt2.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt5
//
this.txt5.Location = new System.Drawing.Point(51, 196);
this.txt5.Name = "txt5";
this.txt5.Size = new System.Drawing.Size(100, 20);
this.txt5.TabIndex = 18;
this.txt5.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt10
//
this.txt10.Location = new System.Drawing.Point(51, 166);
this.txt10.Name = "txt10";
this.txt10.Size = new System.Drawing.Size(100, 20);
this.txt10.TabIndex = 17;
this.txt10.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt20
//
this.txt20.Location = new System.Drawing.Point(51, 136);
this.txt20.Name = "txt20";
this.txt20.Size = new System.Drawing.Size(100, 20);
this.txt20.TabIndex = 16;
this.txt20.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt50
//
this.txt50.Location = new System.Drawing.Point(51, 106);
this.txt50.Name = "txt50";
this.txt50.Size = new System.Drawing.Size(100, 20);
this.txt50.TabIndex = 15;
this.txt50.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt100
//
this.txt100.Location = new System.Drawing.Point(51, 76);
this.txt100.Name = "txt100";
this.txt100.Size = new System.Drawing.Size(100, 20);
this.txt100.TabIndex = 14;
this.txt100.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt500
//
this.txt500.Location = new System.Drawing.Point(51, 46);
this.txt500.Name = "txt500";
this.txt500.Size = new System.Drawing.Size(100, 20);
this.txt500.TabIndex = 13;
this.txt500.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// txt1000
//
this.txt1000.Location = new System.Drawing.Point(51, 16);
this.txt1000.Name = "txt1000";
this.txt1000.Size = new System.Drawing.Size(100, 20);
this.txt1000.TabIndex = 12;
this.txt1000.TextChanged += new System.EventHandler(this.txt1000_TextChanged);
//
// btnPrint
//
this.btnPrint.Location = new System.Drawing.Point(51, 317);
this.btnPrint.Name = "btnPrint";
this.btnPrint.Size = new System.Drawing.Size(100, 20);
this.btnPrint.TabIndex = 11;
this.btnPrint.Text = "Print";
this.btnPrint.UseVisualStyleBackColor = true;
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
//
// lblTotal
//
this.lblTotal.AutoSize = true;
this.lblTotal.Location = new System.Drawing.Point(13, 289);
this.lblTotal.Name = "lblTotal";
this.lblTotal.Size = new System.Drawing.Size(31, 13);
this.lblTotal.TabIndex = 10;
this.lblTotal.Text = "Total";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(26, 262);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(18, 13);
this.label10.TabIndex = 9;
this.label10.Text = "1x";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(25, 231);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(18, 13);
this.label9.TabIndex = 8;
this.label9.Text = "2x";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(25, 201);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(18, 13);
this.label8.TabIndex = 7;
this.label8.Text = "5x";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(19, 171);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(24, 13);
this.label7.TabIndex = 6;
this.label7.Text = "10x";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(19, 141);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(24, 13);
this.label6.TabIndex = 5;
this.label6.Text = "20x";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(18, 112);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(24, 13);
this.label5.TabIndex = 4;
this.label5.Text = "50x";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 93);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(0, 13);
this.label4.TabIndex = 3;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(14, 79);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(30, 13);
this.label3.TabIndex = 2;
this.label3.Text = "100x";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(15, 50);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(30, 13);
this.label2.TabIndex = 1;
this.label2.Text = "500x";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 21);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(36, 13);
this.label1.TabIndex = 0;
this.label1.Text = "1000x";
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -325,7 +84,6 @@
this.masterToolStripMenuItem.Name = "masterToolStripMenuItem";
this.masterToolStripMenuItem.Size = new System.Drawing.Size(55, 20);
this.masterToolStripMenuItem.Text = "Master";
this.masterToolStripMenuItem.Click += new System.EventHandler(this.masterToolStripMenuItem_Click);
//
// prToolStripMenuItem
//
@@ -346,7 +104,6 @@
this.complexProductsToolStripMenuItem.Name = "complexProductsToolStripMenuItem";
this.complexProductsToolStripMenuItem.Size = new System.Drawing.Size(171, 22);
this.complexProductsToolStripMenuItem.Text = "Complex Products";
this.complexProductsToolStripMenuItem.Click += new System.EventHandler(this.complexProductsToolStripMenuItem_Click);
//
// customersToolStripMenuItem
//
@@ -386,7 +143,6 @@
// transactionsToolStripMenuItem
//
this.transactionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.saleToolStripMenuItem,
this.advancesToolStripMenuItem,
this.paymentsToolStripMenuItem,
this.paymentsToolStripMenuItem1});
@@ -394,13 +150,6 @@
this.transactionsToolStripMenuItem.Size = new System.Drawing.Size(86, 20);
this.transactionsToolStripMenuItem.Text = "Transactions";
//
// saleToolStripMenuItem
//
this.saleToolStripMenuItem.Name = "saleToolStripMenuItem";
this.saleToolStripMenuItem.Size = new System.Drawing.Size(170, 22);
this.saleToolStripMenuItem.Text = "Sale";
this.saleToolStripMenuItem.Click += new System.EventHandler(this.saleToolStripMenuItem_Click);
//
// advancesToolStripMenuItem
//
this.advancesToolStripMenuItem.Name = "advancesToolStripMenuItem";
@@ -491,21 +240,39 @@
this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// btnLogin
//
this.btnLogin.Location = new System.Drawing.Point(12, 27);
this.btnLogin.Name = "btnLogin";
this.btnLogin.Size = new System.Drawing.Size(170, 85);
this.btnLogin.TabIndex = 27;
this.btnLogin.Text = "&Login";
this.btnLogin.UseVisualStyleBackColor = true;
this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
//
// btnSale
//
this.btnSale.Location = new System.Drawing.Point(188, 27);
this.btnSale.Name = "btnSale";
this.btnSale.Size = new System.Drawing.Size(170, 85);
this.btnSale.TabIndex = 28;
this.btnSale.Text = "&Sale";
this.btnSale.UseVisualStyleBackColor = true;
this.btnSale.Click += new System.EventHandler(this.btnSale_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(792, 537);
this.Controls.Add(this.CashCalculator);
this.Controls.Add(this.btnSale);
this.Controls.Add(this.btnLogin);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "MainForm";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.MainForm_Load);
this.CashCalculator.ResumeLayout(false);
this.CashCalculator.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
@@ -515,35 +282,11 @@
#endregion
private System.Windows.Forms.GroupBox CashCalculator;
private System.Windows.Forms.Label lblTotal;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtTotal;
private System.Windows.Forms.TextBox txt1;
private System.Windows.Forms.TextBox txt2;
private System.Windows.Forms.TextBox txt5;
private System.Windows.Forms.TextBox txt10;
private System.Windows.Forms.TextBox txt20;
private System.Windows.Forms.TextBox txt50;
private System.Windows.Forms.TextBox txt100;
private System.Windows.Forms.TextBox txt500;
private System.Windows.Forms.TextBox txt1000;
private System.Windows.Forms.Button btnPrint;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem masterToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem transactionsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem permissionsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saleToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem advancesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem paymentsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem createNewUserToolStripMenuItem;
@@ -562,5 +305,7 @@
private System.Windows.Forms.ToolStripMenuItem autoToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem viewLogToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem updateBillsToolStripMenuItem;
private System.Windows.Forms.Button btnLogin;
private System.Windows.Forms.Button btnSale;
}
}
+1 -1
View File
@@ -139,7 +139,7 @@ namespace Tanshu.Accounts.PointOfSale
private bool Save(bool addNew)
{
#region Setup Products
UserBO user = CurrentUser.user;
UserBO user = Session.User;
ProductBO product = new ProductBO();
if (!addNew)
product = new ProductBI().GetProduct(productList.ElementAt(bsProducts.Position).ProductID);
+3 -31
View File
@@ -18,37 +18,9 @@ namespace Tanshu.Accounts.PointOfSale
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
string userName;
bool isAuthenticated;
using (LoginForm login = new LoginForm())
{
login.ShowDialog();
isAuthenticated = login.UserName(out userName);
}
if (isAuthenticated)
{
SetThreadPrincipal(userName);
Application.Run(new MainForm());
log.Warn(string.Format("User Logout: {0}", CurrentUser.user.Name));
}
else
{
log.Warn(string.Format("User Login Failed: '{0}'", userName));
}
}
static void SetThreadPrincipal(string userName)
{
log.Warn(string.Format("User Login: '{0}'", userName));
if (userName.Contains(":"))
userName = userName.Substring(userName.IndexOf(":") + 1);
AccountsPrincipal principal = AccountsPrincipal.CreateAccountsPrincipal(new Tanshu.Accounts.BI.MembershipBI().GetRolesForUser(userName),
new MembershipBI().GetUserFromName(userName));
// bind the generic principal to the thread
Thread.CurrentPrincipal = principal;
log.Warn("Application Started");
Application.Run(new MainForm());
log.Warn("Application Closed");
}
}
}
@@ -52,7 +52,7 @@ namespace Tanshu.Accounts.PointOfSale
private void btnAdjust_Click(object sender, EventArgs e)
{
new AdvanceBI().Adjust((Guid)txtNarration.Tag, CurrentUser.user.UserID);
new AdvanceBI().Adjust((Guid)txtNarration.Tag, Session.User.UserID);
FillDataGrid();
}
}
@@ -36,7 +36,7 @@ namespace Tanshu.Accounts.PointOfSale
private void cmbCashier_SelectedIndexChanged(object sender, EventArgs e)
{
EmployeeStatus();
log.Warn(string.Format("User Checkout: {0} by {1}", coProxy.Cashier, CurrentUser.user.Name));
log.Warn(string.Format("User Checkout: {0} by {1}", coProxy.Cashier, Session.User.Name));
}
private void EmployeeStatus()
@@ -83,7 +83,7 @@ namespace Tanshu.Accounts.PointOfSale
private void btnPrint_Click(object sender, EventArgs e)
{
Thermal.PrintClosing(coProxy);
Thermal.PrintClosing(Session.printer(), coProxy);
}
private void txtSales_TextChanged(object sender, EventArgs e)
@@ -84,7 +84,7 @@ namespace Tanshu.Accounts.PointOfSale
{
if (customer == null)
customer = new CustomerBO();
UserBO user = CurrentUser.user;
UserBO user = Session.User;
customer.Name = txtName.Text;
customer.LedgerID = (Guid)cmbLedger.SelectedValue;
customer.Phone = txtPhone.Text;
@@ -17,7 +17,7 @@ namespace Tanshu.Accounts.PointOfSale
}
private void btnAdd_Click(object sender, EventArgs e)
{
UserBO user = CurrentUser.user;
UserBO user = Session.User;
if (txtAmount.Text == "0" || cmbType.Text == "")
{
System.Windows.Forms.MessageBox.Show("Amount can't be blank", "Blank not Allowed");
@@ -37,7 +37,7 @@ namespace Tanshu.Accounts.PointOfSale
private void PaymentForm_Load(object sender, EventArgs e)
{
UserBO user = CurrentUser.user;
UserBO user = Session.User;
dtpFrom.Value = DateTime.Today;
dtpTo.Value = DateTime.Today;
GridBind();
@@ -50,7 +50,7 @@ namespace Tanshu.Accounts.PointOfSale
MessageBox.Show("You are not authorized to access");
else
{
UserBO user = CurrentUser.user;
UserBO user = Session.User;
if (dgvPayments.SelectedRows.Count <= 0)
return;
Guid paymentID = ((PaymentDisplayBO)bindingSource.Current).PaymentID;
@@ -65,7 +65,7 @@ namespace Tanshu.Accounts.PointOfSale
userID = null;
else
{
userID = CurrentUser.user.UserID;
userID = Session.User.UserID;
}
paymentList = new PaymentBI().GetPayments(userID, dtpFrom.Value, dtpTo.Value);
bindingSource.DataSource = paymentList;
@@ -39,8 +39,8 @@ namespace Tanshu.Accounts.PointOfSale
dtpTo.Format = DateTimePickerFormat.Custom;
dtpTo.CustomFormat = "dd-MMM-yyyy";
dtpTo.Value = DateTime.Now;
txtCashier.Text = CurrentUser.user.Name;
txtCashier.Tag = CurrentUser.user.UserID;
txtCashier.Text = Session.User.Name;
txtCashier.Tag = Session.User.UserID;
loading = false;
GridBind();
}
@@ -58,7 +58,7 @@ namespace Tanshu.Accounts.PointOfSale
}
private void PrintAdvances()
{
Thermal.PrintAdvance(txtAmount.Text.Trim(), txtNarration.Text.Trim());
Thermal.PrintAdvance(Session.printer(), Session.User.Name, txtAmount.Text.Trim(), txtNarration.Text.Trim());
}
private string AddDate(string SqlStringP, DateTime FromDate, DateTime ToDate)
{
@@ -15,7 +15,7 @@ namespace Tanshu.Accounts.PointOfSale
public frmSaleAnalysisForm()
{
InitializeComponent();
log.Warn(string.Format("Sales Analysis by: {0}", CurrentUser.user.Name));
log.Warn(string.Format("Sales Analysis by: {0}", Session.User.Name));
}
private void dtpStart_ValueChanged(object sender, EventArgs e)
@@ -91,7 +91,7 @@ namespace Tanshu.Accounts.PointOfSale
{
DateTime startDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 00:00:00", dtpStart.Value));
DateTime finishDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 23:59:59", dtpFinish.Value));
Accounts.Print.Thermal.PrintSale(det, startDate, finishDate);
Accounts.Print.Thermal.PrintSale(Session.printer(), Session.User.Name, det, startDate, finishDate);
}
}
}
+7 -7
View File
@@ -29,8 +29,8 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
this.bindingSource = new System.Windows.Forms.BindingSource(this.components);
this.bsWaiter = new System.Windows.Forms.BindingSource(this.components);
this.bsPending = new System.Windows.Forms.BindingSource(this.components);
@@ -270,8 +270,8 @@
// printedDataGridViewTextBoxColumn
//
this.printedDataGridViewTextBoxColumn.DataPropertyName = "Printed";
dataGridViewCellStyle1.Format = "N2";
this.printedDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle3.Format = "N2";
this.printedDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle3;
this.printedDataGridViewTextBoxColumn.HeaderText = "Printed";
this.printedDataGridViewTextBoxColumn.Name = "printedDataGridViewTextBoxColumn";
this.printedDataGridViewTextBoxColumn.ReadOnly = true;
@@ -280,9 +280,9 @@
// additionalDataGridViewTextBoxColumn
//
this.additionalDataGridViewTextBoxColumn.DataPropertyName = "Additional";
dataGridViewCellStyle2.Format = "N2";
dataGridViewCellStyle2.NullValue = null;
this.additionalDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle4.Format = "N2";
dataGridViewCellStyle4.NullValue = null;
this.additionalDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle4;
this.additionalDataGridViewTextBoxColumn.HeaderText = "Additional";
this.additionalDataGridViewTextBoxColumn.Name = "additionalDataGridViewTextBoxColumn";
this.additionalDataGridViewTextBoxColumn.ReadOnly = true;
@@ -33,7 +33,7 @@ namespace Tanshu.Accounts.PointOfSale
{
InitializeComponent();
btnCustomer.Text = customer.Name;
lblUser.Text = CurrentUser.user.Name;
lblUser.Text = Session.User.Name;
}
public SalesForm(Guid voucherID)
@@ -369,7 +369,7 @@ namespace Tanshu.Accounts.PointOfSale
}
else
{
Accounts.Print.Thermal.PrintBill(true, voucherID, bill.Values.ToList());
Accounts.Print.Thermal.PrintBill(Session.printer(), true, voucherID, bill.Values.ToList());
Accounts.Print.Thermal.PrintCustomerKot("KOT", voucherID, bill.Values.ToList());
}
}
@@ -386,7 +386,7 @@ namespace Tanshu.Accounts.PointOfSale
btnWaiter.Tag = new WaiterBI().GetWaiters()[0].WaiterID;
#region SaleVoucher
UserBO user = CurrentUser.user;
UserBO user = Session.User;
SaleVoucherBO saleVoucher = new SaleVoucherBO
{
CustomerID = customer.CustomerID,
@@ -416,7 +416,7 @@ namespace Tanshu.Accounts.PointOfSale
if (btnWaiter.Tag == null)
btnWaiter.Tag = new WaiterBI().GetWaiters()[0].WaiterID;
UserBO user = CurrentUser.user;
UserBO user = Session.User;
#region Voucher and SaleVoucher
SaleVoucherBO saleVoucher = new SaleVoucherBO
{
@@ -572,11 +572,11 @@ namespace Tanshu.Accounts.PointOfSale
if (seconds <= 0)
lblUser.Text = string.Format("Alarm {0:hh:MM}", al.AlarmTime);
else
lblUser.Text = CurrentUser.user.Name;
lblUser.Text = Session.User.Name;
}
else
{
lblUser.Text = CurrentUser.user.Name;
lblUser.Text = Session.User.Name;
}
}
}
@@ -759,14 +759,14 @@ namespace Tanshu.Accounts.PointOfSale
private void btnPaidCash_Click(object sender, EventArgs e)
{
UserBO user = CurrentUser.user;
UserBO user = Session.User;
new SaleVoucherBI().DeclareBillsPaid(user.UserID, selectedBills, false);
ListUnpaidBills();
}
private void btnPaidCC_Click(object sender, EventArgs e)
{
UserBO user = CurrentUser.user;
UserBO user = Session.User;
new SaleVoucherBI().DeclareBillsPaid(user.UserID, selectedBills, true);
ListUnpaidBills();
}
@@ -132,6 +132,15 @@
<metadata name="Display.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Display.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="selectDataGridViewCheckBoxColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TableID.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="selectDataGridViewCheckBoxColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -83,6 +83,15 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Authentication\Session.cs" />
<Compile Include="Authentication\KeyboardLogin.cs" />
<Compile Include="Authentication\ILogin.cs" />
<Compile Include="CurrencyCounter.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CurrencyCounter.Designer.cs">
<DependentUpon>CurrencyCounter.cs</DependentUpon>
</Compile>
<Compile Include="Sales\BillHelperFunctions.cs" />
<Compile Include="Sales\PaymentForm.cs">
<SubType>Form</SubType>
@@ -145,10 +154,10 @@
<Compile Include="Sales\CustomersForm.Designer.cs">
<DependentUpon>CustomersForm.cs</DependentUpon>
</Compile>
<Compile Include="LoginForm.cs">
<Compile Include="Authentication\LoginForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LoginForm.Designer.cs">
<Compile Include="Authentication\LoginForm.Designer.cs">
<DependentUpon>LoginForm.cs</DependentUpon>
</Compile>
<Compile Include="MainForm.cs">
@@ -184,6 +193,9 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="CurrencyCounter.resx">
<DependentUpon>CurrencyCounter.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Sales\PaymentForm.resx">
<DependentUpon>PaymentForm.cs</DependentUpon>
<SubType>Designer</SubType>
@@ -224,7 +236,7 @@
<DependentUpon>CustomersForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="LoginForm.resx">
<EmbeddedResource Include="Authentication\LoginForm.resx">
<DependentUpon>LoginForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
@@ -322,6 +334,10 @@
<Project>{90C9D02C-91AF-4529-86BE-28320332DDB5}</Project>
<Name>Tanshu.Accounts.Print</Name>
</ProjectReference>
<ProjectReference Include="..\Tanshu.Common.KeyboardControl\Tanshu.Common.KeyboardControl.csproj">
<Project>{4847FEE9-90E1-4795-A644-32867887A653}</Project>
<Name>Tanshu.Common.KeyboardControl</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.
@@ -20,7 +20,7 @@ namespace Tanshu.Accounts.PointOfSale
private void btnGo_Click(object sender, EventArgs e)
{
if (!Thread.CurrentPrincipal.IsInRole("Security/CreateUser"))
if (!Thread.CurrentPrincipal.IsInRole("Master/Owner"))
return;
dtpFrom.Value = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 00:00:00", dtpFrom.Value));
dtpTo.Value = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 23:59:59", dtpTo.Value));
@@ -71,7 +71,7 @@ namespace Tanshu.Accounts.PointOfSale
{
DateTime startDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 00:00:00", dtpStart.Value));
DateTime finishDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 23:59:59", dtpFinish.Value));
Tanshu.Accounts.Print.Thermal.PrintSale(det, startDate, finishDate);
Tanshu.Accounts.Print.Thermal.PrintSale(Session.printer(), Session.User.Name, det, startDate, finishDate);
}
}
}
@@ -110,11 +110,11 @@ namespace Tanshu.Accounts.PointOfSale
private void AssignRoles_FormClosing(object sender, FormClosingEventArgs e)
{
string userName = Thread.CurrentPrincipal.Identity.Name;
AccountsPrincipal principal = AccountsPrincipal.CreateAccountsPrincipal(new MembershipBI().GetRolesForUser(userName), new MembershipBI().GetUserFromName(userName));
//string userName = Thread.CurrentPrincipal.Identity.Name;
//AccountsPrincipal principal = AccountsPrincipal.CreateAccountsPrincipal(new MembershipBI().GetRolesForUser(userName), new MembershipBI().GetUserFromName(userName));
// bind the generic principal to the thread
Thread.CurrentPrincipal = principal;
//// bind the generic principal to the thread
//Thread.CurrentPrincipal = principal;
}
}
}
@@ -15,7 +15,7 @@ namespace Tanshu.Accounts.PointOfSale
private void ChangePassword_Load(object sender, EventArgs e)
{
txtUsername.Text = CurrentUser.user.Name;
txtUsername.Text = Session.User.Name;
}
private void button2_Click(object sender, EventArgs e)
@@ -13,16 +13,26 @@ namespace Tanshu.Accounts.PointOfSale
{ }
public static RoleBI GetRoleBI(string roleID)
{
RoleBI roleBI = new RoleBI(roleID, CurrentUser.user.UserID);
if (!roleBI.IsAllowed)
{
using (LoginForm frm = new LoginForm())
{
frm.ShowDialog();
roleBI.Evelvate(frm.UserName);
}
}
RoleBI roleBI;
if (Session.User != null)
roleBI = new RoleBI(roleID, Session.User.UserID);
else
roleBI = new RoleBI(roleID, new Guid());
return roleBI;
//bool repeat = true;
//while (!roleBI.IsAllowed && repeat)
//{
// using (LoginForm frm = new LoginForm())
// {
// frm.ShowDialog();
// string userName;
// if (frm.Cancelled)
// repeat = false;
// else if (frm.UserName(out userName))
// roleBI.Evelvate(frm.UserName);
// }
//}
//return roleBI;
}
}
}
+25 -26
View File
@@ -136,11 +136,11 @@ namespace Tanshu.Accounts.Print
CustomerBO customer = new CustomerBI().GetCustomer(trans.CustomerID);
String billNo = trans.BillID.Substring(trans.BillID.IndexOf("-") + 1);
String BillText = "";
BillText = "\n\r" + FormatText("Bengali Sweet House", 42, false, Align.Centre);
BillText += "\n\r" + FormatText("+ V2C Multi Cuisine", 42, false, Align.Centre);
BillText += "\n\r" + FormatText("SCO 1, Pocket 1, Manimajra, Chandigarh", 42, false, Align.Centre);
BillText = "\n\r" + FormatText("V2C Multi Cuisine Restaurant", 42, false, Align.Centre);
BillText += "\n\r" + FormatText(" + Bengali Sweets", 42, false, Align.Centre);
BillText += "\n\r" + FormatText("SCO 399, Sector 20, Panchkula", 42, false, Align.Centre);
BillText += "\n\r" + FormatText("A Unit of AA Herbal Biotech Pvt. Ltd.", 42, false, Align.Centre);
BillText += "\n\r" + FormatText("TIN: 04400023630", 42, false, Align.Centre);
BillText += "\n\r" + FormatText("TIN: 06892504733", 42, false, Align.Centre);
BillText += "\n\r" + FormatText("Retail Invoice", 42, false, Align.Centre);
BillText += "\n\r";
BillText += "\n\r" + "Bill No: " + FormatText(billNo, 13, false, Align.Centre) + string.Format("{0:dd-MMM-yyyy HH:mm:ss}", trans.Date);
@@ -168,7 +168,7 @@ namespace Tanshu.Accounts.Print
BillText += "\n\r" + "------------------------------------------";
if (billItems.Sum(b => b.TaxAmount) != 0)
{
BillText += "\n\r" + FormatText("VAT : ", 33, false, Align.Right) + FormatBillNum(billItems.Sum(b => b.TaxAmount), 9);
BillText += "\n\r" + FormatText("VAT (incl. surcharge) : ", 33, false, Align.Right) + FormatBillNum(billItems.Sum(b => b.TaxAmount), 9);
}
if (billItems.Sum(b => b.DiscountAmount) != 0)
{
@@ -230,12 +230,11 @@ namespace Tanshu.Accounts.Print
return string.Format("{0," + Length.ToString() + "}", Temp);
}
private static bool PrintRAW(string Text, string DocumentName)
private static bool PrintRAW(string printer, string Text, string DocumentName)
{
string printerName = System.Configuration.ConfigurationManager.AppSettings["Printer"].ToString().Trim();
try
{
if (!RawPrinterHelper.PrintString(printerName, DocumentName, Text, new char[] { ';' }))
if (!RawPrinterHelper.PrintString(printer, DocumentName, Text, new char[] { ';' }))
{
GC.Collect();
System.Windows.Forms.MessageBox.Show("Error in PrintRAW Function. Please Report immediately");
@@ -249,13 +248,13 @@ namespace Tanshu.Accounts.Print
}
#region Print Cash Total
public static Boolean PrintCash(Dictionary<int, int> amount)
public static Boolean PrintCash(string printer, Dictionary<int, int> amount, string user)
{
string printText;
int total = 0;
try
{
printText = FormatText(CurrentUser.user.Name, 42, false, Align.Centre);
printText = FormatText(user, 42, false, Align.Centre);
printText += DrawLine;
printText += "\n\r" + FormatText(string.Format("{0:dd-MMM-yyyy HH:mm:ss}", DateTime.Now), 42, false, Align.Centre);
foreach (int key in amount.Keys.OrderByDescending(k => k))
@@ -267,7 +266,7 @@ namespace Tanshu.Accounts.Print
printText += string.Format("\n\r Total = {0,10:#,##0}", total);
printText += DrawLine;
printText += CutPrinter;
return PrintRAW(printText, "Closing/Opening for " + CurrentUser.user.Name);
return PrintRAW(printer,printText, "Closing/Opening for " + user);
}
catch (Exception ex)
{
@@ -275,12 +274,12 @@ namespace Tanshu.Accounts.Print
}
}
public static Boolean PrintSale(List<SalesAnalysisBO> det, DateTime startDate, DateTime endDate)
public static Boolean PrintSale(string printer, string user, List<SalesAnalysisBO> det, DateTime startDate, DateTime endDate)
{
string printText;
try
{
printText = FormatText(CurrentUser.user.Name, 42, false, Align.Centre);
printText = FormatText(user, 42, false, Align.Centre);
printText += DrawLine;
printText += "\n\r" + FormatText(string.Format("{0:dd-MMM-yyyy HH:mm:ss}", DateTime.Now), 42, false, Align.Centre);
printText += "\n\r" + FormatText(string.Format("{0:dd-MMM-yyyy} to {1:dd-MMM-yyyy}", startDate, endDate), 42, false, Align.Centre);
@@ -294,7 +293,7 @@ namespace Tanshu.Accounts.Print
}
printText += DrawEqual;
printText += CutPrinter;
return PrintRAW(printText, "Sale Detail " + CurrentUser.user.Name);
return PrintRAW(printer, printText, "Sale Detail " + user);
}
catch (Exception ex)
{
@@ -312,7 +311,7 @@ namespace Tanshu.Accounts.Print
}
#endregion
public static Boolean PrintAdvance(string Advance, string Narration)
public static Boolean PrintAdvance(string printer, string user, string Advance, string Narration)
{
String BillText;
try
@@ -327,7 +326,7 @@ namespace Tanshu.Accounts.Print
BillText += DrawLine;
if (Narration != "") BillText += "\n\r" + FormatText(Narration, 42, false, Align.Centre);
BillText += DrawLine;
BillText += "\n\r" + FormatText("Thanking you " + CurrentUser.user.Name, 42, false, Align.Left);
BillText += "\n\r" + FormatText("Thanking you " + user, 42, false, Align.Left);
BillText += "\n\r";
BillText += "\n\r";
BillText += "\n\r";
@@ -337,7 +336,7 @@ namespace Tanshu.Accounts.Print
BillText += "\n\r";
BillText += CutPrinter;
BillText += "\n\r" + BillText;
return PrintRAW(BillText, "Closing/Opening for " + CurrentUser.user.Name);
return PrintRAW(printer, BillText, "Closing/Opening for " + user);
}
catch (Exception ex)
{
@@ -346,7 +345,7 @@ namespace Tanshu.Accounts.Print
}
public static Boolean PrintClosing(CheckoutBI details)
public static Boolean PrintClosing(string printer, CheckoutBI details)
{
string BillText;
try
@@ -390,7 +389,7 @@ namespace Tanshu.Accounts.Print
if (details.DiscountString.Length > 0)
BillText += details.DiscountString;
BillText += CutPrinter;
return PrintRAW(BillText, "Closing");
return PrintRAW(printer, BillText, "Closing");
}
catch (Exception ex)
{
@@ -405,33 +404,33 @@ namespace Tanshu.Accounts.Print
return FormatText(InputString, 24, false, Align.Right);
}
public static void PrintBill(bool bill, Guid voucherID, List<SalesBillItemBO> list)
public static void PrintBill(string printer, bool bill, Guid voucherID, List<SalesBillItemBO> list)
{
SaleVoucherBO trans = new SaleVoucherBO();
List<InventoryDisplayBO> iList = new List<InventoryDisplayBO>();
new SaleVoucherBI().GetSaleVoucher(voucherID, ref trans, ref iList);
PrintRAW(DesignBill(trans, list), "Bill");
PrintRAW(printer, DesignBill(trans, list), "Bill");
}
public static void PrintWaiterKot(string p, Guid voucherID, List<SalesBillItemBO> list)
public static void PrintWaiterKot(string printer, Guid voucherID, List<SalesBillItemBO> list)
{
SaleVoucherBO trans = new SaleVoucherBO();
List<InventoryDisplayBO> iList = new List<InventoryDisplayBO>();
new SaleVoucherBI().GetSaleVoucher(voucherID, ref trans, ref iList);
if (list.Count(i => (i.Quantity - i.Printed) > 0) > 0)
{
PrintRAW(DesignWaiterKot(trans, list), "KOT");
PrintRAW(DesignPickupKot(trans, list), "KOT");
PrintRAW(printer, DesignWaiterKot(trans, list), "KOT");
PrintRAW(printer, DesignPickupKot(trans, list), "KOT");
}
}
public static void PrintCustomerKot(string p, Guid voucherID, List<SalesBillItemBO> list)
public static void PrintCustomerKot(string printer, Guid voucherID, List<SalesBillItemBO> list)
{
SaleVoucherBO trans = new SaleVoucherBO();
List<InventoryDisplayBO> iList = new List<InventoryDisplayBO>();
new SaleVoucherBI().GetSaleVoucher(voucherID, ref trans, ref iList);
if (list.Count(i => (i.Quantity - i.Printed) > 0) > 0)
{
PrintRAW(DesignCustomerKot(trans, list), "KOT");
PrintRAW(printer, DesignCustomerKot(trans, list), "KOT");
}
}
+4 -1
View File
@@ -42,7 +42,6 @@ WHERE t.Type = 'S' AND t.Date BETWEEN @StartDate AND @FinishDate AND s.Void = 0
if (tax.HasValue) cmd.Parameters.AddWithValue("@Tax", tax);
return (decimal)connection.ExecuteScalar(cmd);
}
}
public List<Guid> GetUpdateBillList(decimal tax, bool voided, bool paid, bool creditCard)
{
@@ -273,6 +272,10 @@ DELETE FROM {0}.dbo.SaleVoucher WHERE VoucherID IN (
SELECT v.VoucherID FROM {0}.dbo.SaleVoucher s INNER JOIN {0}.dbo.Vouchers v ON s.VoucherID = v.VoucherID
WHERE v.Date BETWEEN @StartDate AND @EndDate)
DELETE FROM {0}.dbo.Inventory WHERE VoucherID NOT IN (SELECT VoucherID FROM {0}.dbo.SaleVoucher)
DELETE FROM {0}.dbo.SaleVoucher WHERE VoucherID NOT IN (SELECT VoucherID FROM {0}.dbo.Vouchers)
DELETE FROM {0}.dbo.Vouchers WHERE VoucherID NOT IN (SELECT VoucherID FROM {0}.dbo.SaleVoucher)
AND Type = 'S'
";
+1 -1
View File
@@ -141,7 +141,7 @@ namespace Tanshu.Accounts.SqlDAO
public bool RoleExists(string roleID)
{
using (SqlCommand cmd = new SqlCommand("IF EXISTS(SELECT * FROM Roles WHERE Role = @RoleID) SELECT CAST(1 AS bit) ELSE SELECT CAST(0 AS bit)"))
using (SqlCommand cmd = new SqlCommand("IF EXISTS(SELECT * FROM Roles WHERE RoleID = @RoleID) SELECT CAST(1 AS bit) ELSE SELECT CAST(0 AS bit)"))
{
cmd.Parameters.AddWithValue("@RoleID", roleID);
return (bool)connection.ExecuteScalar(cmd);
+6
View File
@@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tanshu.Accounts.SqlDAO", "T
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tanshu.Accounts.DAOFactory", "Tanshu.Accounts.DAOFactory\Tanshu.Accounts.DAOFactory.csproj", "{AC7AA7C5-4712-4992-B733-092D703E7AA9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tanshu.Common.KeyboardControl", "Tanshu.Common.KeyboardControl\Tanshu.Common.KeyboardControl.csproj", "{4847FEE9-90E1-4795-A644-32867887A653}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -49,6 +51,10 @@ Global
{AC7AA7C5-4712-4992-B733-092D703E7AA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC7AA7C5-4712-4992-B733-092D703E7AA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC7AA7C5-4712-4992-B733-092D703E7AA9}.Release|Any CPU.Build.0 = Release|Any CPU
{4847FEE9-90E1-4795-A644-32867887A653}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4847FEE9-90E1-4795-A644-32867887A653}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4847FEE9-90E1-4795-A644-32867887A653}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4847FEE9-90E1-4795-A644-32867887A653}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+242
View File
@@ -0,0 +1,242 @@
namespace Tanshu.Common.KeyboardControl
{
partial class NumpadControl
{
/// <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 Component 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.btn7 = new UnselectableButton();
this.btn5 = new UnselectableButton();
this.btn4 = new UnselectableButton();
this.btn6 = new UnselectableButton();
this.btn2 = new UnselectableButton();
this.btn1 = new UnselectableButton();
this.btn3 = new UnselectableButton();
this.btn0 = new UnselectableButton();
this.btnOk = new UnselectableButton();
this.btnDot = new UnselectableButton();
this.btnDel = new UnselectableButton();
this.btn8 = new UnselectableButton();
this.btn9 = new UnselectableButton();
this.btnEsc = new UnselectableButton();
this.SuspendLayout();
//
// btn7
//
this.btn7.Location = new System.Drawing.Point(3, 3);
this.btn7.Name = "btn7";
this.btn7.Size = new System.Drawing.Size(50, 50);
this.btn7.TabIndex = 0;
this.btn7.TabStop = false;
this.btn7.Text = "7";
this.btn7.UseVisualStyleBackColor = true;
this.btn7.Click += new System.EventHandler(this.btn7_Click);
//
// btn5
//
this.btn5.Location = new System.Drawing.Point(59, 59);
this.btn5.Name = "btn5";
this.btn5.Size = new System.Drawing.Size(50, 50);
this.btn5.TabIndex = 1;
this.btn5.TabStop = false;
this.btn5.Text = "5";
this.btn5.UseVisualStyleBackColor = true;
this.btn5.Click += new System.EventHandler(this.btn5_Click);
//
// btn4
//
this.btn4.Location = new System.Drawing.Point(3, 59);
this.btn4.Name = "btn4";
this.btn4.Size = new System.Drawing.Size(50, 50);
this.btn4.TabIndex = 2;
this.btn4.TabStop = false;
this.btn4.Text = "4";
this.btn4.UseVisualStyleBackColor = true;
this.btn4.Click += new System.EventHandler(this.btn4_Click);
//
// btn6
//
this.btn6.Location = new System.Drawing.Point(115, 59);
this.btn6.Name = "btn6";
this.btn6.Size = new System.Drawing.Size(50, 50);
this.btn6.TabIndex = 3;
this.btn6.TabStop = false;
this.btn6.Text = "6";
this.btn6.UseVisualStyleBackColor = true;
this.btn6.Click += new System.EventHandler(this.btn6_Click);
//
// btn2
//
this.btn2.Location = new System.Drawing.Point(59, 115);
this.btn2.Name = "btn2";
this.btn2.Size = new System.Drawing.Size(50, 50);
this.btn2.TabIndex = 4;
this.btn2.TabStop = false;
this.btn2.Text = "2";
this.btn2.UseVisualStyleBackColor = true;
this.btn2.Click += new System.EventHandler(this.btn2_Click);
//
// btn1
//
this.btn1.Location = new System.Drawing.Point(3, 115);
this.btn1.Name = "btn1";
this.btn1.Size = new System.Drawing.Size(50, 50);
this.btn1.TabIndex = 5;
this.btn1.TabStop = false;
this.btn1.Text = "1";
this.btn1.UseVisualStyleBackColor = true;
this.btn1.Click += new System.EventHandler(this.btn1_Click);
//
// btn3
//
this.btn3.Location = new System.Drawing.Point(115, 115);
this.btn3.Name = "btn3";
this.btn3.Size = new System.Drawing.Size(50, 50);
this.btn3.TabIndex = 6;
this.btn3.TabStop = false;
this.btn3.Text = "3";
this.btn3.UseVisualStyleBackColor = true;
this.btn3.Click += new System.EventHandler(this.btn3_Click);
//
// btn0
//
this.btn0.Location = new System.Drawing.Point(3, 171);
this.btn0.Name = "btn0";
this.btn0.Size = new System.Drawing.Size(106, 50);
this.btn0.TabIndex = 7;
this.btn0.TabStop = false;
this.btn0.Text = "0";
this.btn0.UseVisualStyleBackColor = true;
this.btn0.Click += new System.EventHandler(this.btn0_Click);
//
// btnOk
//
this.btnOk.Location = new System.Drawing.Point(171, 115);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(50, 106);
this.btnOk.TabIndex = 8;
this.btnOk.TabStop = false;
this.btnOk.Text = "OK";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// btnDot
//
this.btnDot.Location = new System.Drawing.Point(115, 171);
this.btnDot.Name = "btnDot";
this.btnDot.Size = new System.Drawing.Size(50, 50);
this.btnDot.TabIndex = 9;
this.btnDot.TabStop = false;
this.btnDot.Text = ".";
this.btnDot.UseVisualStyleBackColor = true;
this.btnDot.Click += new System.EventHandler(this.btnDot_Click);
//
// btnDel
//
this.btnDel.Location = new System.Drawing.Point(171, 59);
this.btnDel.Name = "btnDel";
this.btnDel.Size = new System.Drawing.Size(50, 50);
this.btnDel.TabIndex = 10;
this.btnDel.TabStop = false;
this.btnDel.Text = "Del";
this.btnDel.UseVisualStyleBackColor = true;
this.btnDel.Click += new System.EventHandler(this.btnDel_Click);
//
// btn8
//
this.btn8.Location = new System.Drawing.Point(59, 3);
this.btn8.Name = "btn8";
this.btn8.Size = new System.Drawing.Size(50, 50);
this.btn8.TabIndex = 11;
this.btn8.TabStop = false;
this.btn8.Text = "8";
this.btn8.UseVisualStyleBackColor = true;
this.btn8.Click += new System.EventHandler(this.btn8_Click);
//
// btn9
//
this.btn9.Location = new System.Drawing.Point(115, 3);
this.btn9.Name = "btn9";
this.btn9.Size = new System.Drawing.Size(50, 50);
this.btn9.TabIndex = 12;
this.btn9.TabStop = false;
this.btn9.Text = "9";
this.btn9.UseVisualStyleBackColor = true;
this.btn9.Click += new System.EventHandler(this.btn9_Click);
//
// btnEsc
//
this.btnEsc.Location = new System.Drawing.Point(171, 3);
this.btnEsc.Name = "btnEsc";
this.btnEsc.Size = new System.Drawing.Size(50, 50);
this.btnEsc.TabIndex = 13;
this.btnEsc.TabStop = false;
this.btnEsc.Text = "Esc";
this.btnEsc.UseVisualStyleBackColor = true;
this.btnEsc.Click += new System.EventHandler(this.btnEsc_Click);
//
// NumpadControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.btnEsc);
this.Controls.Add(this.btn9);
this.Controls.Add(this.btn8);
this.Controls.Add(this.btnDel);
this.Controls.Add(this.btnDot);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.btn0);
this.Controls.Add(this.btn3);
this.Controls.Add(this.btn1);
this.Controls.Add(this.btn2);
this.Controls.Add(this.btn6);
this.Controls.Add(this.btn4);
this.Controls.Add(this.btn5);
this.Controls.Add(this.btn7);
this.Name = "NumpadControl";
this.Size = new System.Drawing.Size(224, 224);
this.ResumeLayout(false);
}
#endregion
private UnselectableButton btn7;
private UnselectableButton btn5;
private UnselectableButton btn4;
private UnselectableButton btn6;
private UnselectableButton btn2;
private UnselectableButton btn1;
private UnselectableButton btn3;
private UnselectableButton btn0;
private UnselectableButton btnOk;
private UnselectableButton btnDot;
private UnselectableButton btnDel;
private UnselectableButton btn8;
private UnselectableButton btn9;
private UnselectableButton btnEsc;
}
}
@@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Tanshu.Common.KeyboardControl
{
public partial class NumpadControl : UserControl
{
public NumpadControl()
{
InitializeComponent();
}
private void btn1_Click(object sender, EventArgs e)
{
SendKeys.Send("1");
}
private void btn2_Click(object sender, EventArgs e)
{
SendKeys.Send("2");
}
private void btn3_Click(object sender, EventArgs e)
{
SendKeys.Send("3");
}
private void btn4_Click(object sender, EventArgs e)
{
SendKeys.Send("4");
}
private void btn5_Click(object sender, EventArgs e)
{
SendKeys.Send("5");
}
private void btn6_Click(object sender, EventArgs e)
{
SendKeys.Send("6");
}
private void btn7_Click(object sender, EventArgs e)
{
SendKeys.Send("7");
}
private void btn8_Click(object sender, EventArgs e)
{
SendKeys.Send("8");
}
private void btn9_Click(object sender, EventArgs e)
{
SendKeys.Send("9");
}
private void btn0_Click(object sender, EventArgs e)
{
SendKeys.Send("0");
}
private void btnDot_Click(object sender, EventArgs e)
{
SendKeys.Send(".");
}
private void btnOk_Click(object sender, EventArgs e)
{
SendKeys.Send("{ENTER}");
}
private void btnDel_Click(object sender, EventArgs e)
{
SendKeys.Send("{BACKSPACE}");
}
private void btnEsc_Click(object sender, EventArgs e)
{
SendKeys.Send("{ESC}");
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -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.Common.KeyboardControl")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Tanshu.Common.KeyboardControl")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[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("edbf868e-779b-4243-8cb9-150384a94bcc")]
// 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.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,78 @@
<?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>{4847FEE9-90E1-4795-A644-32867887A653}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Tanshu.Common.KeyboardControl</RootNamespace>
<AssemblyName>Tanshu.Common.KeyboardControl</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.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<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.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="NumpadControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="NumpadControl.Designer.cs">
<DependentUpon>NumpadControl.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UnselectableButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UnselectableButton.Designer.cs">
<DependentUpon>UnselectableButton.cs</DependentUpon>
</Compile>
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="NumpadControl.resx">
<DependentUpon>NumpadControl.cs</DependentUpon>
</EmbeddedResource>
</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>
@@ -0,0 +1,5 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>
@@ -0,0 +1,36 @@
namespace Tanshu.Common.KeyboardControl
{
partial class UnselectableButton
{
/// <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 Component 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()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Tanshu.Common.KeyboardControl
{
public partial class UnselectableButton : Button
{
public UnselectableButton()
{
InitializeComponent();
this.SetStyle(ControlStyles.Selectable, false);
}
}
}