diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a8394e4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*/[Oo]bj/
+*/[Bb]in/
+*.suo
+[Bb]in/
\ No newline at end of file
diff --git a/Tanshu.Accounts.BI/RoleBI.cs b/Tanshu.Accounts.BI/RoleBI.cs
index fc31dd1..d78ffd3 100644
--- a/Tanshu.Accounts.BI/RoleBI.cs
+++ b/Tanshu.Accounts.BI/RoleBI.cs
@@ -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
}
}
diff --git a/Tanshu.Accounts.BI/SecurityBI.cs b/Tanshu.Accounts.BI/SecurityBI.cs
deleted file mode 100644
index 61912e0..0000000
--- a/Tanshu.Accounts.BI/SecurityBI.cs
+++ /dev/null
@@ -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;
- }
- }
- }
-
-}
diff --git a/Tanshu.Accounts.BI/Tanshu.Accounts.BI.csproj b/Tanshu.Accounts.BI/Tanshu.Accounts.BI.csproj
index 5d03b9f..77622f1 100644
--- a/Tanshu.Accounts.BI/Tanshu.Accounts.BI.csproj
+++ b/Tanshu.Accounts.BI/Tanshu.Accounts.BI.csproj
@@ -67,7 +67,6 @@
-
diff --git a/Tanshu.Accounts.Contracts/Roles.cs b/Tanshu.Accounts.Contracts/Roles.cs
new file mode 100644
index 0000000..f88ba03
--- /dev/null
+++ b/Tanshu.Accounts.Contracts/Roles.cs
@@ -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";
+ }
+}
diff --git a/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj b/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj
index 557690e..8b1abd7 100644
--- a/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj
+++ b/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj
@@ -106,6 +106,7 @@
+
diff --git a/Tanshu.Accounts.PointOfSale/App.config b/Tanshu.Accounts.PointOfSale/App.config
index 515e678..c5dcea1 100644
--- a/Tanshu.Accounts.PointOfSale/App.config
+++ b/Tanshu.Accounts.PointOfSale/App.config
@@ -1,12 +1,11 @@
-
+
-
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/Authentication/ILogin.cs b/Tanshu.Accounts.PointOfSale/Authentication/ILogin.cs
new file mode 100644
index 0000000..27b5446
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/Authentication/ILogin.cs
@@ -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();
+ }
+}
diff --git a/Tanshu.Accounts.PointOfSale/Authentication/KeyboardLogin.cs b/Tanshu.Accounts.PointOfSale/Authentication/KeyboardLogin.cs
new file mode 100644
index 0000000..44bcb48
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/Authentication/KeyboardLogin.cs
@@ -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);
+ }
+
+ }
+}
diff --git a/Tanshu.Accounts.PointOfSale/LoginForm.Designer.cs b/Tanshu.Accounts.PointOfSale/Authentication/LoginForm.Designer.cs
similarity index 88%
rename from Tanshu.Accounts.PointOfSale/LoginForm.Designer.cs
rename to Tanshu.Accounts.PointOfSale/Authentication/LoginForm.Designer.cs
index b8589f8..1a954b2 100644
--- a/Tanshu.Accounts.PointOfSale/LoginForm.Designer.cs
+++ b/Tanshu.Accounts.PointOfSale/Authentication/LoginForm.Designer.cs
@@ -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;
}
}
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/LoginForm.cs b/Tanshu.Accounts.PointOfSale/Authentication/LoginForm.cs
similarity index 93%
rename from Tanshu.Accounts.PointOfSale/LoginForm.cs
rename to Tanshu.Accounts.PointOfSale/Authentication/LoginForm.cs
index 50ac118..8843eff 100644
--- a/Tanshu.Accounts.PointOfSale/LoginForm.cs
+++ b/Tanshu.Accounts.PointOfSale/Authentication/LoginForm.cs
@@ -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");
diff --git a/Tanshu.Accounts.PointOfSale/LoginForm.resx b/Tanshu.Accounts.PointOfSale/Authentication/LoginForm.resx
similarity index 100%
rename from Tanshu.Accounts.PointOfSale/LoginForm.resx
rename to Tanshu.Accounts.PointOfSale/Authentication/LoginForm.resx
diff --git a/Tanshu.Accounts.PointOfSale/Authentication/Session.cs b/Tanshu.Accounts.PointOfSale/Authentication/Session.cs
new file mode 100644
index 0000000..72b366b
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/Authentication/Session.cs
@@ -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 "";
+ }
+ }
+}
diff --git a/Tanshu.Accounts.PointOfSale/CurrencyCounter.Designer.cs b/Tanshu.Accounts.PointOfSale/CurrencyCounter.Designer.cs
new file mode 100644
index 0000000..c0215e5
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/CurrencyCounter.Designer.cs
@@ -0,0 +1,291 @@
+namespace Tanshu.Accounts.PointOfSale
+{
+ partial class CurrencyCounter
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ 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;
+ }
+}
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/CurrencyCounter.cs b/Tanshu.Accounts.PointOfSale/CurrencyCounter.cs
new file mode 100644
index 0000000..9911795
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/CurrencyCounter.cs
@@ -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 amounts = new Dictionary();
+ 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);
+ }
+ }
+
+ }
+}
diff --git a/Tanshu.Accounts.PointOfSale/CurrencyCounter.resx b/Tanshu.Accounts.PointOfSale/CurrencyCounter.resx
new file mode 100644
index 0000000..19dc0dd
--- /dev/null
+++ b/Tanshu.Accounts.PointOfSale/CurrencyCounter.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/MainForm.cs b/Tanshu.Accounts.PointOfSale/MainForm.cs
index 848a272..f27c50f 100644
--- a/Tanshu.Accounts.PointOfSale/MainForm.cs
+++ b/Tanshu.Accounts.PointOfSale/MainForm.cs
@@ -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 amounts = new Dictionary();
- //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();
+ }
+ }
}
}
}
diff --git a/Tanshu.Accounts.PointOfSale/MainForm.designer.cs b/Tanshu.Accounts.PointOfSale/MainForm.designer.cs
index caec151..f362f89 100644
--- a/Tanshu.Accounts.PointOfSale/MainForm.designer.cs
+++ b/Tanshu.Accounts.PointOfSale/MainForm.designer.cs
@@ -28,29 +28,6 @@
///
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;
}
}
\ No newline at end of file
diff --git a/Tanshu.Accounts.PointOfSale/ProductsForm.cs b/Tanshu.Accounts.PointOfSale/ProductsForm.cs
index 7a2521e..7bc7e29 100644
--- a/Tanshu.Accounts.PointOfSale/ProductsForm.cs
+++ b/Tanshu.Accounts.PointOfSale/ProductsForm.cs
@@ -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);
diff --git a/Tanshu.Accounts.PointOfSale/Program.cs b/Tanshu.Accounts.PointOfSale/Program.cs
index 4a1f5f5..2c16fab 100644
--- a/Tanshu.Accounts.PointOfSale/Program.cs
+++ b/Tanshu.Accounts.PointOfSale/Program.cs
@@ -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");
}
}
}
diff --git a/Tanshu.Accounts.PointOfSale/Sales/AdjustAdvanceForm.cs b/Tanshu.Accounts.PointOfSale/Sales/AdjustAdvanceForm.cs
index 1c4ee70..13dc32f 100644
--- a/Tanshu.Accounts.PointOfSale/Sales/AdjustAdvanceForm.cs
+++ b/Tanshu.Accounts.PointOfSale/Sales/AdjustAdvanceForm.cs
@@ -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();
}
}
diff --git a/Tanshu.Accounts.PointOfSale/Sales/CheckoutForm.cs b/Tanshu.Accounts.PointOfSale/Sales/CheckoutForm.cs
index ea9ca38..4907797 100644
--- a/Tanshu.Accounts.PointOfSale/Sales/CheckoutForm.cs
+++ b/Tanshu.Accounts.PointOfSale/Sales/CheckoutForm.cs
@@ -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)
diff --git a/Tanshu.Accounts.PointOfSale/Sales/CustomersForm.cs b/Tanshu.Accounts.PointOfSale/Sales/CustomersForm.cs
index ad81caf..1b5f646 100644
--- a/Tanshu.Accounts.PointOfSale/Sales/CustomersForm.cs
+++ b/Tanshu.Accounts.PointOfSale/Sales/CustomersForm.cs
@@ -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;
diff --git a/Tanshu.Accounts.PointOfSale/Sales/PaymentForm.cs b/Tanshu.Accounts.PointOfSale/Sales/PaymentForm.cs
index 688d696..7f927c7 100644
--- a/Tanshu.Accounts.PointOfSale/Sales/PaymentForm.cs
+++ b/Tanshu.Accounts.PointOfSale/Sales/PaymentForm.cs
@@ -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;
diff --git a/Tanshu.Accounts.PointOfSale/Sales/RecieveAdvanceForm.cs b/Tanshu.Accounts.PointOfSale/Sales/RecieveAdvanceForm.cs
index 42b4e90..0ea74ad 100644
--- a/Tanshu.Accounts.PointOfSale/Sales/RecieveAdvanceForm.cs
+++ b/Tanshu.Accounts.PointOfSale/Sales/RecieveAdvanceForm.cs
@@ -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)
{
diff --git a/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.cs b/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.cs
index 755c7f6..9b3b706 100644
--- a/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.cs
+++ b/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.cs
@@ -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);
}
}
}
diff --git a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs
index fd4d90f..1d85f4a 100644
--- a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs
+++ b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs
@@ -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;
diff --git a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs
index 0bd568e..529a451 100644
--- a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs
+++ b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs
@@ -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();
}
diff --git a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.resx b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.resx
index bd67484..3409f1d 100644
--- a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.resx
+++ b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.resx
@@ -132,6 +132,15 @@
True
+
+ True
+
+
+ True
+
+
+ True
+
True
diff --git a/Tanshu.Accounts.PointOfSale/Tanshu.Accounts.PointOfSale.csproj b/Tanshu.Accounts.PointOfSale/Tanshu.Accounts.PointOfSale.csproj
index e33a00f..49a3d9c 100644
--- a/Tanshu.Accounts.PointOfSale/Tanshu.Accounts.PointOfSale.csproj
+++ b/Tanshu.Accounts.PointOfSale/Tanshu.Accounts.PointOfSale.csproj
@@ -83,6 +83,15 @@
+
+
+
+
+ Form
+
+
+ CurrencyCounter.cs
+
Form
@@ -145,10 +154,10 @@
CustomersForm.cs
-
+
Form
-
+
LoginForm.cs
@@ -184,6 +193,9 @@
+
+ CurrencyCounter.cs
+
PaymentForm.cs
Designer
@@ -224,7 +236,7 @@
CustomersForm.cs
Designer
-
+
LoginForm.cs
Designer
@@ -322,6 +334,10 @@
{90C9D02C-91AF-4529-86BE-28320332DDB5}
Tanshu.Accounts.Print
+
+ {4847FEE9-90E1-4795-A644-32867887A653}
+ Tanshu.Common.KeyboardControl
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Tanshu.Common.KeyboardControl/Properties/AssemblyInfo.cs b/Tanshu.Common.KeyboardControl/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..df65bae
--- /dev/null
+++ b/Tanshu.Common.KeyboardControl/Properties/AssemblyInfo.cs
@@ -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")]
diff --git a/Tanshu.Common.KeyboardControl/Tanshu.Common.KeyboardControl.csproj b/Tanshu.Common.KeyboardControl/Tanshu.Common.KeyboardControl.csproj
new file mode 100644
index 0000000..5529246
--- /dev/null
+++ b/Tanshu.Common.KeyboardControl/Tanshu.Common.KeyboardControl.csproj
@@ -0,0 +1,78 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {4847FEE9-90E1-4795-A644-32867887A653}
+ Library
+ Properties
+ Tanshu.Common.KeyboardControl
+ Tanshu.Common.KeyboardControl
+ v3.5
+ 512
+
+
+ true
+ full
+ false
+ ..\Bin\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ ..\Bin\
+ TRACE
+ prompt
+ 4
+
+
+
+
+ 3.5
+
+
+ 3.5
+
+
+ 3.5
+
+
+
+
+
+
+
+
+ UserControl
+
+
+ NumpadControl.cs
+
+
+
+ Component
+
+
+ UnselectableButton.cs
+
+
+
+
+
+ NumpadControl.cs
+
+
+
+
+
\ No newline at end of file
diff --git a/Tanshu.Common.KeyboardControl/Tanshu.Common.KeyboardControl.csproj.user b/Tanshu.Common.KeyboardControl/Tanshu.Common.KeyboardControl.csproj.user
new file mode 100644
index 0000000..6a34e7d
--- /dev/null
+++ b/Tanshu.Common.KeyboardControl/Tanshu.Common.KeyboardControl.csproj.user
@@ -0,0 +1,5 @@
+
+
+ ShowAllFiles
+
+
\ No newline at end of file
diff --git a/Tanshu.Common.KeyboardControl/UnselectableButton.Designer.cs b/Tanshu.Common.KeyboardControl/UnselectableButton.Designer.cs
new file mode 100644
index 0000000..df9ec22
--- /dev/null
+++ b/Tanshu.Common.KeyboardControl/UnselectableButton.Designer.cs
@@ -0,0 +1,36 @@
+namespace Tanshu.Common.KeyboardControl
+{
+ partial class UnselectableButton
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ }
+
+ #endregion
+ }
+}
diff --git a/Tanshu.Common.KeyboardControl/UnselectableButton.cs b/Tanshu.Common.KeyboardControl/UnselectableButton.cs
new file mode 100644
index 0000000..9df9e6b
--- /dev/null
+++ b/Tanshu.Common.KeyboardControl/UnselectableButton.cs
@@ -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);
+ }
+ }
+}