Initial Commit
This commit is contained in:
179
Tanshu.Accounts.PointOfSale/User Management/AssignRoles.Designer.cs
generated
Normal file
179
Tanshu.Accounts.PointOfSale/User Management/AssignRoles.Designer.cs
generated
Normal file
@ -0,0 +1,179 @@
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
partial class AssignRoles
|
||||
{
|
||||
/// <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.lstRoles = new System.Windows.Forms.ListBox();
|
||||
this.lstUserRoles = new System.Windows.Forms.ListBox();
|
||||
this.cmbUsers = new System.Windows.Forms.ComboBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.btnAddSelected = new System.Windows.Forms.Button();
|
||||
this.btnAddAll = new System.Windows.Forms.Button();
|
||||
this.btnRemoveSelected = new System.Windows.Forms.Button();
|
||||
this.btnRemoveAll = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lstRoles
|
||||
//
|
||||
this.lstRoles.FormattingEnabled = true;
|
||||
this.lstRoles.Location = new System.Drawing.Point(12, 59);
|
||||
this.lstRoles.Name = "lstRoles";
|
||||
this.lstRoles.Size = new System.Drawing.Size(183, 225);
|
||||
this.lstRoles.TabIndex = 0;
|
||||
//
|
||||
// lstUserRoles
|
||||
//
|
||||
this.lstUserRoles.FormattingEnabled = true;
|
||||
this.lstUserRoles.Location = new System.Drawing.Point(274, 59);
|
||||
this.lstUserRoles.Name = "lstUserRoles";
|
||||
this.lstUserRoles.Size = new System.Drawing.Size(183, 225);
|
||||
this.lstUserRoles.TabIndex = 1;
|
||||
//
|
||||
// cmbUsers
|
||||
//
|
||||
this.cmbUsers.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbUsers.FormattingEnabled = true;
|
||||
this.cmbUsers.Location = new System.Drawing.Point(72, 12);
|
||||
this.cmbUsers.Name = "cmbUsers";
|
||||
this.cmbUsers.Size = new System.Drawing.Size(276, 21);
|
||||
this.cmbUsers.TabIndex = 2;
|
||||
this.cmbUsers.SelectedIndexChanged += new System.EventHandler(this.cmbUsers_SelectedIndexChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(9, 12);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(60, 13);
|
||||
this.label1.TabIndex = 4;
|
||||
this.label1.Text = "User Name";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 43);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(76, 13);
|
||||
this.label2.TabIndex = 5;
|
||||
this.label2.Text = "Pending Roles";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(271, 43);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(80, 13);
|
||||
this.label3.TabIndex = 6;
|
||||
this.label3.Text = "Assigned Roles";
|
||||
//
|
||||
// btnAddSelected
|
||||
//
|
||||
this.btnAddSelected.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnAddSelected.Location = new System.Drawing.Point(201, 105);
|
||||
this.btnAddSelected.Name = "btnAddSelected";
|
||||
this.btnAddSelected.Size = new System.Drawing.Size(67, 25);
|
||||
this.btnAddSelected.TabIndex = 7;
|
||||
this.btnAddSelected.Text = ">";
|
||||
this.btnAddSelected.UseVisualStyleBackColor = true;
|
||||
this.btnAddSelected.Click += new System.EventHandler(this.btnAddSelected_Click);
|
||||
//
|
||||
// btnAddAll
|
||||
//
|
||||
this.btnAddAll.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnAddAll.Location = new System.Drawing.Point(201, 136);
|
||||
this.btnAddAll.Name = "btnAddAll";
|
||||
this.btnAddAll.Size = new System.Drawing.Size(67, 25);
|
||||
this.btnAddAll.TabIndex = 8;
|
||||
this.btnAddAll.Text = ">>";
|
||||
this.btnAddAll.UseVisualStyleBackColor = true;
|
||||
this.btnAddAll.Click += new System.EventHandler(this.btnAddAll_Click);
|
||||
//
|
||||
// btnRemoveSelected
|
||||
//
|
||||
this.btnRemoveSelected.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnRemoveSelected.Location = new System.Drawing.Point(201, 167);
|
||||
this.btnRemoveSelected.Name = "btnRemoveSelected";
|
||||
this.btnRemoveSelected.Size = new System.Drawing.Size(67, 25);
|
||||
this.btnRemoveSelected.TabIndex = 9;
|
||||
this.btnRemoveSelected.Text = "<";
|
||||
this.btnRemoveSelected.UseVisualStyleBackColor = true;
|
||||
this.btnRemoveSelected.Click += new System.EventHandler(this.btnRemoveSelected_Click);
|
||||
//
|
||||
// btnRemoveAll
|
||||
//
|
||||
this.btnRemoveAll.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnRemoveAll.Location = new System.Drawing.Point(201, 198);
|
||||
this.btnRemoveAll.Name = "btnRemoveAll";
|
||||
this.btnRemoveAll.Size = new System.Drawing.Size(67, 25);
|
||||
this.btnRemoveAll.TabIndex = 10;
|
||||
this.btnRemoveAll.Text = "<<";
|
||||
this.btnRemoveAll.UseVisualStyleBackColor = true;
|
||||
this.btnRemoveAll.Click += new System.EventHandler(this.btnRemoveAll_Click);
|
||||
//
|
||||
// AssignRoles
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(469, 323);
|
||||
this.Controls.Add(this.btnRemoveAll);
|
||||
this.Controls.Add(this.btnRemoveSelected);
|
||||
this.Controls.Add(this.btnAddAll);
|
||||
this.Controls.Add(this.btnAddSelected);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.cmbUsers);
|
||||
this.Controls.Add(this.lstUserRoles);
|
||||
this.Controls.Add(this.lstRoles);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "AssignRoles";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "AssignRoles";
|
||||
this.Load += new System.EventHandler(this.AssignRoles_Load);
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AssignRoles_FormClosing);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListBox lstRoles;
|
||||
private System.Windows.Forms.ListBox lstUserRoles;
|
||||
private System.Windows.Forms.ComboBox cmbUsers;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Button btnAddSelected;
|
||||
private System.Windows.Forms.Button btnAddAll;
|
||||
private System.Windows.Forms.Button btnRemoveSelected;
|
||||
private System.Windows.Forms.Button btnRemoveAll;
|
||||
}
|
||||
}
|
||||
120
Tanshu.Accounts.PointOfSale/User Management/AssignRoles.cs
Normal file
120
Tanshu.Accounts.PointOfSale/User Management/AssignRoles.cs
Normal file
@ -0,0 +1,120 @@
|
||||
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;
|
||||
using Tanshu.Accounts.Helpers;
|
||||
using System.Threading;
|
||||
using Tanshu.Accounts.BI;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class AssignRoles : Form
|
||||
{
|
||||
public AssignRoles()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void AssignRoles_Load(object sender, EventArgs e)
|
||||
{
|
||||
FillUsers();
|
||||
}
|
||||
|
||||
private void FillUsers()
|
||||
{
|
||||
cmbUsers.DisplayMember = "Name";
|
||||
cmbUsers.ValueMember = "UserID";
|
||||
cmbUsers.DataSource = new UserBI().GetUsers();
|
||||
}
|
||||
|
||||
private void cmbUsers_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshRoles();
|
||||
}
|
||||
|
||||
private void RefreshRoles()
|
||||
{
|
||||
if (cmbUsers.SelectedValue == null)
|
||||
{
|
||||
string[] roles = new MembershipBI().GetAllRoles();
|
||||
lstRoles.DataSource = roles;
|
||||
// lstRoles.DataBind();
|
||||
string[] userRoles = new string[0];
|
||||
lstUserRoles.DataSource = userRoles;
|
||||
// lstUserRoles.DataBind();
|
||||
|
||||
btnAddAll.Enabled = false;
|
||||
btnAddSelected.Enabled = false;
|
||||
btnRemoveAll.Enabled = false;
|
||||
btnRemoveSelected.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] roles = new MembershipBI().GetAllRoles();
|
||||
string[] userRoles = new MembershipBI().GetRolesForUser(cmbUsers.Text.Trim());
|
||||
roles = roles.Where(r => !userRoles.Contains(r)).ToArray();
|
||||
lstRoles.DataSource = roles;
|
||||
// lstRoles.DataBind();
|
||||
|
||||
lstUserRoles.DataSource = userRoles;
|
||||
// lstUserRoles.DataBind();
|
||||
|
||||
btnAddAll.Enabled = true;
|
||||
btnAddSelected.Enabled = true;
|
||||
btnRemoveAll.Enabled = true;
|
||||
btnRemoveSelected.Enabled = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAddSelected_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (lstRoles.SelectedItem != null)
|
||||
{
|
||||
new MembershipBI().AddUsersToRoles(new string[] { cmbUsers.Text.Trim() }, new string[] { lstRoles.SelectedItem.ToString() });
|
||||
RefreshRoles();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnRemoveSelected_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (lstUserRoles.SelectedItem != null)
|
||||
{
|
||||
new MembershipBI().RemoveUsersFromRoles(new string[] { cmbUsers.Text.Trim() }, new string[] { lstUserRoles.SelectedItem.ToString() });
|
||||
RefreshRoles();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAddAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i <= lstRoles.Items.Count - 1; i++)
|
||||
{
|
||||
new MembershipBI().AddUsersToRoles(new string[] { cmbUsers.Text.Trim() }, new string[] { lstRoles.Items[i].ToString() });
|
||||
}
|
||||
RefreshRoles();
|
||||
|
||||
}
|
||||
|
||||
private void btnRemoveAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i <= lstUserRoles.Items.Count - 1; i++)
|
||||
{
|
||||
new MembershipBI().RemoveUsersFromRoles(new string[] { cmbUsers.Text.Trim() }, new string[] { lstUserRoles.Items[i].ToString() });
|
||||
}
|
||||
RefreshRoles();
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
// bind the generic principal to the thread
|
||||
Thread.CurrentPrincipal = principal;
|
||||
}
|
||||
}
|
||||
}
|
||||
120
Tanshu.Accounts.PointOfSale/User Management/AssignRoles.resx
Normal file
120
Tanshu.Accounts.PointOfSale/User Management/AssignRoles.resx
Normal 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>
|
||||
173
Tanshu.Accounts.PointOfSale/User Management/ChangePassword.Designer.cs
generated
Normal file
173
Tanshu.Accounts.PointOfSale/User Management/ChangePassword.Designer.cs
generated
Normal file
@ -0,0 +1,173 @@
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
partial class ChangePassword
|
||||
{
|
||||
/// <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.txtPassword = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.txtUsername = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtnewPassword = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.txtConfirmPassword = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.btnCreateUSer = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txtPassword
|
||||
//
|
||||
this.txtPassword.Location = new System.Drawing.Point(104, 38);
|
||||
this.txtPassword.Name = "txtPassword";
|
||||
this.txtPassword.PasswordChar = '/';
|
||||
this.txtPassword.Size = new System.Drawing.Size(162, 20);
|
||||
this.txtPassword.TabIndex = 5;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(28, 38);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(70, 13);
|
||||
this.label2.TabIndex = 6;
|
||||
this.label2.Text = "old Password";
|
||||
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// txtUsername
|
||||
//
|
||||
this.txtUsername.Enabled = false;
|
||||
this.txtUsername.Location = new System.Drawing.Point(104, 12);
|
||||
this.txtUsername.Name = "txtUsername";
|
||||
this.txtUsername.Size = new System.Drawing.Size(162, 20);
|
||||
this.txtUsername.TabIndex = 3;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(38, 12);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(60, 13);
|
||||
this.label1.TabIndex = 4;
|
||||
this.label1.Text = "User Name";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// txtnewPassword
|
||||
//
|
||||
this.txtnewPassword.Location = new System.Drawing.Point(104, 64);
|
||||
this.txtnewPassword.Name = "txtnewPassword";
|
||||
this.txtnewPassword.PasswordChar = '/';
|
||||
this.txtnewPassword.Size = new System.Drawing.Size(162, 20);
|
||||
this.txtnewPassword.TabIndex = 7;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(20, 64);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(78, 13);
|
||||
this.label3.TabIndex = 8;
|
||||
this.label3.Text = "New Password";
|
||||
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// txtConfirmPassword
|
||||
//
|
||||
this.txtConfirmPassword.Location = new System.Drawing.Point(104, 90);
|
||||
this.txtConfirmPassword.Name = "txtConfirmPassword";
|
||||
this.txtConfirmPassword.PasswordChar = '/';
|
||||
this.txtConfirmPassword.Size = new System.Drawing.Size(162, 20);
|
||||
this.txtConfirmPassword.TabIndex = 9;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(7, 90);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(91, 13);
|
||||
this.label4.TabIndex = 10;
|
||||
this.label4.Text = "Confirm Password";
|
||||
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(220, 116);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(46, 23);
|
||||
this.button2.TabIndex = 12;
|
||||
this.button2.Text = "Ca&ncel";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// btnCreateUSer
|
||||
//
|
||||
this.btnCreateUSer.Location = new System.Drawing.Point(104, 116);
|
||||
this.btnCreateUSer.Name = "btnCreateUSer";
|
||||
this.btnCreateUSer.Size = new System.Drawing.Size(110, 23);
|
||||
this.btnCreateUSer.TabIndex = 11;
|
||||
this.btnCreateUSer.Text = "&Change Password";
|
||||
this.btnCreateUSer.UseVisualStyleBackColor = true;
|
||||
this.btnCreateUSer.Click += new System.EventHandler(this.btnCreateUSer_Click);
|
||||
//
|
||||
// ChangePassword
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(287, 145);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.btnCreateUSer);
|
||||
this.Controls.Add(this.txtConfirmPassword);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.txtnewPassword);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.txtPassword);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.txtUsername);
|
||||
this.Controls.Add(this.label1);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "ChangePassword";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "ChangePassword";
|
||||
this.Load += new System.EventHandler(this.ChangePassword_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox txtPassword;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox txtUsername;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox txtnewPassword;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox txtConfirmPassword;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button btnCreateUSer;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.BI;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.Helpers;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class ChangePassword : Form
|
||||
{
|
||||
public ChangePassword()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ChangePassword_Load(object sender, EventArgs e)
|
||||
{
|
||||
txtUsername.Text = CurrentUser.user.Name;
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnCreateUSer_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (txtPassword.Text.Trim() == "")
|
||||
MessageBox.Show("Old password can not be blank", "Blank not allowed");
|
||||
else
|
||||
{
|
||||
if (txtnewPassword.Text.Trim() == "")
|
||||
MessageBox.Show("New password can not be blank", "Blank not allowed");
|
||||
else
|
||||
{
|
||||
if (txtnewPassword.Text.Trim() != txtConfirmPassword.Text.Trim())
|
||||
MessageBox.Show("New password not matched to confirm password", "Password not matched");
|
||||
else
|
||||
{
|
||||
if (ChangeUserPassword())
|
||||
{
|
||||
MessageBox.Show("Password changed", "Confirm");
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
MessageBox.Show("old Password not matched for user", "Wrong Password");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ChangeUserPassword()
|
||||
{
|
||||
UserBO userEntity = new UserBO();
|
||||
userEntity.Name = txtUsername.Text.Trim();
|
||||
userEntity.Password = Tanshu.Common.Md5.Hash(txtPassword.Text.Trim(), "Salt");
|
||||
|
||||
if (new MembershipBI().ValidateUser(userEntity.Name, userEntity.Password))
|
||||
return new UserBI().ChangePassword(userEntity, Tanshu.Common.Md5.Hash(txtnewPassword.Text.Trim(), "Salt"));
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
120
Tanshu.Accounts.PointOfSale/User Management/ChangePassword.resx
Normal file
120
Tanshu.Accounts.PointOfSale/User Management/ChangePassword.resx
Normal 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>
|
||||
28
Tanshu.Accounts.PointOfSale/User Management/RoleFactoryBI.cs
Normal file
28
Tanshu.Accounts.PointOfSale/User Management/RoleFactoryBI.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Tanshu.Accounts.BI;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public class RoleFactoryBI
|
||||
{
|
||||
private RoleFactoryBI()
|
||||
{ }
|
||||
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);
|
||||
}
|
||||
}
|
||||
return roleBI;
|
||||
}
|
||||
}
|
||||
}
|
||||
147
Tanshu.Accounts.PointOfSale/User Management/UserForm.Designer.cs
generated
Normal file
147
Tanshu.Accounts.PointOfSale/User Management/UserForm.Designer.cs
generated
Normal file
@ -0,0 +1,147 @@
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
partial class UserForm
|
||||
{
|
||||
/// <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.label1 = new System.Windows.Forms.Label();
|
||||
this.txtUsername = new System.Windows.Forms.TextBox();
|
||||
this.txtPassword = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.chkLocked = new System.Windows.Forms.CheckBox();
|
||||
this.btnDelete = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.btnSave = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 13);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(60, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "User Name";
|
||||
//
|
||||
// txtUsername
|
||||
//
|
||||
this.txtUsername.Location = new System.Drawing.Point(78, 12);
|
||||
this.txtUsername.Name = "txtUsername";
|
||||
this.txtUsername.Size = new System.Drawing.Size(188, 20);
|
||||
this.txtUsername.TabIndex = 0;
|
||||
//
|
||||
// txtPassword
|
||||
//
|
||||
this.txtPassword.Location = new System.Drawing.Point(78, 38);
|
||||
this.txtPassword.Name = "txtPassword";
|
||||
this.txtPassword.PasswordChar = '/';
|
||||
this.txtPassword.Size = new System.Drawing.Size(188, 20);
|
||||
this.txtPassword.TabIndex = 1;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 39);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(53, 13);
|
||||
this.label2.TabIndex = 2;
|
||||
this.label2.Text = "Password";
|
||||
//
|
||||
// chkLocked
|
||||
//
|
||||
this.chkLocked.AutoSize = true;
|
||||
this.chkLocked.Location = new System.Drawing.Point(78, 65);
|
||||
this.chkLocked.Name = "chkLocked";
|
||||
this.chkLocked.Size = new System.Drawing.Size(82, 17);
|
||||
this.chkLocked.TabIndex = 2;
|
||||
this.chkLocked.Text = "Locked Out";
|
||||
this.chkLocked.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnDelete
|
||||
//
|
||||
this.btnDelete.Location = new System.Drawing.Point(96, 88);
|
||||
this.btnDelete.Name = "btnDelete";
|
||||
this.btnDelete.Size = new System.Drawing.Size(78, 23);
|
||||
this.btnDelete.TabIndex = 9;
|
||||
this.btnDelete.Text = "&Delete";
|
||||
this.btnDelete.UseVisualStyleBackColor = true;
|
||||
this.btnDelete.Click += new System.EventHandler(this.btnCreateUSer_Click);
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Location = new System.Drawing.Point(180, 88);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(85, 23);
|
||||
this.btnCancel.TabIndex = 10;
|
||||
this.btnCancel.Text = "&Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnSave
|
||||
//
|
||||
this.btnSave.Location = new System.Drawing.Point(12, 88);
|
||||
this.btnSave.Name = "btnSave";
|
||||
this.btnSave.Size = new System.Drawing.Size(78, 23);
|
||||
this.btnSave.TabIndex = 11;
|
||||
this.btnSave.Text = "&Save";
|
||||
this.btnSave.UseVisualStyleBackColor = true;
|
||||
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
|
||||
//
|
||||
// UserForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(300, 136);
|
||||
this.Controls.Add(this.btnSave);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnDelete);
|
||||
this.Controls.Add(this.chkLocked);
|
||||
this.Controls.Add(this.txtPassword);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.txtUsername);
|
||||
this.Controls.Add(this.label1);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "UserForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "User Form";
|
||||
this.Load += new System.EventHandler(this.NewUser_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox txtUsername;
|
||||
private System.Windows.Forms.TextBox txtPassword;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.CheckBox chkLocked;
|
||||
private System.Windows.Forms.Button btnDelete;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.Button btnSave;
|
||||
}
|
||||
}
|
||||
84
Tanshu.Accounts.PointOfSale/User Management/UserForm.cs
Normal file
84
Tanshu.Accounts.PointOfSale/User Management/UserForm.cs
Normal file
@ -0,0 +1,84 @@
|
||||
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;
|
||||
using Tanshu.Accounts.Helpers;
|
||||
using Tanshu.Accounts.BI;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class UserForm : Form
|
||||
{
|
||||
UserBO user;
|
||||
public UserForm( Guid? userID)
|
||||
{
|
||||
InitializeComponent();
|
||||
if (userID.HasValue)
|
||||
user = new UserBI().GetUser(userID.Value);
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnCreateUSer_Click(object sender, EventArgs e)
|
||||
{
|
||||
new UserBI().Delete(user.UserID);
|
||||
btnCancel_Click(sender, e);
|
||||
}
|
||||
|
||||
private void NewUser_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (user != null)
|
||||
{
|
||||
txtUsername.Text = user.Name;
|
||||
txtPassword.Text = user.Password;
|
||||
chkLocked.Checked = user.LockedOut;
|
||||
}
|
||||
}
|
||||
|
||||
private bool Save()
|
||||
{
|
||||
if (user == null)
|
||||
user = new UserBO();
|
||||
user.Name = txtUsername.Text.Trim();
|
||||
user.Password = Tanshu.Common.Md5.Hash(txtPassword.Text.Trim(), "Salt");
|
||||
user.LockedOut = (chkLocked.Checked == true ? true : false);
|
||||
if (user.UserID == new Guid())
|
||||
new UserBI().Insert(user);
|
||||
else
|
||||
new UserBI().Update(user);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!ValidateValues())
|
||||
{
|
||||
MessageBox.Show("Missing Information: Please check the form.");
|
||||
txtUsername.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
Save();
|
||||
btnCancel_Click(sender, e);
|
||||
}
|
||||
}
|
||||
private bool ValidateValues()
|
||||
{
|
||||
if (txtUsername.Text.Trim() == "")
|
||||
return false;
|
||||
if (txtPassword.Text.Trim() == "")
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
120
Tanshu.Accounts.PointOfSale/User Management/UserForm.resx
Normal file
120
Tanshu.Accounts.PointOfSale/User Management/UserForm.resx
Normal 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>
|
||||
Reference in New Issue
Block a user