Breaking Changes. Upgrade Script in Sql directory. Deployed

This commit is contained in:
unknown
2011-02-18 22:24:48 +05:30
parent d4cfa92848
commit 9ed5843dbd
86 changed files with 2616 additions and 2358 deletions

View File

@ -11,7 +11,6 @@ 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);
@ -37,7 +36,6 @@ namespace Tanshu.Accounts.PointOfSale
}
static void SetThreadPrincipal(string userName)
{
//log.Warn(string.Format("User Login: '{0}'", userName));
if (userName.Contains(":"))
userName = userName.Substring(userName.IndexOf(":") + 1);

View File

@ -1,24 +1,19 @@
using System;
using System.Threading;
using System.Windows.Forms;
using Tanshu.Accounts.Entities.Auth;
using Tanshu.Accounts.Repository;
using Tanshu.Accounts.Helpers;
using Tanshu.Common.KeyboardControl;
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 User user;
private IKeyboardControl keyboardControl;
public LoginForm(IKeyboardControl keyboardControl)
{
InitializeComponent();
isAuthenticated = false;
userName = null;
user = null;
this.keyboardControl = keyboardControl;
var control = keyboardControl as UserControl;
@ -47,22 +42,17 @@ namespace Tanshu.Accounts.PointOfSale
private void btnLogin_Click(object sender, EventArgs e)
{
userName = txtUserName.Text.Trim();
isAuthenticated = UserBI.ValidateUser(userName, Tanshu.Common.Md5.Hash(txtPassword.Text, "v2"));
if (isAuthenticated)
{
user = UserBI.ValidateUser(txtUserName.Text.Trim(), Tanshu.Common.Md5.Hash(txtPassword.Text, "v2"));
if (user != null)
this.Close();
}
else
MessageBox.Show("Username or password is not valid");
}
public bool UserName(out string userName)
{
userName = this.userName;
return isAuthenticated;
userName = this.user == null ? "" : this.user.Name;
return this.user != null;
}
private void btnExit_Click(object sender, EventArgs e)

View File

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tanshu.Accounts.Repository;
using System.Threading;
using Tanshu.Accounts.Contracts;
using Tanshu.Common.KeyboardControl;
namespace Tanshu.Accounts.PointOfSale
{
class MsrLogin : 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 (var frm = new MsrLoginForm(false))
{
string userName;
frm.ShowDialog();
bool authenticated = frm.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 = UserBI.GetUserFromName(userName);
}
}
}

View File

@ -0,0 +1,67 @@
using Tanshu.Common.KeyboardControl;
namespace Tanshu.Accounts.PointOfSale
{
partial class MsrLoginForm
{
/// <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.btnLogin = new UnselectableButton();
this.SuspendLayout();
//
// btnLogin
//
this.btnLogin.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnLogin.Location = new System.Drawing.Point(0, 0);
this.btnLogin.Name = "btnLogin";
this.btnLogin.Size = new System.Drawing.Size(290, 97);
this.btnLogin.TabIndex = 0;
this.btnLogin.Text = "Login";
this.btnLogin.UseVisualStyleBackColor = true;
this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
//
// MsrLoginForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(290, 97);
this.Controls.Add(this.btnLogin);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.KeyPreview = true;
this.Name = "MsrLoginForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Login";
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.MsrLoginForm_KeyPress);
this.ResumeLayout(false);
}
#endregion
private UnselectableButton btnLogin;
}
}

View File

@ -0,0 +1,55 @@
using System;
using System.Windows.Forms;
using Tanshu.Accounts.Entities.Auth;
using Tanshu.Accounts.Repository;
namespace Tanshu.Accounts.PointOfSale
{
public partial class MsrLoginForm : Form
{
private string loginString;
private User user;
private bool register;
public MsrLoginForm(bool register)
{
InitializeComponent();
user = null;
loginString = string.Empty;
this.register = register;
this.btnLogin.Enabled = false;
}
private void btnLogin_Click(object sender, EventArgs e)
{
if (!register)
{
var user = UserBI.MsrValidateUser(loginString);
if (user != null)
{
this.user = user;
this.Close();
}
else
MessageBox.Show("Unrecognised Card");
}
else
{
this.user = new User() { Name = loginString };
this.Close();
}
}
public bool UserName(out string userName)
{
userName = this.user == null ? "" : this.user.Name;
return this.user != null;
}
private void MsrLoginForm_KeyPress(object sender, KeyPressEventArgs e)
{
btnLogin.Enabled = true;
this.loginString += e.KeyChar.ToString();
}
}
}

View File

@ -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>