From 2dc9f1f0f2f7c7da34ffe93880d5676f287f0cc5 Mon Sep 17 00:00:00 2001 From: "nodyang@aliyun.com" Date: Thu, 24 Oct 2024 14:32:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AD=A6=E5=91=8A=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DB/DB.csproj | 2 + DB/Entity/Point.cs | 16 ++- DB/Service/PointLogService.cs | 31 ++++- RfidWeb/FormMain.cs | 16 ++- RfidWeb/Frm/FormAccount.cs | 42 ++++-- RfidWeb/Frm/FormAlarm.Designer.cs | 215 ++++++++++++++++++++++++++++++ RfidWeb/Frm/FormAlarm.cs | 78 +++++++++++ RfidWeb/Frm/FormAlarm.resx | 129 ++++++++++++++++++ RfidWeb/FromSQl.Designer.cs | 41 +++++- RfidWeb/FromSQl.cs | 178 ++++++++++++++----------- RfidWeb/Program.cs | 3 +- RfidWeb/RfidWeb.csproj | 9 ++ 12 files changed, 656 insertions(+), 104 deletions(-) create mode 100644 RfidWeb/Frm/FormAlarm.Designer.cs create mode 100644 RfidWeb/Frm/FormAlarm.cs create mode 100644 RfidWeb/Frm/FormAlarm.resx diff --git a/DB/DB.csproj b/DB/DB.csproj index c966063..ddce222 100644 --- a/DB/DB.csproj +++ b/DB/DB.csproj @@ -105,11 +105,13 @@ + + diff --git a/DB/Entity/Point.cs b/DB/Entity/Point.cs index 7150e64..d144040 100644 --- a/DB/Entity/Point.cs +++ b/DB/Entity/Point.cs @@ -1,4 +1,6 @@ -namespace DB.Entity +using NewLife.Data; + +namespace DB.Entity { public class Point:BaseChimsDb { @@ -24,4 +26,16 @@ } } + + + public class PointLogMapper : SystemEntityTypeBuilder + { + public PointLogMapper() : base("PointLog") + { + this.Property(x => x.Msg).HasSize(500); + this.Property(x => x.PointAddress).HasSize(10); + this.Property(x => x.PointName).HasSize(10); + } + } + } \ No newline at end of file diff --git a/DB/Service/PointLogService.cs b/DB/Service/PointLogService.cs index a818aba..f509fe8 100644 --- a/DB/Service/PointLogService.cs +++ b/DB/Service/PointLogService.cs @@ -1,7 +1,34 @@ -namespace DB.Service +using Chloe; + +using DB.Entity; + +namespace DB.Service { public class PointLogService { - + + public void Add(PointLog entityLog) + { + using (var dbContext = DbFactory.GetContext) + { + dbContext.Insert(entityLog); + } + } + + + public PagingResult GetPagedList(int pageIndex, int pageSize, string key) + { + + using (var dbContext = DbFactory.GetContext) + { + var dao = dbContext.Query() + .WhereIf(!string.IsNullOrEmpty(key),x=>x.PointName.Contains(key)) + .OrderByDesc(x => x.ID) + .Paging(pageIndex, pageSize); + return dao; + + } + + } } } \ No newline at end of file diff --git a/RfidWeb/FormMain.cs b/RfidWeb/FormMain.cs index 38d52c6..163e9c8 100644 --- a/RfidWeb/FormMain.cs +++ b/RfidWeb/FormMain.cs @@ -124,7 +124,21 @@ namespace RfidWeb private void btnAlarm_Click(object sender, EventArgs e) { - SetBackGroupImage(sender as Button); + bool isLogin = UserManager.IsExit(); + if (!isLogin) + { + FormLogin loigLogin = new FormLogin(); + loigLogin.StartPosition = FormStartPosition.CenterScreen; // 设置窗口显示在屏幕中央 + loigLogin.ShowDialog(); + } + + isLogin = UserManager.IsExit(); + if (isLogin) + { + panContent.Controls.Clear(); + panContent.Controls.Add(new FormAlarm()); + SetBackGroupImage(sender as Button); + } } /// diff --git a/RfidWeb/Frm/FormAccount.cs b/RfidWeb/Frm/FormAccount.cs index 833c2e1..d966e79 100644 --- a/RfidWeb/Frm/FormAccount.cs +++ b/RfidWeb/Frm/FormAccount.cs @@ -42,7 +42,7 @@ namespace RfidWeb.Frm ucPagerControl21.PageModel = PageModel.PageCount; ucPagerControl21.PageIndex = 1; ucPagerControl21.PageSize = 20; - // ucPagerControl21_ShowSourceChanged(new object()); + } @@ -70,15 +70,21 @@ namespace RfidWeb.Frm } var page = userService.GetPagedList(index, ucPagerControl21.PageSize, key,lsInts); ucPagerControl21.PageCount = page.TotalPages; - - this.ucDataGridViewContent.IsShowCheckBox = true; - // this.ucDataGridViewContent.DataSource = null; this.ucDataGridViewContent.DataSource = page.Items; + + var dataGridViewRows = ucDataGridViewContent.SelectRows; + foreach (var row in dataGridViewRows) + { + if (row.IsChecked) + { + row.IsChecked = false; + } + } } private void ucBtnSelect_BtnClick(object sender, EventArgs e) { - ucPagerControl21_ShowSourceChanged(new object()); + Replace(); } private void ucBtnAdd_BtnClick(object sender, EventArgs e) @@ -120,12 +126,7 @@ namespace RfidWeb.Frm if (ls.Any()) { userService.UpdateDel(ls); - - ucPagerControl21.PageIndex = 1; - - this.ucDataGridViewContent.IsShowCheckBox = false; - ucPagerControl21_ShowSourceChanged(new object()); - + Replace(); } @@ -149,10 +150,23 @@ namespace RfidWeb.Frm formRegis.StartPosition = FormStartPosition.CenterScreen; // 设置窗口显示在屏幕中央 formRegis.ShowDialog(); - ucPagerControl21.PageIndex = 1; - this.ucDataGridViewContent.IsShowCheckBox = false; - ucPagerControl21_ShowSourceChanged(new object()); + + Replace(); + + } + private void Replace() + { + ucPagerControl21.PageIndex = 1; + + var dataGridViewRows = ucDataGridViewContent.SelectRows; + foreach (var row in dataGridViewRows) + { + if (row.IsChecked) + { + row.IsChecked = false; + } + } } } } diff --git a/RfidWeb/Frm/FormAlarm.Designer.cs b/RfidWeb/Frm/FormAlarm.Designer.cs new file mode 100644 index 0000000..08e426a --- /dev/null +++ b/RfidWeb/Frm/FormAlarm.Designer.cs @@ -0,0 +1,215 @@ +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)(resources.GetObject("ucPagerControl21.DataSource"))); + this.ucPagerControl21.Dock = System.Windows.Forms.DockStyle.Fill; + this.ucPagerControl21.Location = new System.Drawing.Point(0, 0); + this.ucPagerControl21.Name = "ucPagerControl21"; + this.ucPagerControl21.PageCount = 0; + this.ucPagerControl21.PageIndex = 1; + this.ucPagerControl21.PageModel = HZH_Controls.Controls.PageModel.Soure; + this.ucPagerControl21.PageSize = 10; + this.ucPagerControl21.Size = new System.Drawing.Size(910, 41); + this.ucPagerControl21.StartIndex = 0; + this.ucPagerControl21.TabIndex = 1; + this.ucPagerControl21.ShowSourceChanged += new HZH_Controls.Controls.PageControlEventHandler(this.ucPagerControl21_ShowSourceChanged); + // + // ucDataGridViewContent + // + 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, 80); + 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 = 2; + // + // FormAlarm + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.Controls.Add(this.ucDataGridViewContent); + this.Controls.Add(this.panel2); + this.Controls.Add(this.panel1); + this.Name = "FormAlarm"; + this.Size = new System.Drawing.Size(910, 935); + this.panel1.ResumeLayout(false); + this.panelTop.ResumeLayout(false); + this.panelTop.PerformLayout(); + this.panel2.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Panel panelTop; + private HZH_Controls.Controls.UCBtnExt ucBtnDel; + private HZH_Controls.Controls.UCBtnExt ucBtnSelect; + private HZH_Controls.Controls.TextBoxEx textBoxSel; + private HZH_Controls.Controls.UCPagerControl2 ucPagerControl21; + private HZH_Controls.Controls.UCDataGridView ucDataGridViewContent; + } +} diff --git a/RfidWeb/Frm/FormAlarm.cs b/RfidWeb/Frm/FormAlarm.cs new file mode 100644 index 0000000..c679f62 --- /dev/null +++ b/RfidWeb/Frm/FormAlarm.cs @@ -0,0 +1,78 @@ +using DB.Dto; +using DB.Service; + +using HZH_Controls.Controls; + +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; + +namespace RfidWeb.Frm +{ + public partial class FormAlarm : UserControl + { + private UserDto OlduserDto; + private PointLogService PointLogService = new PointLogService(); + public FormAlarm() + { + InitializeComponent(); + OlduserDto = UserManager.GetUser(); + Init(); + } + + + private void Init() + { + List lstCulumns = new List + { + new DataGridViewColumnEntity() { DataField = "PointName", HeadText = "名称", Width = 90, WidthType = SizeType.Absolute }, + new DataGridViewColumnEntity() { DataField = "Msg", HeadText = "异常内容", Width = 700, WidthType = SizeType.Absolute }, + + }; + + ucDataGridViewContent.AutoScroll = false; + + + this.ucDataGridViewContent.Columns = lstCulumns; + this.ucDataGridViewContent.IsShowCheckBox = true; + ucPagerControl21.PageModel = PageModel.PageCount; + ucPagerControl21.PageIndex = 1; + ucPagerControl21.PageSize = 20; + + } + + + + private void ucPagerControl21_ShowSourceChanged(object currentSource) + { + string key = this.textBoxSel.Text.Trim(); + var index = ucPagerControl21.PageIndex; + + var page = PointLogService.GetPagedList(index, ucPagerControl21.PageSize,key); + ucPagerControl21.PageCount = page.Totals.ToInt(); + this.ucDataGridViewContent.DataSource = page.DataList; + + + var dataGridViewRows = ucDataGridViewContent.SelectRows; + foreach (var row in dataGridViewRows) + { + if (row.IsChecked) + { + row.IsChecked = false; + } + } + } + + private void ucBtnSelect_BtnClick(object sender, EventArgs e) + { + ucPagerControl21.PageIndex = 1; + ucPagerControl21_ShowSourceChanged(new object()); + } + } +} diff --git a/RfidWeb/Frm/FormAlarm.resx b/RfidWeb/Frm/FormAlarm.resx new file mode 100644 index 0000000..2411c48 --- /dev/null +++ b/RfidWeb/Frm/FormAlarm.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u + ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u + PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB + AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLk9iamVjdAMAAAAGX2l0 + ZW1zBV9zaXplCF92ZXJzaW9uBQAACAgCAAAACQMAAAAAAAAAAAAAABADAAAAAAAAAAs= + + + \ No newline at end of file diff --git a/RfidWeb/FromSQl.Designer.cs b/RfidWeb/FromSQl.Designer.cs index fa88bbc..3fa2ecb 100644 --- a/RfidWeb/FromSQl.Designer.cs +++ b/RfidWeb/FromSQl.Designer.cs @@ -29,11 +29,12 @@ private void InitializeComponent() { this.ucBtnExt1 = new HZH_Controls.Controls.UCBtnExt(); + this.ucBtnExt2 = new HZH_Controls.Controls.UCBtnExt(); this.SuspendLayout(); // // ucBtnExt1 // - this.ucBtnExt1.BackColor = System.Drawing.Color.Transparent; + this.ucBtnExt1.BackColor = System.Drawing.Color.White; this.ucBtnExt1.BtnBackColor = System.Drawing.Color.White; this.ucBtnExt1.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.ucBtnExt1.BtnForeColor = System.Drawing.Color.White; @@ -46,24 +47,53 @@ this.ucBtnExt1.IsRadius = true; this.ucBtnExt1.IsShowRect = true; this.ucBtnExt1.IsShowTips = false; - this.ucBtnExt1.Location = new System.Drawing.Point(31, 18); + this.ucBtnExt1.Location = new System.Drawing.Point(21, 12); this.ucBtnExt1.Margin = new System.Windows.Forms.Padding(0); this.ucBtnExt1.Name = "ucBtnExt1"; this.ucBtnExt1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(58))))); this.ucBtnExt1.RectWidth = 1; - this.ucBtnExt1.Size = new System.Drawing.Size(213, 60); + this.ucBtnExt1.Size = new System.Drawing.Size(142, 40); this.ucBtnExt1.TabIndex = 0; this.ucBtnExt1.TabStop = false; this.ucBtnExt1.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99))))); this.ucBtnExt1.TipsText = ""; this.ucBtnExt1.BtnClick += new System.EventHandler(this.ucBtnExt1_BtnClick); // + // ucBtnExt2 + // + this.ucBtnExt2.BackColor = System.Drawing.Color.White; + this.ucBtnExt2.BtnBackColor = System.Drawing.Color.White; + this.ucBtnExt2.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.ucBtnExt2.BtnForeColor = System.Drawing.Color.White; + this.ucBtnExt2.BtnText = "插入数据库用户表"; + this.ucBtnExt2.ConerRadius = 5; + this.ucBtnExt2.Cursor = System.Windows.Forms.Cursors.Hand; + this.ucBtnExt2.EnabledMouseEffect = false; + this.ucBtnExt2.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59))))); + this.ucBtnExt2.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.ucBtnExt2.IsRadius = true; + this.ucBtnExt2.IsShowRect = true; + this.ucBtnExt2.IsShowTips = false; + this.ucBtnExt2.Location = new System.Drawing.Point(21, 68); + this.ucBtnExt2.Margin = new System.Windows.Forms.Padding(0); + this.ucBtnExt2.Name = "ucBtnExt2"; + this.ucBtnExt2.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(58))))); + this.ucBtnExt2.RectWidth = 1; + this.ucBtnExt2.Size = new System.Drawing.Size(142, 40); + this.ucBtnExt2.TabIndex = 1; + this.ucBtnExt2.TabStop = false; + this.ucBtnExt2.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99))))); + this.ucBtnExt2.TipsText = ""; + this.ucBtnExt2.BtnClick += new System.EventHandler(this.ucBtnExt2_BtnClick); + // // FromSQl // - 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(1093, 450); + this.ClientSize = new System.Drawing.Size(729, 300); + this.Controls.Add(this.ucBtnExt2); this.Controls.Add(this.ucBtnExt1); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.Name = "FromSQl"; this.Text = "FromSQl"; this.ResumeLayout(false); @@ -73,5 +103,6 @@ #endregion private HZH_Controls.Controls.UCBtnExt ucBtnExt1; + private HZH_Controls.Controls.UCBtnExt ucBtnExt2; } } \ No newline at end of file diff --git a/RfidWeb/FromSQl.cs b/RfidWeb/FromSQl.cs index 53515cf..1df5cf0 100644 --- a/RfidWeb/FromSQl.cs +++ b/RfidWeb/FromSQl.cs @@ -31,7 +31,7 @@ namespace RfidWeb var dbContext = DbFactory.GetContext; - // new PostgreSQLTableGenerator(dbContext).CreateTables(TableCreateMode.CreateIfNotExists); + new PostgreSQLTableGenerator(dbContext).CreateTables(TableCreateMode.CreateIfNotExists); //dbContext.Insert(new Role() //{ @@ -53,97 +53,117 @@ namespace RfidWeb //}); - dbContext.Insert(new UserInfo() - { - ID = SnowflakeFactory.NewId, - RoleId = - 7254091842295074816, - UserName = "管理员1", - Pwd = "E10ADC3949BA59ABBE56E057F20F883E", - - }); - dbContext.Insert(new UserInfo() - { - ID = SnowflakeFactory.NewId, - RoleId = - 7254091842295074816, - UserName = "管理员2", - Pwd = "E10ADC3949BA59ABBE56E057F20F883E", - - }); - dbContext.Insert(new UserInfo() - { - ID = SnowflakeFactory.NewId, - RoleId = - 7254091842295074816, - UserName = "管理员2", - Pwd = "E10ADC3949BA59ABBE56E057F20F883E", + //dbContext.Insert(new UserInfo() + //{ + // ID = SnowflakeFactory.NewId, + // RoleId = + // 7254091842295074816, + // UserName = "管理员1", + // Pwd = "E10ADC3949BA59ABBE56E057F20F883E", - }); + //}); + //dbContext.Insert(new UserInfo() + //{ + // ID = SnowflakeFactory.NewId, + // RoleId = + // 7254091842295074816, + // UserName = "管理员2", + // Pwd = "E10ADC3949BA59ABBE56E057F20F883E", + //}); + //dbContext.Insert(new UserInfo() + //{ + // ID = SnowflakeFactory.NewId, + // RoleId = + // 7254091842295074816, + // UserName = "管理员2", + // Pwd = "E10ADC3949BA59ABBE56E057F20F883E", + //}); - dbContext.Insert(new UserInfo() - { - ID = SnowflakeFactory.NewId, - RoleId = - 7254091842987134976, - UserName = "设备层1", - Pwd = "E10ADC3949BA59ABBE56E057F20F883E", - - }); - dbContext.Insert(new UserInfo() - { - ID = SnowflakeFactory.NewId, - RoleId = - 7254091842987134976, - UserName = "设备层2", - Pwd = "E10ADC3949BA59ABBE56E057F20F883E", - - }); - dbContext.Insert(new UserInfo() - { - ID = SnowflakeFactory.NewId, - RoleId = - 7254091842987134976, - UserName = "设备层2", - Pwd = "E10ADC3949BA59ABBE56E057F20F883E", - }); + //dbContext.Insert(new UserInfo() + //{ + // ID = SnowflakeFactory.NewId, + // RoleId = + // 7254091842987134976, + // UserName = "设备层1", + // Pwd = "E10ADC3949BA59ABBE56E057F20F883E", - dbContext.Insert(new UserInfo() - { - ID = SnowflakeFactory.NewId, - RoleId = - 7254091842999717888, - UserName = "使用层1", - Pwd = "E10ADC3949BA59ABBE56E057F20F883E", - - }); - dbContext.Insert(new UserInfo() - { - ID = SnowflakeFactory.NewId, - RoleId = - 7254091842999717888, - UserName = "使用层2", - Pwd = "E10ADC3949BA59ABBE56E057F20F883E", - - }); - dbContext.Insert(new UserInfo() - { - ID = SnowflakeFactory.NewId, - RoleId = - 7254091842999717888, - UserName = "使用层2", - Pwd = "E10ADC3949BA59ABBE56E057F20F883E", + //}); + //dbContext.Insert(new UserInfo() + //{ + // ID = SnowflakeFactory.NewId, + // RoleId = + // 7254091842987134976, + // UserName = "设备层2", + // Pwd = "E10ADC3949BA59ABBE56E057F20F883E", - }); + //}); + //dbContext.Insert(new UserInfo() + //{ + // ID = SnowflakeFactory.NewId, + // RoleId = + // 7254091842987134976, + // UserName = "设备层2", + // Pwd = "E10ADC3949BA59ABBE56E057F20F883E", + + //}); + + + //dbContext.Insert(new UserInfo() + //{ + // ID = SnowflakeFactory.NewId, + // RoleId = + // 7254091842999717888, + // UserName = "使用层1", + // Pwd = "E10ADC3949BA59ABBE56E057F20F883E", + + //}); + //dbContext.Insert(new UserInfo() + //{ + // ID = SnowflakeFactory.NewId, + // RoleId = + // 7254091842999717888, + // UserName = "使用层2", + // Pwd = "E10ADC3949BA59ABBE56E057F20F883E", + + //}); + //dbContext.Insert(new UserInfo() + //{ + // ID = SnowflakeFactory.NewId, + // RoleId = + // 7254091842999717888, + // UserName = "使用层2", + // Pwd = "E10ADC3949BA59ABBE56E057F20F883E", + + //}); // new PostgreSQLTableGenerator(dbContext).CreateTables(TableCreateMode.CreateNew); } + + private void ucBtnExt2_BtnClick(object sender, EventArgs e) + { + var dbContext = DbFactory.GetContext; + for (int i = 0; i < 100; i++) + { + PointLog log = new PointLog(); + log.ID = SnowflakeFactory.NewId; + log.PointName = "测试:" + i; + log.PointAddress = "DB:" + i; + log.Msg = "test:" + i; + log.CreateDate=DateTime.Now; + log.LastModifyDate=DateTime.Now; + log.LastModifyUserId = "123"; + log.CreateUserId = "123"; + + + dbContext.Insert(log); + } + } } } diff --git a/RfidWeb/Program.cs b/RfidWeb/Program.cs index c2a7832..778cdbd 100644 --- a/RfidWeb/Program.cs +++ b/RfidWeb/Program.cs @@ -20,8 +20,7 @@ namespace RfidWeb Application.SetCompatibleTextRenderingDefault(false); - //Application.Run(new FormLogin()); - + //Application.Run(new FromSQl()); Application.Run(new FormMain()); } diff --git a/RfidWeb/RfidWeb.csproj b/RfidWeb/RfidWeb.csproj index fdd43dd..c089a88 100644 --- a/RfidWeb/RfidWeb.csproj +++ b/RfidWeb/RfidWeb.csproj @@ -136,6 +136,12 @@ FormAccount.cs + + UserControl + + + FormAlarm.cs + Form @@ -166,6 +172,9 @@ FormAccount.cs + + FormAlarm.cs + FormRegister.cs