diff --git a/DB/Service/PointService.cs b/DB/Service/PointService.cs index 7be8ecf..eebfdab 100644 --- a/DB/Service/PointService.cs +++ b/DB/Service/PointService.cs @@ -17,19 +17,7 @@ namespace DB.Service } } - ICache _cache=Cache.Default; - private readonly string key = "PRINT"; - public List GetCacheList() - { - if (_cache.ContainsKey(key)) - { - return _cache.Get>(key); - } - - var ls = GetList(); - _cache.Set(key, ls, TimeSpan.FromHours(1)); - return ls; - } + } diff --git a/RfidWeb/FormLogin.cs b/RfidWeb/FormLogin.cs index a61fcc4..423739c 100644 --- a/RfidWeb/FormLogin.cs +++ b/RfidWeb/FormLogin.cs @@ -13,6 +13,8 @@ using DB.Service; using HZH_Controls.Forms; using NewLife; using NewLife.Caching; +using Tool.Model; + using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; namespace RfidWeb @@ -31,8 +33,7 @@ namespace RfidWeb comboUser.SelectedIndex = 0; } - comboPwd.Text = "123456"; - comboPwd.Focus(); + } @@ -53,7 +54,7 @@ namespace RfidWeb return; } - pwd = Aes.Create().Encrypt(pwd.GetBytes(), "nodyang".GetBytes()).ToBase64(); + pwd = Aes.Create().Encrypt(pwd.GetBytes(), CacheKeyManager.AesPwd.GetBytes()).ToBase64(); var one= userService.GetOne(userName, pwd); if (one == null) { diff --git a/RfidWeb/FormMain.cs b/RfidWeb/FormMain.cs index 18352eb..3418900 100644 --- a/RfidWeb/FormMain.cs +++ b/RfidWeb/FormMain.cs @@ -90,9 +90,9 @@ namespace RfidWeb private void UpdateLog() { - if(cache.ContainsKey("UpdateLog")) return; + if(cache.ContainsKey(CacheKeyManager.UpdateLog)) return; - cache.Set("UpdateLog", "d", TimeSpan.FromSeconds(10)); + cache.Set(CacheKeyManager.UpdateLog, DateTime.Now, TimeSpan.FromSeconds(5)); var plc = PlcConnect.Instance; var userDto = TestFactory.TestUser(); @@ -108,7 +108,7 @@ namespace RfidWeb } - cache.Remove("UpdateLog"); + cache.Remove(CacheKeyManager.UpdateLog); } diff --git a/RfidWeb/Frm/FormRegister.Designer.cs b/RfidWeb/Frm/FormRegister.Designer.cs index f49995b..cd777de 100644 --- a/RfidWeb/Frm/FormRegister.Designer.cs +++ b/RfidWeb/Frm/FormRegister.Designer.cs @@ -51,8 +51,9 @@ this.lblTitle.Dock = System.Windows.Forms.DockStyle.Top; this.lblTitle.Font = new System.Drawing.Font("微软雅黑", 17F); this.lblTitle.Location = new System.Drawing.Point(0, 0); + this.lblTitle.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblTitle.Name = "lblTitle"; - this.lblTitle.Size = new System.Drawing.Size(835, 60); + this.lblTitle.Size = new System.Drawing.Size(557, 40); this.lblTitle.TabIndex = 6; this.lblTitle.Text = "注册页面"; this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -65,12 +66,13 @@ this.tableLayoutPanel1.Controls.Add(this.btnCancel, 1, 0); this.tableLayoutPanel1.Controls.Add(this.btnOK, 0, 0); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 458); + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 306); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 101F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(835, 101); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 67F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(557, 67); this.tableLayoutPanel1.TabIndex = 7; // // btnCancel @@ -89,12 +91,12 @@ this.btnCancel.IsRadius = false; this.btnCancel.IsShowRect = false; this.btnCancel.IsShowTips = false; - this.btnCancel.Location = new System.Drawing.Point(417, 0); + this.btnCancel.Location = new System.Drawing.Point(278, 0); this.btnCancel.Margin = new System.Windows.Forms.Padding(0); this.btnCancel.Name = "btnCancel"; this.btnCancel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.btnCancel.RectWidth = 1; - this.btnCancel.Size = new System.Drawing.Size(418, 101); + this.btnCancel.Size = new System.Drawing.Size(279, 67); this.btnCancel.TabIndex = 2; this.btnCancel.TabStop = false; this.btnCancel.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99))))); @@ -122,7 +124,7 @@ this.btnOK.Name = "btnOK"; this.btnOK.RectColor = System.Drawing.SystemColors.Control; this.btnOK.RectWidth = 1; - this.btnOK.Size = new System.Drawing.Size(417, 101); + this.btnOK.Size = new System.Drawing.Size(278, 67); this.btnOK.TabIndex = 1; this.btnOK.TabStop = false; this.btnOK.TipsColor = System.Drawing.SystemColors.Control; @@ -140,18 +142,20 @@ this.panel1.Controls.Add(this.ucTextBoxPwd); this.panel1.Controls.Add(this.ucTextBoxUser); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(0, 60); + this.panel1.Location = new System.Drawing.Point(0, 40); + this.panel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(835, 398); + this.panel1.Size = new System.Drawing.Size(557, 266); this.panel1.TabIndex = 8; // // label5 // this.label5.AutoSize = true; this.label5.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label5.Location = new System.Drawing.Point(199, 218); + this.label5.Location = new System.Drawing.Point(133, 145); + this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(99, 41); + this.label5.Size = new System.Drawing.Size(69, 30); this.label5.TabIndex = 12; this.label5.Text = "级 别:"; // @@ -160,9 +164,10 @@ this.label4.AutoSize = true; this.label4.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label4.ForeColor = System.Drawing.Color.OrangeRed; - this.label4.Location = new System.Drawing.Point(678, 133); + this.label4.Location = new System.Drawing.Point(453, 88); + this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(122, 41); + this.label4.Size = new System.Drawing.Size(84, 30); this.label4.TabIndex = 11; this.label4.Text = "用户名:"; // @@ -171,9 +176,10 @@ this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label3.ForeColor = System.Drawing.Color.OrangeRed; - this.label3.Location = new System.Drawing.Point(679, 59); + this.label3.Location = new System.Drawing.Point(453, 39); + this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(122, 41); + this.label3.Size = new System.Drawing.Size(84, 30); this.label3.TabIndex = 10; this.label3.Text = "用户名:"; // @@ -181,9 +187,10 @@ // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(199, 133); + this.label2.Location = new System.Drawing.Point(133, 89); + this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(99, 41); + this.label2.Size = new System.Drawing.Size(69, 30); this.label2.TabIndex = 9; this.label2.Text = "密 码:"; // @@ -191,9 +198,10 @@ // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label1.Location = new System.Drawing.Point(199, 59); + this.label1.Location = new System.Drawing.Point(133, 39); + this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(122, 41); + this.label1.Size = new System.Drawing.Size(84, 30); this.label1.TabIndex = 8; this.label1.Text = "用户名:"; // @@ -210,17 +218,16 @@ this.ucCombox1.IsShowRect = true; this.ucCombox1.ItemHeight = 35; this.ucCombox1.ItemWidth = 70; - this.ucCombox1.Location = new System.Drawing.Point(352, 220); - this.ucCombox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.ucCombox1.Location = new System.Drawing.Point(235, 147); this.ucCombox1.Name = "ucCombox1"; - this.ucCombox1.Padding = new System.Windows.Forms.Padding(2); + this.ucCombox1.Padding = new System.Windows.Forms.Padding(1, 1, 1, 1); this.ucCombox1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); this.ucCombox1.RectWidth = 1; this.ucCombox1.SelectedIndex = -1; this.ucCombox1.SelectedValue = ""; this.ucCombox1.SelectItemColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.ucCombox1.SelectItemForeColor = System.Drawing.Color.White; - this.ucCombox1.Size = new System.Drawing.Size(322, 44); + this.ucCombox1.Size = new System.Drawing.Size(215, 29); this.ucCombox1.Source = null; this.ucCombox1.TabIndex = 7; this.ucCombox1.TextValue = null; @@ -245,8 +252,7 @@ this.ucTextBoxPwd.IsShowRect = true; this.ucTextBoxPwd.IsShowSearchBtn = false; this.ucTextBoxPwd.KeyBoardType = HZH_Controls.Controls.KeyBoardType.UCKeyBorderAll_EN; - this.ucTextBoxPwd.Location = new System.Drawing.Point(352, 133); - this.ucTextBoxPwd.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.ucTextBoxPwd.Location = new System.Drawing.Point(235, 89); this.ucTextBoxPwd.MaxValue = new decimal(new int[] { 1000000, 0, @@ -258,7 +264,7 @@ 0, -2147483648}); this.ucTextBoxPwd.Name = "ucTextBoxPwd"; - this.ucTextBoxPwd.Padding = new System.Windows.Forms.Padding(5); + this.ucTextBoxPwd.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); this.ucTextBoxPwd.PasswordChar = '*'; this.ucTextBoxPwd.PromptColor = System.Drawing.Color.Gray; this.ucTextBoxPwd.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); @@ -266,7 +272,7 @@ this.ucTextBoxPwd.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); this.ucTextBoxPwd.RectWidth = 1; this.ucTextBoxPwd.RegexPattern = ""; - this.ucTextBoxPwd.Size = new System.Drawing.Size(322, 42); + this.ucTextBoxPwd.Size = new System.Drawing.Size(215, 28); this.ucTextBoxPwd.TabIndex = 6; this.ucTextBoxPwd.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; // @@ -289,8 +295,7 @@ this.ucTextBoxUser.IsShowRect = true; this.ucTextBoxUser.IsShowSearchBtn = false; this.ucTextBoxUser.KeyBoardType = HZH_Controls.Controls.KeyBoardType.UCKeyBorderAll_EN; - this.ucTextBoxUser.Location = new System.Drawing.Point(352, 59); - this.ucTextBoxUser.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.ucTextBoxUser.Location = new System.Drawing.Point(235, 39); this.ucTextBoxUser.MaxValue = new decimal(new int[] { 1000000, 0, @@ -302,7 +307,7 @@ 0, -2147483648}); this.ucTextBoxUser.Name = "ucTextBoxUser"; - this.ucTextBoxUser.Padding = new System.Windows.Forms.Padding(5); + this.ucTextBoxUser.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); this.ucTextBoxUser.PasswordChar = '\0'; this.ucTextBoxUser.PromptColor = System.Drawing.Color.Gray; this.ucTextBoxUser.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); @@ -310,18 +315,19 @@ this.ucTextBoxUser.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); this.ucTextBoxUser.RectWidth = 1; this.ucTextBoxUser.RegexPattern = ""; - this.ucTextBoxUser.Size = new System.Drawing.Size(322, 42); + this.ucTextBoxUser.Size = new System.Drawing.Size(215, 28); this.ucTextBoxUser.TabIndex = 5; this.ucTextBoxUser.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; // // FormRegister // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(835, 559); + this.ClientSize = new System.Drawing.Size(557, 373); this.Controls.Add(this.panel1); this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.lblTitle); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.Name = "FormRegister"; this.Text = "注册页面"; this.tableLayoutPanel1.ResumeLayout(false); diff --git a/RfidWeb/Frm/FormRegister.cs b/RfidWeb/Frm/FormRegister.cs index bc15fd8..e977247 100644 --- a/RfidWeb/Frm/FormRegister.cs +++ b/RfidWeb/Frm/FormRegister.cs @@ -15,12 +15,13 @@ using NewLife; using NewLife.Data; using Tool; +using Tool.Model; namespace RfidWeb.Frm { public partial class FormRegister : Form { - private readonly string Kes = "nodyang"; + private readonly string Kes = CacheKeyManager.AesPwd; private RoleService roleService = new RoleService(); private UserService userService = new UserService(); private long id = 0; diff --git a/RfidWeb/UserManager.cs b/RfidWeb/UserManager.cs index 93de2e0..c9d50b9 100644 --- a/RfidWeb/UserManager.cs +++ b/RfidWeb/UserManager.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using DB.Dto; +using Tool.Model; namespace RfidWeb { @@ -14,7 +15,7 @@ namespace RfidWeb /// public static class UserManager { - private static readonly string key = "HaiWei"; + private static string key => CacheKeyManager.User; private static ICache cache = Cache.Default; public static void Add(UserDto dto) diff --git a/Tool/Model/HmiPoint.cs b/Tool/Model/HmiPoint.cs index 1bd4083..36cea2f 100644 --- a/Tool/Model/HmiPoint.cs +++ b/Tool/Model/HmiPoint.cs @@ -54,4 +54,15 @@ namespace Tool.Model return ls.ToArray(); } } + + + + public class CacheKeyManager + { + public static readonly string UpdateLog = "UpdateLog"; + + public static readonly string User = "HmiUser"; + + public static readonly string AesPwd = "nodyang"; + } }