Former-commit-id: 3085e25f77129a4dfbdb30848185a6846d59eb54
TangShanKaiPing
wanggang 5 years ago
parent 446f8246c8
commit eb62260bf6

@ -96,7 +96,7 @@
<Compile Include="Controls\IdCard.Designer.cs">
<DependentUpon>IdCard.cs</DependentUpon>
</Compile>
<Compile Include="Infrastructure\FormExtensions.cs" />
<Compile Include="Infrastructure\ToolExtensions.cs" />
<Compile Include="Infrastructure\ImageHelper.cs" />
<Compile Include="Infrastructure\CVRHelper.cs" />
<Compile Include="Infrastructure\CVRSDK.cs" />

@ -1,10 +1,20 @@
using CameraCard;
using System;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
public static class FormExtensions
public static class ToolExtensions
{
public static string Md5(this string input)
{
using (var md5 = MD5.Create())
{
return BitConverter.ToString(md5.ComputeHash(Encoding.ASCII.GetBytes(input))).Replace("-", "");
}
}
public static void Run(this Form form, Action action)
{
form.BeginInvoke(action);

@ -55,7 +55,8 @@ namespace CameraCard
{
if (db.Users.Any())
{
var user = db.Users.FirstOrDefault(o => o.UserName == userName && o.Password == password);
var localPassword = password.Md5();
var user = db.Users.FirstOrDefault(o => o.UserName == userName && o.Password == localPassword);
if (user != null)
{
MainForm.User = user;
@ -123,7 +124,7 @@ namespace CameraCard
var user = db.Users.FirstOrDefault(o => o.UserName == userName);
if (user == null)
{
user = new User { Password = password };
user = new User { Password = password.Md5() };
user.InjectFrom(result.Data);
db.Users.Add(user);
}

@ -29,10 +29,10 @@
private void InitializeComponent()
{
System.Windows.Forms.TabPage tab1;
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
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.save = new System.Windows.Forms.Button();
this.idcGroupBox = new System.Windows.Forms.GroupBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
@ -137,6 +137,7 @@
this.userRealName = new System.Windows.Forms.Label();
this.userOrgan = new System.Windows.Forms.Label();
this.idCard = new CameraCard.IdCard();
this.exit = new System.Windows.Forms.Button();
tab1 = new System.Windows.Forms.TabPage();
tab1.SuspendLayout();
this.idcGroupBox.SuspendLayout();
@ -640,23 +641,23 @@
this.groupGrid.AllowUserToAddRows = false;
this.groupGrid.AllowUserToDeleteRows = false;
this.groupGrid.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.groupGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.groupGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.groupGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.groupGrid.DefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.groupGrid.DefaultCellStyle = dataGridViewCellStyle2;
this.groupGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupGrid.Location = new System.Drawing.Point(3, 3);
this.groupGrid.Name = "groupGrid";
@ -931,14 +932,14 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGrid.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3;
this.dataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.StudentName,
@ -953,14 +954,14 @@
this.HasChedked,
this.HasUploaded,
this.StudentId});
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGrid.DefaultCellStyle = dataGridViewCellStyle8;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGrid.DefaultCellStyle = dataGridViewCellStyle4;
this.dataGrid.Location = new System.Drawing.Point(-4, 53);
this.dataGrid.Name = "dataGrid";
this.dataGrid.ReadOnly = true;
@ -1087,6 +1088,7 @@
//
// tabPage1
//
this.tabPage1.Controls.Add(this.exit);
this.tabPage1.Controls.Add(this.userOrgan);
this.tabPage1.Controls.Add(this.userRealName);
this.tabPage1.Controls.Add(this.loginUserName);
@ -1288,6 +1290,16 @@
this.idCard.Size = new System.Drawing.Size(420, 200);
this.idCard.TabIndex = 8;
//
// exit
//
this.exit.Location = new System.Drawing.Point(65, 167);
this.exit.Name = "exit";
this.exit.Size = new System.Drawing.Size(89, 32);
this.exit.TabIndex = 15;
this.exit.Text = "退出登录";
this.exit.UseVisualStyleBackColor = true;
this.exit.Click += new System.EventHandler(this.exit_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -1436,5 +1448,6 @@
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label userRealName;
private System.Windows.Forms.Label userOrgan;
private System.Windows.Forms.Button exit;
}
}

@ -810,5 +810,10 @@ namespace CameraCard
ConfigurationManager.RefreshSection("appSettings");
}
}
private void exit_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}
Loading…
Cancel
Save