diff --git a/DB/DB.csproj b/DB/DB.csproj
index 5bb51d0..ac85ca3 100644
--- a/DB/DB.csproj
+++ b/DB/DB.csproj
@@ -103,6 +103,7 @@
+
@@ -113,6 +114,7 @@
+
diff --git a/DB/Entity/AlarmLog.cs b/DB/Entity/AlarmLog.cs
new file mode 100644
index 0000000..5339dd9
--- /dev/null
+++ b/DB/Entity/AlarmLog.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DB.Entity
+{
+ public class AlarmLog: BaseChimsDb
+ {
+ public string ShowTime { get; set; }
+ public string Msg { get; set; }
+ public int Alarm { get; set; }
+ public int Count { get; set; } = 0;
+
+
+ }
+
+ public class AlarmLogView
+ {
+ public long ID { get; set; }
+ public string ShowTime { get; set; }
+ public string Msg { get; set; }
+ public string Alarm { get; set; }
+ public int Count { get; set; } = 0;
+ }
+
+ public class AlarmLogMapper : SystemEntityTypeBuilder
+ {
+ public AlarmLogMapper() : base("AlarmLog")
+ {
+ this.Property(x => x.Msg).HasSize(100);
+ this.Property(x => x.ShowTime).HasSize(100);
+ }
+ }
+}
diff --git a/DB/Service/AlarmLogService.cs b/DB/Service/AlarmLogService.cs
new file mode 100644
index 0000000..f9f27a6
--- /dev/null
+++ b/DB/Service/AlarmLogService.cs
@@ -0,0 +1,122 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Chloe;
+
+using DB.Dto;
+using DB.Entity;
+
+using Tool;
+
+namespace DB.Service
+{
+ public class AlarmLogService
+ {
+
+ public void Insert(string msg, string showTime)
+ {
+ using (var dbContext = DbFactory.GetContext)
+ {
+
+ var entity= dbContext.Query()
+ .Where(x => x.Msg == msg)
+ .Where(x => x.ShowTime == showTime)
+ .OrderByDesc(x => x.ID).FirstOrDefault();
+
+ if (entity == null)
+ {
+ var count = dbContext.Query()
+ .Where(x => x.Msg == msg).Count();
+
+ AlarmLog log = new AlarmLog
+ {
+ Msg = msg,
+ ShowTime = showTime,
+ ID = SnowflakeFactory.NewId,
+ Count = count+1
+ };
+ dbContext.Insert(log);
+
+ }
+ }
+ }
+
+
+ public void Insert(Dictionary dic,int alarm)
+ {
+ using (var dbContext = DbFactory.GetContext)
+ {
+
+ foreach (KeyValuePair keyValuePair in dic)
+ {
+ string msg = keyValuePair.Key;
+ var showTime = keyValuePair.Value.ToFullString();
+
+
+ var entity = dbContext.Query()
+ .Where(x => x.Msg == msg)
+ .Where(x=>x.Alarm == alarm)
+ .Where(x => x.ShowTime == showTime)
+ .OrderByDesc(x => x.ID).FirstOrDefault();
+
+ if (entity == null)
+ {
+ var count = dbContext.Query()
+ .Where(x => x.Msg == msg && x.Alarm==alarm).Count();
+
+ AlarmLog log = new AlarmLog
+ {
+ Alarm = alarm,
+ Msg = msg,
+ ShowTime = showTime,
+ ID = SnowflakeFactory.NewId,
+ Count = count + 1
+ };
+ dbContext.Insert(log);
+
+ }
+ }
+ }
+
+ }
+
+
+ public PagedList GetPagedList(int pageIndex, int pageSize, string key,int alarm)
+ {
+
+
+ PagingResult pagePagingResult;
+ using (var dbContext = DbFactory.GetContext)
+ {
+ pagePagingResult = dbContext.Query()
+ .WhereIf(alarm>0,x=>x.Alarm==alarm)
+ .WhereIf(!string.IsNullOrEmpty(key), x => x.Msg.Contains(key))
+ .OrderByDesc(x => x.ID)
+ .Paging(pageIndex, pageSize);
+
+
+ }
+
+ var ls = new List(pagePagingResult.DataList.Count);
+ foreach (var alarmLog in pagePagingResult.DataList)
+ {
+ ls.Add(new AlarmLogView()
+ {
+ Alarm = alarmLog.Alarm==1?"警告":"提醒",
+ ID = alarmLog.ID,
+ Count = alarmLog.Count,
+ Msg = alarmLog.Msg,
+ ShowTime = alarmLog.ShowTime
+ });
+ }
+
+
+ PagedList paged = new PagedList(ls, pagePagingResult.Totals.ToInt(), pageIndex, pageSize);
+
+ return paged;
+
+ }
+ }
+}
diff --git a/DB/Service/UserService.cs b/DB/Service/UserService.cs
index 0b0fa6c..cb4a137 100644
--- a/DB/Service/UserService.cs
+++ b/DB/Service/UserService.cs
@@ -232,7 +232,17 @@ namespace DB.Service
}
-
+ public List GetAllNameByRoleId(long rId)
+ {
+ using (var dbContext = DbFactory.GetContext)
+ {
+ return dbContext.Query()
+ .Where(x=>x.RoleId==rId)
+ .Select(x => x.UserName).ToList();
+ }
+ }
+
+
}
diff --git a/RfidWeb/FormLogin.Designer.cs b/RfidWeb/FormLogin.Designer.cs
index 891c521..6bf9081 100644
--- a/RfidWeb/FormLogin.Designer.cs
+++ b/RfidWeb/FormLogin.Designer.cs
@@ -37,6 +37,8 @@
this.comboPwd = new HZH_Controls.Controls.TextBoxEx();
this.comboUser = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.comboBox1 = new System.Windows.Forms.ComboBox();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
@@ -47,14 +49,15 @@
this.panel1.Controls.Add(this.panel2);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
- this.panel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(878, 428);
+ this.panel1.Size = new System.Drawing.Size(585, 285);
this.panel1.TabIndex = 0;
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.White;
+ this.panel2.Controls.Add(this.label3);
+ this.panel2.Controls.Add(this.comboBox1);
this.panel2.Controls.Add(this.pictureBox1);
this.panel2.Controls.Add(this.button2);
this.panel2.Controls.Add(this.button1);
@@ -64,29 +67,26 @@
this.panel2.Controls.Add(this.label2);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(0, 0);
- this.panel2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(878, 428);
+ this.panel2.Size = new System.Drawing.Size(585, 285);
this.panel2.TabIndex = 2;
this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint);
//
// pictureBox1
//
this.pictureBox1.Image = global::RfidWeb.Properties.Resources.海威图标在上;
- this.pictureBox1.Location = new System.Drawing.Point(40, 39);
- this.pictureBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.pictureBox1.Location = new System.Drawing.Point(12, 12);
this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(404, 350);
+ this.pictureBox1.Size = new System.Drawing.Size(306, 247);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 6;
this.pictureBox1.TabStop = false;
//
// button2
//
- this.button2.Location = new System.Drawing.Point(688, 274);
- this.button2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.button2.Location = new System.Drawing.Point(459, 183);
this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(134, 66);
+ this.button2.Size = new System.Drawing.Size(89, 44);
this.button2.TabIndex = 5;
this.button2.Text = "取消";
this.button2.UseVisualStyleBackColor = true;
@@ -94,10 +94,9 @@
//
// button1
//
- this.button1.Location = new System.Drawing.Point(501, 274);
- this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.button1.Location = new System.Drawing.Point(334, 183);
this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(136, 66);
+ this.button1.Size = new System.Drawing.Size(91, 44);
this.button1.TabIndex = 4;
this.button1.Text = "登录";
this.button1.UseVisualStyleBackColor = true;
@@ -107,10 +106,9 @@
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label1.Location = new System.Drawing.Point(486, 104);
- this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.label1.Location = new System.Drawing.Point(324, 72);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(118, 24);
+ this.label1.Size = new System.Drawing.Size(79, 16);
this.label1.TabIndex = 0;
this.label1.Text = "登录用户:";
//
@@ -118,8 +116,7 @@
//
this.comboPwd.DecLength = 2;
this.comboPwd.InputType = HZH_Controls.TextInputType.NotControl;
- this.comboPwd.Location = new System.Drawing.Point(614, 189);
- this.comboPwd.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.comboPwd.Location = new System.Drawing.Point(409, 120);
this.comboPwd.MaxValue = new decimal(new int[] {
20,
0,
@@ -138,7 +135,7 @@
this.comboPwd.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.comboPwd.PromptText = "";
this.comboPwd.RegexPattern = "";
- this.comboPwd.Size = new System.Drawing.Size(206, 28);
+ this.comboPwd.Size = new System.Drawing.Size(139, 21);
this.comboPwd.TabIndex = 3;
this.comboPwd.KeyDown += new System.Windows.Forms.KeyEventHandler(this.comboPwd_KeyDown);
//
@@ -146,30 +143,47 @@
//
this.comboUser.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.comboUser.FormattingEnabled = true;
- this.comboUser.Location = new System.Drawing.Point(614, 99);
- this.comboUser.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.comboUser.Location = new System.Drawing.Point(409, 69);
this.comboUser.Name = "comboUser";
- this.comboUser.Size = new System.Drawing.Size(206, 32);
+ this.comboUser.Size = new System.Drawing.Size(139, 24);
this.comboUser.TabIndex = 1;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.label2.Location = new System.Drawing.Point(486, 189);
- this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.label2.Location = new System.Drawing.Point(324, 120);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(118, 24);
+ this.label2.Size = new System.Drawing.Size(79, 16);
this.label2.TabIndex = 2;
this.label2.Text = "登录密码:";
//
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.label3.Location = new System.Drawing.Point(324, 26);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(79, 16);
+ this.label3.TabIndex = 7;
+ this.label3.Text = "登录级别:";
+ //
+ // comboBox1
+ //
+ this.comboBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.comboBox1.FormattingEnabled = true;
+ this.comboBox1.Location = new System.Drawing.Point(409, 23);
+ this.comboBox1.Name = "comboBox1";
+ this.comboBox1.Size = new System.Drawing.Size(139, 24);
+ this.comboBox1.TabIndex = 8;
+ this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
+ //
// FormLogin
//
- 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(878, 428);
+ this.ClientSize = new System.Drawing.Size(585, 285);
this.Controls.Add(this.panel1);
- this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Name = "FormLogin";
this.Text = "登录窗口";
this.panel1.ResumeLayout(false);
@@ -191,5 +205,7 @@
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.PictureBox pictureBox1;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.ComboBox comboBox1;
}
}
\ No newline at end of file
diff --git a/RfidWeb/FormLogin.cs b/RfidWeb/FormLogin.cs
index 423739c..8fef9c9 100644
--- a/RfidWeb/FormLogin.cs
+++ b/RfidWeb/FormLogin.cs
@@ -13,8 +13,10 @@ using DB.Service;
using HZH_Controls.Forms;
using NewLife;
using NewLife.Caching;
+using Tool;
using Tool.Model;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
namespace RfidWeb
@@ -22,12 +24,34 @@ namespace RfidWeb
public partial class FormLogin : Form
{
private UserService userService = new UserService();
-
+
+ private RoleService roleService = new RoleService();
+
+
public FormLogin()
{
InitializeComponent();
- comboUser.Items.AddRange(userService.GetAllName().ToArray());
+
+ var readOnlyCollection = roleService.GetList();
+ List- lsList = readOnlyCollection.Select(x => new Item()
+ {
+ Id = x.ID,
+ Name = x.RoleName
+ }).ToList();
+
+ comboBox1.DataSource=lsList;
+ comboBox1.DisplayMember = "Name";
+ comboBox1.ValueMember = "Id";
+
+ comboBox1.SelectedIndex = 0;
+
+ var obj= comboBox1.SelectedValue;
+
+ var allName = userService.GetAllNameByRoleId(obj.ToLong());
+ comboUser.Items.Clear();
+
+ comboUser.Items.AddRange(allName.ToArray());
if (comboUser.Items.Count > 0)
{
comboUser.SelectedIndex = 0;
@@ -50,7 +74,7 @@ namespace RfidWeb
var pwd=this.comboPwd.Text;
if (pwd.Trim().Length == 0)
{
- FrmDialog.ShowDialog(this, "请输入密码?", "警告窗体", false);
+ FrmDialog.ShowDialog(this, "请输入密码", "警告窗体", false);
return;
}
@@ -58,7 +82,7 @@ namespace RfidWeb
var one= userService.GetOne(userName, pwd);
if (one == null)
{
- FrmDialog.ShowDialog(this, "用户和密码错误 请核对?", "警告窗体", false);
+ FrmDialog.ShowDialog(this, "用户和密码错误 请核对", "警告窗体", false);
this.comboPwd.Text = "";
return;
}
@@ -84,5 +108,16 @@ namespace RfidWeb
{
}
+
+ private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
+ {
+
+ var obj = comboBox1.SelectedValue;
+
+ var allName = userService.GetAllNameByRoleId(obj.ToLong());
+ comboUser.Items.Clear();
+ comboUser.Items.AddRange(allName.ToArray());
+ comboUser.SelectedIndex = 0;
+ }
}
}
diff --git a/RfidWeb/FormMain.Designer.cs b/RfidWeb/FormMain.Designer.cs
index 52cac54..7288997 100644
--- a/RfidWeb/FormMain.Designer.cs
+++ b/RfidWeb/FormMain.Designer.cs
@@ -34,6 +34,7 @@
this.panContent = new System.Windows.Forms.Panel();
this.panel9 = new System.Windows.Forms.Panel();
this.panel8 = new System.Windows.Forms.Panel();
+ this.hslLanternSimplePlc = new HslControls.HslLanternSimple();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.btnShow = new System.Windows.Forms.Button();
@@ -43,10 +44,12 @@
this.btnAlarm = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.btnArgument = new System.Windows.Forms.Button();
- this.btnMain = new System.Windows.Forms.Button();
this.panel2 = new System.Windows.Forms.Panel();
+ this.label3 = new System.Windows.Forms.Label();
+ this.labUser = new System.Windows.Forms.Label();
+ this.labTime = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
- this.hslLanternSimplePlc = new HslControls.HslLanternSimple();
this.panel1.SuspendLayout();
this.panel6.SuspendLayout();
this.panel7.SuspendLayout();
@@ -118,7 +121,6 @@
this.panel8.Controls.Add(this.btnAlarm);
this.panel8.Controls.Add(this.btnExit);
this.panel8.Controls.Add(this.btnArgument);
- this.panel8.Controls.Add(this.btnMain);
this.panel8.Dock = System.Windows.Forms.DockStyle.Left;
this.panel8.Location = new System.Drawing.Point(0, 0);
this.panel8.Margin = new System.Windows.Forms.Padding(4);
@@ -126,16 +128,24 @@
this.panel8.Size = new System.Drawing.Size(370, 954);
this.panel8.TabIndex = 3;
//
+ // hslLanternSimplePlc
+ //
+ this.hslLanternSimplePlc.Location = new System.Drawing.Point(22, 536);
+ this.hslLanternSimplePlc.Name = "hslLanternSimplePlc";
+ this.hslLanternSimplePlc.Size = new System.Drawing.Size(78, 94);
+ this.hslLanternSimplePlc.TabIndex = 10;
+ this.hslLanternSimplePlc.Text = "Plc指示灯";
+ //
// button2
//
this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(182)))), ((int)(((byte)(173)))));
this.button2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.button2.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button2.ForeColor = System.Drawing.SystemColors.Window;
- this.button2.Location = new System.Drawing.Point(22, 420);
+ this.button2.Location = new System.Drawing.Point(22, 449);
this.button2.Margin = new System.Windows.Forms.Padding(4);
this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(300, 50);
+ this.button2.Size = new System.Drawing.Size(300, 65);
this.button2.TabIndex = 9;
this.button2.Text = "扫码设置";
this.button2.UseVisualStyleBackColor = false;
@@ -146,10 +156,10 @@
this.button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.button1.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.ForeColor = System.Drawing.SystemColors.Window;
- this.button1.Location = new System.Drawing.Point(22, 362);
+ this.button1.Location = new System.Drawing.Point(22, 376);
this.button1.Margin = new System.Windows.Forms.Padding(4);
this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(300, 50);
+ this.button1.Size = new System.Drawing.Size(300, 65);
this.button1.TabIndex = 8;
this.button1.Text = "打印设置";
this.button1.UseVisualStyleBackColor = false;
@@ -163,7 +173,7 @@
this.btnShow.Location = new System.Drawing.Point(22, 14);
this.btnShow.Margin = new System.Windows.Forms.Padding(4);
this.btnShow.Name = "btnShow";
- this.btnShow.Size = new System.Drawing.Size(300, 50);
+ this.btnShow.Size = new System.Drawing.Size(300, 65);
this.btnShow.TabIndex = 7;
this.btnShow.Text = "总览图";
this.btnShow.UseVisualStyleBackColor = false;
@@ -190,7 +200,7 @@
this.btnMes.Location = new System.Drawing.Point(22, 304);
this.btnMes.Margin = new System.Windows.Forms.Padding(4);
this.btnMes.Name = "btnMes";
- this.btnMes.Size = new System.Drawing.Size(300, 50);
+ this.btnMes.Size = new System.Drawing.Size(300, 65);
this.btnMes.TabIndex = 4;
this.btnMes.Text = "生产计划";
this.btnMes.UseVisualStyleBackColor = false;
@@ -201,10 +211,10 @@
this.btnAccount.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btnAccount.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnAccount.ForeColor = System.Drawing.SystemColors.Window;
- this.btnAccount.Location = new System.Drawing.Point(22, 246);
+ this.btnAccount.Location = new System.Drawing.Point(22, 231);
this.btnAccount.Margin = new System.Windows.Forms.Padding(4);
this.btnAccount.Name = "btnAccount";
- this.btnAccount.Size = new System.Drawing.Size(300, 50);
+ this.btnAccount.Size = new System.Drawing.Size(300, 65);
this.btnAccount.TabIndex = 3;
this.btnAccount.Text = "账户管理";
this.btnAccount.UseVisualStyleBackColor = false;
@@ -216,10 +226,10 @@
this.btnAlarm.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btnAlarm.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnAlarm.ForeColor = System.Drawing.SystemColors.Window;
- this.btnAlarm.Location = new System.Drawing.Point(22, 188);
+ this.btnAlarm.Location = new System.Drawing.Point(22, 160);
this.btnAlarm.Margin = new System.Windows.Forms.Padding(4);
this.btnAlarm.Name = "btnAlarm";
- this.btnAlarm.Size = new System.Drawing.Size(300, 50);
+ this.btnAlarm.Size = new System.Drawing.Size(300, 65);
this.btnAlarm.TabIndex = 3;
this.btnAlarm.Text = "报警记录";
this.btnAlarm.UseVisualStyleBackColor = false;
@@ -244,35 +254,24 @@
this.btnArgument.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btnArgument.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnArgument.ForeColor = System.Drawing.SystemColors.Window;
- this.btnArgument.Location = new System.Drawing.Point(22, 130);
+ this.btnArgument.Location = new System.Drawing.Point(22, 87);
this.btnArgument.Margin = new System.Windows.Forms.Padding(4);
this.btnArgument.Name = "btnArgument";
- this.btnArgument.Size = new System.Drawing.Size(300, 50);
+ this.btnArgument.Size = new System.Drawing.Size(300, 65);
this.btnArgument.TabIndex = 1;
this.btnArgument.Text = "参数界面";
this.btnArgument.UseVisualStyleBackColor = false;
this.btnArgument.Click += new System.EventHandler(this.btnArgument_Click);
//
- // btnMain
- //
- this.btnMain.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(182)))), ((int)(((byte)(173)))));
- this.btnMain.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
- this.btnMain.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.btnMain.ForeColor = System.Drawing.SystemColors.Window;
- this.btnMain.Location = new System.Drawing.Point(22, 72);
- this.btnMain.Margin = new System.Windows.Forms.Padding(4);
- this.btnMain.Name = "btnMain";
- this.btnMain.Size = new System.Drawing.Size(300, 50);
- this.btnMain.TabIndex = 0;
- this.btnMain.Text = "首页";
- this.btnMain.UseVisualStyleBackColor = false;
- this.btnMain.Click += new System.EventHandler(this.btnMain_Click);
- //
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Transparent;
this.panel2.BackgroundImage = global::RfidWeb.Properties.Resources._2024_11_12_170754_114;
this.panel2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.panel2.Controls.Add(this.label3);
+ this.panel2.Controls.Add(this.labUser);
+ this.panel2.Controls.Add(this.labTime);
+ this.panel2.Controls.Add(this.label2);
this.panel2.Controls.Add(this.label1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Font = new System.Drawing.Font("新宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -281,6 +280,51 @@
this.panel2.Size = new System.Drawing.Size(1280, 70);
this.panel2.TabIndex = 0;
//
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Font = new System.Drawing.Font("新宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.label3.ForeColor = System.Drawing.SystemColors.Window;
+ this.label3.Location = new System.Drawing.Point(884, 44);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(139, 20);
+ this.label3.TabIndex = 4;
+ this.label3.Text = "当前运行时间:";
+ //
+ // labUser
+ //
+ this.labUser.AutoSize = true;
+ this.labUser.Font = new System.Drawing.Font("新宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.labUser.ForeColor = System.Drawing.SystemColors.Window;
+ this.labUser.Location = new System.Drawing.Point(1053, 19);
+ this.labUser.Name = "labUser";
+ this.labUser.Size = new System.Drawing.Size(149, 20);
+ this.labUser.TabIndex = 3;
+ this.labUser.Text = "未登录(未授权)";
+ this.labUser.Click += new System.EventHandler(this.labUser_Click);
+ //
+ // labTime
+ //
+ this.labTime.AutoSize = true;
+ this.labTime.Font = new System.Drawing.Font("新宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.labTime.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(182)))), ((int)(((byte)(173)))));
+ this.labTime.Location = new System.Drawing.Point(1053, 44);
+ this.labTime.Name = "labTime";
+ this.labTime.Size = new System.Drawing.Size(199, 20);
+ this.labTime.TabIndex = 2;
+ this.labTime.Text = "2024/11/12 09:30:23";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Font = new System.Drawing.Font("新宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.label2.ForeColor = System.Drawing.SystemColors.Window;
+ this.label2.Location = new System.Drawing.Point(884, 19);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(139, 20);
+ this.label2.TabIndex = 1;
+ this.label2.Text = "当前登录用户:";
+ //
// label1
//
this.label1.AutoSize = true;
@@ -292,14 +336,6 @@
this.label1.TabIndex = 0;
this.label1.Text = "佳通RFID层合裁切设备";
//
- // hslLanternSimplePlc
- //
- this.hslLanternSimplePlc.Location = new System.Drawing.Point(22, 515);
- this.hslLanternSimplePlc.Name = "hslLanternSimplePlc";
- this.hslLanternSimplePlc.Size = new System.Drawing.Size(78, 94);
- this.hslLanternSimplePlc.TabIndex = 10;
- this.hslLanternSimplePlc.Text = "Plc指示灯";
- //
// FormMain
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -326,7 +362,6 @@
private System.Windows.Forms.Button btnAlarm;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.Button btnArgument;
- private System.Windows.Forms.Button btnMain;
private System.Windows.Forms.Panel panel7;
private System.Windows.Forms.Panel panContent;
private System.Windows.Forms.Panel panel9;
@@ -337,5 +372,9 @@
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private HslControls.HslLanternSimple hslLanternSimplePlc;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label labTime;
+ private System.Windows.Forms.Label labUser;
+ private System.Windows.Forms.Label label3;
}
}
\ No newline at end of file
diff --git a/RfidWeb/FormMain.cs b/RfidWeb/FormMain.cs
index 1c506f0..6069f33 100644
--- a/RfidWeb/FormMain.cs
+++ b/RfidWeb/FormMain.cs
@@ -1,25 +1,22 @@
-using HslCommunication.LogNet;
+using DB;
+using DB.Entity;
+using DB.Service;
+
+using HslCommunication.LogNet;
+
using HZH_Controls.Forms;
+using NewLife.Caching;
using NewLife.Threading;
+using RfidWeb.Frm;
+
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
-using RfidWeb.Frm;
+
using Tool;
-using System.Security.Principal;
-using DB.Entity;
-using DB;
-using System.Threading;
-using DB.Service;
-using NewLife.Caching;
using Tool.Model;
namespace RfidWeb
@@ -61,10 +58,10 @@ namespace RfidWeb
Console.WriteLine(e.HslMessage.ToString());
};
logNet.ConsoleOutput = true;
- logNet.WriteInfo("nihao");
+
buttons.Clear();
buttons.Add(btnShow);
- buttons.Add(btnMain);
+
buttons.Add(btnArgument);
buttons.Add(btnAlarm);
buttons.Add(btnAccount);
@@ -79,9 +76,29 @@ namespace RfidWeb
/// 移除过期的缓存项
void TimeState(Object state)
{
- var dataTime = DateTime.Now;
+ bool isExit = UserManager.IsExit();
this.Invoke(() =>
{
+
+ labTime.Text = DateTime.Now.ToFullString();
+
+
+ this.Invoke(() =>
+ {
+ //不存在
+ if (!isExit)
+ {
+ labUser.ForeColor= System.Drawing.SystemColors.Window;
+ labUser.Text = "未登录(未授权)";
+ }
+ else
+ {
+ var dto = UserManager.GetUser();
+ labUser.Text = $"{dto.UserName}({dto.RoleName})";
+ labUser.ForeColor = Color.FromArgb(21, 182, 173);
+ }
+ });
+
});
ThreadPoolX.QueueUserWorkItem(UpdateLog);
@@ -92,25 +109,29 @@ namespace RfidWeb
private void UpdateLog()
{
- if(cache.ContainsKey(CacheKeyManager.UpdateLog)) return;
- cache.Set(CacheKeyManager.UpdateLog, DateTime.Now, TimeSpan.FromSeconds(5));
- var plc = PlcConnect.Instance;
- var userDto = TestFactory.TestUser();
+ if (UserManager.IsExit())
+ {
- var strings = HmiPoint.GetValue();
+ if (cache.ContainsKey(CacheKeyManager.UpdateLog)) return;
+ cache.Set(CacheKeyManager.UpdateLog, DateTime.Now, TimeSpan.FromSeconds(5));
+ var plc = PlcConnect.Instance;
+ var userDto = TestFactory.TestUser();
- foreach (var se in strings)
- {
- var res = plc.ReadUInt32(se);
- if (res.IsSuccess)
+ var strings = HmiPoint.GetValue();
+
+ foreach (var se in strings)
{
- updateLogService.AddOrUpdateLog(userDto, se, res.Content);
+ var res = plc.ReadUInt32(se);
+ if (res.IsSuccess)
+ {
+ updateLogService.AddOrUpdateLog(userDto, se, res.Content);
+ }
}
- }
- cache.Remove(CacheKeyManager.UpdateLog);
+ cache.Remove(CacheKeyManager.UpdateLog);
+ }
}
@@ -140,15 +161,9 @@ namespace RfidWeb
{
//FormPar
- bool isLogin = UserManager.IsExit();
- if (!isLogin)
- {
- FormLogin loigLogin = new FormLogin();
- loigLogin.StartPosition = FormStartPosition.CenterScreen; // 设置窗口显示在屏幕中央
- loigLogin.ShowDialog();
- }
- isLogin = UserManager.IsExit();
+ CheckLogin();
+ var isLogin = UserManager.IsExit();
if (isLogin)
{
panContent.Controls.Clear();
@@ -157,7 +172,8 @@ namespace RfidWeb
}
}
- private void btnAlarm_Click(object sender, EventArgs e)
+
+ private void CheckLogin()
{
bool isLogin = UserManager.IsExit();
if (!isLogin)
@@ -166,13 +182,18 @@ namespace RfidWeb
loigLogin.StartPosition = FormStartPosition.CenterScreen; // 设置窗口显示在屏幕中央
loigLogin.ShowDialog();
}
+ }
+
+ private void btnAlarm_Click(object sender, EventArgs e)
+ {
+ CheckLogin();
- isLogin = UserManager.IsExit();
+ var isLogin = UserManager.IsExit();
if (isLogin)
{
panContent.Controls.Clear();
- panContent.Controls.Add(new FormAlarm());
-
+ panContent.Controls.Add(new FromAlarmLog());
+ CheckButton(btnAlarm);
}
}
@@ -183,20 +204,13 @@ namespace RfidWeb
///
private void btnAccount_Click(object sender, EventArgs e)
{
- bool isLogin = UserManager.IsExit();
- if (!isLogin)
- {
- FormLogin loigLogin = new FormLogin();
- loigLogin.StartPosition = FormStartPosition.CenterScreen; // 设置窗口显示在屏幕中央
- loigLogin.ShowDialog();
- }
-
- isLogin = UserManager.IsExit();
+ CheckLogin();
+ var isLogin = UserManager.IsExit();
if (isLogin)
{
panContent.Controls.Clear();
panContent.Controls.Add(new FormAccount());
-
+ CheckButton(btnAccount);
}
@@ -217,6 +231,7 @@ namespace RfidWeb
}
}
+ btn.Focus();
btn.BackColor = checkColor;
}
@@ -225,8 +240,20 @@ namespace RfidWeb
panContent.Controls.Clear();
panContent.Controls.Add(new UserAlarmShow());
CheckButton(btnShow);
+
}
-
+ private void labUser_Click(object sender, EventArgs e)
+ {
+ if (labUser.Text != "未登录(未授权)")
+ {
+ if (FrmDialog.ShowDialog(this, "退出登录", "提示窗体", true)
+ == System.Windows.Forms.DialogResult.OK)
+ {
+ cache.Remove(CacheKeyManager.User);
+ btnShow_Click(new object(), EventArgs.Empty);
+ }
+ }
+ }
}
}
diff --git a/RfidWeb/Frm/FormAccount.Designer.cs b/RfidWeb/Frm/FormAccount.Designer.cs
index 210355e..c277209 100644
--- a/RfidWeb/Frm/FormAccount.Designer.cs
+++ b/RfidWeb/Frm/FormAccount.Designer.cs
@@ -29,6 +29,9 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormAccount));
+ 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();
this.panelTop = new System.Windows.Forms.Panel();
this.ucBtnDel = new HZH_Controls.Controls.UCBtnExt();
this.ucBtnUpdate = new HZH_Controls.Controls.UCBtnExt();
@@ -38,10 +41,14 @@
this.panelBottom = new System.Windows.Forms.Panel();
this.ucPagerControl21 = new HZH_Controls.Controls.UCPagerControl2();
this.panel1 = new System.Windows.Forms.Panel();
- this.ucDataGridViewContent = new HZH_Controls.Controls.UCDataGridView();
+ this.dataGridView1 = new System.Windows.Forms.DataGridView();
+ this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.UserName = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.RoleName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.panelTop.SuspendLayout();
this.panelBottom.SuspendLayout();
this.panel1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
// panelTop
@@ -72,12 +79,12 @@
this.ucBtnDel.IsRadius = true;
this.ucBtnDel.IsShowRect = true;
this.ucBtnDel.IsShowTips = false;
- this.ucBtnDel.Location = new System.Drawing.Point(654, 26);
+ this.ucBtnDel.Location = new System.Drawing.Point(654, 18);
this.ucBtnDel.Margin = new System.Windows.Forms.Padding(0);
this.ucBtnDel.Name = "ucBtnDel";
this.ucBtnDel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(83)))), ((int)(((byte)(171)))));
this.ucBtnDel.RectWidth = 1;
- this.ucBtnDel.Size = new System.Drawing.Size(121, 28);
+ this.ucBtnDel.Size = new System.Drawing.Size(121, 35);
this.ucBtnDel.TabIndex = 5;
this.ucBtnDel.TabStop = false;
this.ucBtnDel.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204)))));
@@ -99,12 +106,12 @@
this.ucBtnUpdate.IsRadius = true;
this.ucBtnUpdate.IsShowRect = true;
this.ucBtnUpdate.IsShowTips = false;
- this.ucBtnUpdate.Location = new System.Drawing.Point(514, 26);
+ this.ucBtnUpdate.Location = new System.Drawing.Point(515, 18);
this.ucBtnUpdate.Margin = new System.Windows.Forms.Padding(0);
this.ucBtnUpdate.Name = "ucBtnUpdate";
this.ucBtnUpdate.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(83)))), ((int)(((byte)(171)))));
this.ucBtnUpdate.RectWidth = 1;
- this.ucBtnUpdate.Size = new System.Drawing.Size(121, 28);
+ this.ucBtnUpdate.Size = new System.Drawing.Size(121, 35);
this.ucBtnUpdate.TabIndex = 4;
this.ucBtnUpdate.TabStop = false;
this.ucBtnUpdate.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204)))));
@@ -126,12 +133,12 @@
this.ucBtnAdd.IsRadius = true;
this.ucBtnAdd.IsShowRect = true;
this.ucBtnAdd.IsShowTips = false;
- this.ucBtnAdd.Location = new System.Drawing.Point(375, 26);
+ this.ucBtnAdd.Location = new System.Drawing.Point(374, 18);
this.ucBtnAdd.Margin = new System.Windows.Forms.Padding(0);
this.ucBtnAdd.Name = "ucBtnAdd";
this.ucBtnAdd.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(83)))), ((int)(((byte)(171)))));
this.ucBtnAdd.RectWidth = 1;
- this.ucBtnAdd.Size = new System.Drawing.Size(121, 28);
+ this.ucBtnAdd.Size = new System.Drawing.Size(121, 35);
this.ucBtnAdd.TabIndex = 3;
this.ucBtnAdd.TabStop = false;
this.ucBtnAdd.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204)))));
@@ -153,12 +160,12 @@
this.ucBtnSelect.IsRadius = true;
this.ucBtnSelect.IsShowRect = true;
this.ucBtnSelect.IsShowTips = false;
- this.ucBtnSelect.Location = new System.Drawing.Point(226, 26);
+ this.ucBtnSelect.Location = new System.Drawing.Point(226, 18);
this.ucBtnSelect.Margin = new System.Windows.Forms.Padding(0);
this.ucBtnSelect.Name = "ucBtnSelect";
this.ucBtnSelect.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(83)))), ((int)(((byte)(171)))));
this.ucBtnSelect.RectWidth = 1;
- this.ucBtnSelect.Size = new System.Drawing.Size(121, 28);
+ this.ucBtnSelect.Size = new System.Drawing.Size(121, 35);
this.ucBtnSelect.TabIndex = 2;
this.ucBtnSelect.TabStop = false;
this.ucBtnSelect.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204)))));
@@ -168,8 +175,9 @@
// textBoxSel
//
this.textBoxSel.DecLength = 2;
+ this.textBoxSel.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.textBoxSel.InputType = HZH_Controls.TextInputType.NotControl;
- this.textBoxSel.Location = new System.Drawing.Point(33, 26);
+ this.textBoxSel.Location = new System.Drawing.Point(32, 18);
this.textBoxSel.MaxValue = new decimal(new int[] {
1000000,
0,
@@ -187,7 +195,7 @@
this.textBoxSel.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.textBoxSel.PromptText = "";
this.textBoxSel.RegexPattern = "";
- this.textBoxSel.Size = new System.Drawing.Size(158, 28);
+ this.textBoxSel.Size = new System.Drawing.Size(158, 30);
this.textBoxSel.TabIndex = 0;
//
// panelBottom
@@ -217,32 +225,77 @@
//
// panel1
//
- this.panel1.Controls.Add(this.ucDataGridViewContent);
+ this.panel1.Controls.Add(this.dataGridView1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 80);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(910, 814);
this.panel1.TabIndex = 4;
//
- // ucDataGridViewContent
+ // dataGridView1
//
- this.ucDataGridViewContent.BackColor = System.Drawing.Color.White;
- this.ucDataGridViewContent.Columns = null;
- this.ucDataGridViewContent.DataSource = null;
- this.ucDataGridViewContent.Dock = System.Windows.Forms.DockStyle.Fill;
- this.ucDataGridViewContent.HeadFont = new System.Drawing.Font("微软雅黑", 12F);
- this.ucDataGridViewContent.HeadHeight = 40;
- this.ucDataGridViewContent.HeadPadingLeft = 0;
- this.ucDataGridViewContent.HeadTextColor = System.Drawing.Color.Black;
- this.ucDataGridViewContent.IsShowCheckBox = false;
- this.ucDataGridViewContent.IsShowHead = true;
- this.ucDataGridViewContent.Location = new System.Drawing.Point(0, 0);
- this.ucDataGridViewContent.Name = "ucDataGridViewContent";
- this.ucDataGridViewContent.Padding = new System.Windows.Forms.Padding(0, 40, 0, 0);
- this.ucDataGridViewContent.RowHeight = 40;
- this.ucDataGridViewContent.RowType = typeof(HZH_Controls.Controls.UCDataGridViewRow);
- this.ucDataGridViewContent.Size = new System.Drawing.Size(910, 814);
- this.ucDataGridViewContent.TabIndex = 0;
+ this.dataGridView1.AllowUserToAddRows = false;
+ this.dataGridView1.AllowUserToDeleteRows = false;
+ dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
+ dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 12F, 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.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
+ this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.ID,
+ this.UserName,
+ this.RoleName});
+ dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window;
+ dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 15F, 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.dataGridView1.DefaultCellStyle = dataGridViewCellStyle2;
+ this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.dataGridView1.Location = new System.Drawing.Point(0, 0);
+ this.dataGridView1.Name = "dataGridView1";
+ this.dataGridView1.ReadOnly = true;
+ dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control;
+ dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 15F, 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.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
+ this.dataGridView1.RowTemplate.Height = 23;
+ this.dataGridView1.Size = new System.Drawing.Size(910, 814);
+ this.dataGridView1.TabIndex = 0;
+ //
+ // ID
+ //
+ this.ID.DataPropertyName = "ID";
+ this.ID.HeaderText = "ID";
+ this.ID.Name = "ID";
+ this.ID.ReadOnly = true;
+ this.ID.Visible = false;
+ //
+ // UserName
+ //
+ this.UserName.DataPropertyName = "UserName";
+ this.UserName.HeaderText = "用户姓名";
+ this.UserName.Name = "UserName";
+ this.UserName.ReadOnly = true;
+ this.UserName.Width = 200;
+ //
+ // RoleName
+ //
+ this.RoleName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.RoleName.DataPropertyName = "RoleName";
+ this.RoleName.HeaderText = "权限";
+ this.RoleName.Name = "RoleName";
+ this.RoleName.ReadOnly = true;
//
// FormAccount
//
@@ -257,6 +310,7 @@
this.panelTop.PerformLayout();
this.panelBottom.ResumeLayout(false);
this.panel1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false);
}
@@ -272,6 +326,9 @@
private HZH_Controls.Controls.UCBtnExt ucBtnDel;
private System.Windows.Forms.Panel panel1;
private HZH_Controls.Controls.UCPagerControl2 ucPagerControl21;
- private HZH_Controls.Controls.UCDataGridView ucDataGridViewContent;
+ private System.Windows.Forms.DataGridView dataGridView1;
+ private System.Windows.Forms.DataGridViewTextBoxColumn ID;
+ private System.Windows.Forms.DataGridViewTextBoxColumn UserName;
+ private System.Windows.Forms.DataGridViewTextBoxColumn RoleName;
}
}
diff --git a/RfidWeb/Frm/FormAccount.cs b/RfidWeb/Frm/FormAccount.cs
index fecc9e1..445fc6b 100644
--- a/RfidWeb/Frm/FormAccount.cs
+++ b/RfidWeb/Frm/FormAccount.cs
@@ -30,15 +30,9 @@ namespace RfidWeb.Frm
private void Init()
{
- List lstCulumns = new List
- {
- new DataGridViewColumnEntity() { DataField = "Id", HeadText = "编号", Width = 100, WidthType = SizeType.Absolute },
- new DataGridViewColumnEntity() { DataField = "UserName", HeadText = "姓名", Width = 50, WidthType = SizeType.Percent },
- new DataGridViewColumnEntity() { DataField = "RoleName", HeadText = "权限名称", Width = 50, WidthType = SizeType.Percent }
- };
- this.ucDataGridViewContent.Columns = lstCulumns;
- this.ucDataGridViewContent.IsShowCheckBox = true;
+ this.dataGridView1.AutoGenerateColumns = false;
+
ucPagerControl21.PageModel = PageModel.PageCount;
ucPagerControl21.PageIndex = 1;
ucPagerControl21.PageSize = 20;
@@ -70,16 +64,7 @@ namespace RfidWeb.Frm
}
var page = userService.GetPagedList(index, ucPagerControl21.PageSize, key,lsInts);
ucPagerControl21.PageCount = page.TotalPages;
- this.ucDataGridViewContent.DataSource = page.Items;
-
- var dataGridViewRows = ucDataGridViewContent.SelectRows;
- foreach (var row in dataGridViewRows)
- {
- if (row.IsChecked)
- {
- row.IsChecked = false;
- }
- }
+ this.dataGridView1.DataSource = page.Items;
}
private void ucBtnSelect_BtnClick(object sender, EventArgs e)
@@ -106,7 +91,7 @@ namespace RfidWeb.Frm
private void ucBtnDel_BtnClick(object sender, EventArgs e)
{
- var dataGridViewRows = ucDataGridViewContent.SelectRows;
+ var dataGridViewRows = this.dataGridView1.SelectedRows;
if (dataGridViewRows.Count == 0)
{
FrmDialog.ShowDialog(this, "请勾选相关信息", "警告窗体");
@@ -114,12 +99,10 @@ namespace RfidWeb.Frm
}
List ls = new List();
- foreach (var dr in dataGridViewRows)
+ foreach (DataGridViewRow dataGridViewRow in dataGridViewRows)
{
- if (dr.DataSource is UserDto dto)
- {
- ls.Add(dto.Id);
- }
+ var obj = dataGridViewRow.DataBoundItem as UserDto;
+ ls.Add(obj.Id);
}
if (ls.Any())
@@ -128,7 +111,7 @@ namespace RfidWeb.Frm
Replace();
}
-
+
}
@@ -136,21 +119,21 @@ namespace RfidWeb.Frm
private void ucBtnUpdate_BtnClick(object sender, EventArgs e)
{
- var dataGridViewRows = ucDataGridViewContent.SelectRows;
- if (dataGridViewRows.Count!=1)
+ var dataGridViewRows = this.dataGridView1.SelectedRows;
+ if (dataGridViewRows.Count != 1)
{
FrmDialog.ShowDialog(this, "只能修改一条", "警告窗体");
return;
}
- var dto = dataGridViewRows.First().DataSource as UserDto;
- FormRegister formRegis = new FormRegister(dto.Id, OlduserDto);
- formRegis.StartPosition = FormStartPosition.CenterScreen; // 设置窗口显示在屏幕中央
- formRegis.ShowDialog();
+ var dto = dataGridViewRows[0].DataBoundItem as UserDto;
+ FormRegister formRegis = new FormRegister(dto.Id, OlduserDto);
+ formRegis.StartPosition = FormStartPosition.CenterScreen; // 设置窗口显示在屏幕中央
+ formRegis.ShowDialog();
-
- Replace();
+
+ Replace();
}
diff --git a/RfidWeb/Frm/FormAccount.resx b/RfidWeb/Frm/FormAccount.resx
index 2411c48..08f3468 100644
--- a/RfidWeb/Frm/FormAccount.resx
+++ b/RfidWeb/Frm/FormAccount.resx
@@ -126,4 +126,13 @@
ZW1zBV9zaXplCF92ZXJzaW9uBQAACAgCAAAACQMAAAAAAAAAAAAAABADAAAAAAAAAAs=
+
+ True
+
+
+ True
+
+
+ True
+
\ No newline at end of file
diff --git a/RfidWeb/Frm/FormAlarm.Designer.cs b/RfidWeb/Frm/FormAlarm.Designer.cs
deleted file mode 100644
index 08e426a..0000000
--- a/RfidWeb/Frm/FormAlarm.Designer.cs
+++ /dev/null
@@ -1,215 +0,0 @@
-namespace RfidWeb.Frm
-{
- partial class FormAlarm
- {
- ///
- /// 必需的设计器变量。
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// 清理所有正在使用的资源。
- ///
- /// 如果应释放托管资源,为 true;否则为 false。
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region 组件设计器生成的代码
-
- ///
- /// 设计器支持所需的方法 - 不要修改
- /// 使用代码编辑器修改此方法的内容。
- ///
- private void InitializeComponent()
- {
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormAlarm));
- this.panel1 = new System.Windows.Forms.Panel();
- this.panelTop = new System.Windows.Forms.Panel();
- this.ucBtnDel = new HZH_Controls.Controls.UCBtnExt();
- this.ucBtnSelect = new HZH_Controls.Controls.UCBtnExt();
- this.textBoxSel = new HZH_Controls.Controls.TextBoxEx();
- this.panel2 = new System.Windows.Forms.Panel();
- this.ucPagerControl21 = new HZH_Controls.Controls.UCPagerControl2();
- this.ucDataGridViewContent = new HZH_Controls.Controls.UCDataGridView();
- this.panel1.SuspendLayout();
- this.panelTop.SuspendLayout();
- this.panel2.SuspendLayout();
- this.SuspendLayout();
- //
- // panel1
- //
- this.panel1.Controls.Add(this.panelTop);
- this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
- this.panel1.Location = new System.Drawing.Point(0, 0);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(910, 80);
- this.panel1.TabIndex = 0;
- //
- // panelTop
- //
- this.panelTop.Controls.Add(this.ucBtnDel);
- this.panelTop.Controls.Add(this.ucBtnSelect);
- this.panelTop.Controls.Add(this.textBoxSel);
- this.panelTop.Dock = System.Windows.Forms.DockStyle.Top;
- this.panelTop.Location = new System.Drawing.Point(0, 0);
- this.panelTop.Name = "panelTop";
- this.panelTop.Size = new System.Drawing.Size(910, 80);
- this.panelTop.TabIndex = 1;
- //
- // ucBtnDel
- //
- this.ucBtnDel.BackColor = System.Drawing.Color.White;
- this.ucBtnDel.BtnBackColor = System.Drawing.Color.White;
- this.ucBtnDel.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.ucBtnDel.BtnForeColor = System.Drawing.Color.White;
- this.ucBtnDel.BtnText = "删除 ";
- this.ucBtnDel.ConerRadius = 5;
- this.ucBtnDel.Cursor = System.Windows.Forms.Cursors.Hand;
- this.ucBtnDel.EnabledMouseEffect = false;
- this.ucBtnDel.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204)))));
- this.ucBtnDel.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
- this.ucBtnDel.IsRadius = true;
- this.ucBtnDel.IsShowRect = true;
- this.ucBtnDel.IsShowTips = false;
- this.ucBtnDel.Location = new System.Drawing.Point(382, 26);
- this.ucBtnDel.Margin = new System.Windows.Forms.Padding(0);
- this.ucBtnDel.Name = "ucBtnDel";
- this.ucBtnDel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(83)))), ((int)(((byte)(171)))));
- this.ucBtnDel.RectWidth = 1;
- this.ucBtnDel.Size = new System.Drawing.Size(121, 28);
- this.ucBtnDel.TabIndex = 5;
- this.ucBtnDel.TabStop = false;
- this.ucBtnDel.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204)))));
- this.ucBtnDel.TipsText = "";
- //
- // ucBtnSelect
- //
- this.ucBtnSelect.BackColor = System.Drawing.Color.White;
- this.ucBtnSelect.BtnBackColor = System.Drawing.Color.White;
- this.ucBtnSelect.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.ucBtnSelect.BtnForeColor = System.Drawing.Color.White;
- this.ucBtnSelect.BtnText = "查询";
- this.ucBtnSelect.ConerRadius = 5;
- this.ucBtnSelect.Cursor = System.Windows.Forms.Cursors.Hand;
- this.ucBtnSelect.EnabledMouseEffect = false;
- this.ucBtnSelect.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204)))));
- this.ucBtnSelect.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
- this.ucBtnSelect.IsRadius = true;
- this.ucBtnSelect.IsShowRect = true;
- this.ucBtnSelect.IsShowTips = false;
- this.ucBtnSelect.Location = new System.Drawing.Point(226, 26);
- this.ucBtnSelect.Margin = new System.Windows.Forms.Padding(0);
- this.ucBtnSelect.Name = "ucBtnSelect";
- this.ucBtnSelect.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(83)))), ((int)(((byte)(171)))));
- this.ucBtnSelect.RectWidth = 1;
- this.ucBtnSelect.Size = new System.Drawing.Size(121, 28);
- this.ucBtnSelect.TabIndex = 2;
- this.ucBtnSelect.TabStop = false;
- this.ucBtnSelect.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(101)))), ((int)(((byte)(204)))));
- this.ucBtnSelect.TipsText = "";
- this.ucBtnSelect.BtnClick += new System.EventHandler(this.ucBtnSelect_BtnClick);
- //
- // textBoxSel
- //
- this.textBoxSel.DecLength = 2;
- this.textBoxSel.InputType = HZH_Controls.TextInputType.NotControl;
- this.textBoxSel.Location = new System.Drawing.Point(33, 26);
- this.textBoxSel.MaxValue = new decimal(new int[] {
- 1000000,
- 0,
- 0,
- 0});
- this.textBoxSel.MinValue = new decimal(new int[] {
- 1000000,
- 0,
- 0,
- -2147483648});
- this.textBoxSel.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
- this.textBoxSel.Name = "textBoxSel";
- this.textBoxSel.OldText = null;
- this.textBoxSel.PromptColor = System.Drawing.Color.Gray;
- this.textBoxSel.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
- this.textBoxSel.PromptText = "";
- this.textBoxSel.RegexPattern = "";
- this.textBoxSel.Size = new System.Drawing.Size(158, 28);
- this.textBoxSel.TabIndex = 0;
- //
- // panel2
- //
- this.panel2.Controls.Add(this.ucPagerControl21);
- this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
- this.panel2.Location = new System.Drawing.Point(0, 894);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(910, 41);
- this.panel2.TabIndex = 1;
- //
- // ucPagerControl21
- //
- this.ucPagerControl21.BackColor = System.Drawing.Color.White;
- this.ucPagerControl21.DataSource = ((System.Collections.Generic.List