Compare commits

..

2 Commits

Author SHA1 Message Date
74df1ee9bb 融合 2024-12-23 20:46:55 +08:00
8bd3de7c0d 增加权限管理功能 2024-12-23 20:42:01 +08:00
10 changed files with 984 additions and 110 deletions

View File

@ -0,0 +1,119 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace PBAnaly.LoginCommon
{
/// <summary>
/// 权限管理
/// </summary>
public class AccessControl
{
/// <summary>
/// 权限管理项集合
/// </summary>
public static List<AccessItem> AccessItems = new List<AccessItem>();
/// <summary>
/// 加载配置文件
/// </summary>
public static void LoadConfig()
{
try
{
if (File.Exists("AccessControl.xml"))
{
FileStream fs = new FileStream("AccessControl.xml", FileMode.Open);
XmlSerializer xs = new XmlSerializer(typeof(List<AccessItem>));
AccessItems = xs.Deserialize(fs) as List<AccessItem>;
fs.Close();
}
else
{
System.Windows.Forms.MessageBox.Show("加载配置文件AccessControl.xml不存在。即将推出程序.");
}
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(string.Format("加载配置文件AccessControl.xml出错。错误原因:{0}即将推出程序.", ex.Message));
throw ex;
}
}
/// <summary>
/// 保存配置文件
/// </summary>
public static void SaveConfig()
{
FileStream fs = new FileStream("AccessControl.xml", FileMode.Create);
XmlSerializer xs = new XmlSerializer(typeof(List<AccessItem>));
xs.Serialize(fs, AccessItems);
fs.Close();
}
public static void SaveBinaryConfig()
{
IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
Stream fs = new FileStream("AccessControl.bin", FileMode.Create);
formatter.Serialize(fs, AccessItems);
fs.Close();
}
public static void LoadBinaryConfig()
{
IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
Stream fs = new FileStream("AccessControl.bin", FileMode.Open);
AccessItems = (List<AccessItem>)formatter.Deserialize(fs);
fs.Close();
}
}
#region AccessItem
/// <summary>
/// 权限管理项
/// </summary>
[XmlType(TypeName = "item")]
[Serializable]
public class AccessItem
{
/// <summary>
/// 编号
/// </summary>
[XmlAttribute]
public int Id = 0;
/// <summary>
/// 操作员是否可操作true-可操作false-不可操作
/// </summary>
[XmlAttribute]
public bool Operator = false;
/// <summary>
/// 工程师是否可操作true-可操作false-不可操作
/// </summary>
[XmlAttribute]
public bool Engineer = false;
/// <summary>
/// 管理员是否可操作true-可操作false-不可操作
/// </summary>
[XmlAttribute]
public bool Administrator = false;
/// <summary>
/// 超级管理员是否可操作true-可操作false-不可操作
/// </summary>
[XmlAttribute]
public bool SuperAdministrator = false;
/// <summary>
/// 描述是否可操作true-可操作false-不可操作
/// </summary>
[XmlAttribute]
public string Disrible = "";
}
#endregion
}

View File

@ -0,0 +1,209 @@
namespace PBAnaly.LoginCommon
{
partial class RoleManageForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
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.panel1 = new System.Windows.Forms.Panel();
this.btn_Close = new System.Windows.Forms.Button();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.btn_save = new System.Windows.Forms.Button();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column3 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.Column4 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.Column5 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.Column6 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.BackColor = System.Drawing.Color.White;
this.panel1.Controls.Add(this.btn_save);
this.panel1.Controls.Add(this.dataGridView1);
this.panel1.Location = new System.Drawing.Point(0, 27);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(756, 569);
this.panel1.TabIndex = 0;
//
// btn_Close
//
this.btn_Close.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_Close.BackColor = System.Drawing.Color.Transparent;
this.btn_Close.FlatAppearance.BorderSize = 0;
this.btn_Close.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_Close.ForeColor = System.Drawing.Color.Transparent;
this.btn_Close.Image = global::PBAnaly.Properties.Resources.White;
this.btn_Close.Location = new System.Drawing.Point(712, 0);
this.btn_Close.Name = "btn_Close";
this.btn_Close.Size = new System.Drawing.Size(44, 28);
this.btn_Close.TabIndex = 458;
this.btn_Close.UseVisualStyleBackColor = false;
this.btn_Close.Click += new System.EventHandler(this.btn_Close_Click);
//
// dataGridView1
//
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToResizeRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
this.dataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.InactiveCaption;
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dataGridView1.ColumnHeadersHeight = 30;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column1,
this.Column2,
this.Column3,
this.Column4,
this.Column5,
this.Column6});
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle3;
this.dataGridView1.GridColor = System.Drawing.SystemColors.ControlLightLight;
this.dataGridView1.Location = new System.Drawing.Point(0, 0);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.RowHeadersVisible = false;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle4;
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
this.dataGridView1.Size = new System.Drawing.Size(632, 569);
this.dataGridView1.TabIndex = 4;
//
// btn_save
//
this.btn_save.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(32)))), ((int)(((byte)(96)))));
this.btn_save.FlatAppearance.BorderSize = 0;
this.btn_save.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_save.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold);
this.btn_save.ForeColor = System.Drawing.Color.White;
this.btn_save.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btn_save.Location = new System.Drawing.Point(641, 49);
this.btn_save.Name = "btn_save";
this.btn_save.Size = new System.Drawing.Size(101, 38);
this.btn_save.TabIndex = 506;
this.btn_save.Text = "保存";
this.btn_save.UseVisualStyleBackColor = false;
this.btn_save.Click += new System.EventHandler(this.btn_save_Click);
//
// Column1
//
this.Column1.HeaderText = "序号";
this.Column1.Name = "Column1";
//
// Column2
//
this.Column2.HeaderText = "描述";
this.Column2.Name = "Column2";
this.Column2.ReadOnly = true;
//
// Column3
//
this.Column3.HeaderText = "操作员";
this.Column3.Name = "Column3";
this.Column3.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.Column3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// Column4
//
this.Column4.HeaderText = "工程师";
this.Column4.Name = "Column4";
this.Column4.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.Column4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// Column5
//
this.Column5.HeaderText = "管理员";
this.Column5.Name = "Column5";
this.Column5.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.Column5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// Column6
//
this.Column6.HeaderText = "超级管理员";
this.Column6.Name = "Column6";
this.Column6.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.Column6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// RoleManageForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.ClientSize = new System.Drawing.Size(754, 595);
this.Controls.Add(this.btn_Close);
this.Controls.Add(this.panel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "RoleManageForm";
this.Text = "RoleManageForm";
this.Load += new System.EventHandler(this.RoleManageForm_Load);
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.Button btn_Close;
private System.Windows.Forms.Button btn_save;
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
private System.Windows.Forms.DataGridViewCheckBoxColumn Column3;
private System.Windows.Forms.DataGridViewCheckBoxColumn Column4;
private System.Windows.Forms.DataGridViewCheckBoxColumn Column5;
private System.Windows.Forms.DataGridViewCheckBoxColumn Column6;
}
}

View File

@ -0,0 +1,162 @@
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 PBAnaly.LoginCommon
{
public partial class RoleManageForm : Form
{
public RoleManageForm()
{
InitializeComponent();
// 设置窗体的启动位置为屏幕的中心
this.StartPosition = FormStartPosition.CenterScreen;
this.Location = new System.Drawing.Point((Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2,
(Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2);
}
#region =====WndPoc方法 =========
const int HTLEFT = 10;
const int HTRIGHT = 11;
const int HTTOP = 12;
const int HTTOPLEFT = 13;
const int HTTOPRIGHT = 14;
const int HTBOTTOM = 15;
const int HTBOTTOMLEFT = 0x10;
const int HTBOTTOMRIGHT = 17;
protected override void WndProc(ref System.Windows.Forms.Message m)
{
try
{
switch (m.Msg)
{
case 0x0084:
base.WndProc(ref m);
System.Drawing.Point vPoint = new System.Drawing.Point((int)m.LParam & 0xFFFF, (int)m.LParam >> 16 & 0xFFFF);
vPoint = PointToClient(vPoint);
if (vPoint.X <= 5)
{
if (vPoint.Y <= 5)
{
m.Result = (IntPtr)HTTOPLEFT;
}
else if (vPoint.Y >= ClientSize.Height - 5)
{
m.Result = (IntPtr)HTBOTTOMLEFT;
}
else
{
m.Result = (IntPtr)HTLEFT;
}
}
else if (vPoint.X >= ClientSize.Width - 5)
{
if (vPoint.Y <= 5)
{
m.Result = (IntPtr)HTTOPRIGHT;
}
else if (vPoint.Y >= ClientSize.Height - 5)
{
m.Result = (IntPtr)HTBOTTOMRIGHT;
}
else
{
m.Result = (IntPtr)HTRIGHT;
}
}
else if (vPoint.Y <= 5)
{
m.Result = (IntPtr)HTTOP;
}
else if (vPoint.Y >= ClientSize.Height - 5)
{
m.Result = (IntPtr)HTBOTTOM;
}
break;
case 0x0201://鼠标左键按下的消息 用于实现拖动窗口功能
m.Msg = 0x00A1;//更改消息为非客户区按下鼠标
m.LParam = IntPtr.Zero;//默认值
m.WParam = new IntPtr(2);//鼠标放在标题栏内
base.WndProc(ref m);
break;
default:
base.WndProc(ref m);
break;
}
}
catch (Exception ex)
{
//showERRORMsg($"重写WndPoc方法 无边框窗体更改大小及拖动方法发生异常,原因:{ex.Message}");
}
}
#endregion
private void btn_save_Click(object sender, EventArgs e)
{
try
{
List<AccessItem> items = new List<AccessItem>();
for (int index = 0; index < dataGridView1.RowCount; index++)
{
DataGridViewRow row = dataGridView1.Rows[index];
AccessItem item = new AccessItem();
item.Id = (int)row.Cells[0].Value;
item.Disrible = (string)row.Cells[1].Value;
item.Operator = (bool)row.Cells[2].Value;
item.Engineer = (bool)row.Cells[3].Value;
item.Administrator = (bool)row.Cells[4].Value;
item.SuperAdministrator = true;
items.Add(item);
}
AccessControl.AccessItems = items;
AccessControl.SaveConfig();
MessageBox.Show("success");
}
catch (Exception ex)
{
}
}
private void RoleManageForm_Load(object sender, EventArgs e)
{
try
{
for (int index = 0; index < AccessControl.AccessItems.Count; index++)
{
DataGridViewRow dr = new DataGridViewRow();
dr.CreateCells(dataGridView1);
dr.Cells[0].Value = AccessControl.AccessItems[index].Id;
dr.Cells[1].Value = AccessControl.AccessItems[index].Disrible;
dr.Cells[2].Value = AccessControl.AccessItems[index].Operator;
dr.Cells[3].Value = AccessControl.AccessItems[index].Engineer;
dr.Cells[4].Value = AccessControl.AccessItems[index].SuperAdministrator;
dr.Cells[5].Value = AccessControl.AccessItems[index].Administrator;
dataGridView1.Rows.Add(dr);
}
}
catch (Exception ex)
{
}
}
private void btn_Close_Click(object sender, EventArgs e)
{
Close();
}
}
}

View File

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -28,11 +28,11 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@ -42,24 +42,25 @@
this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabControl1 = new System.Windows.Forms.TabControl();
this.tab_fix = new System.Windows.Forms.TabPage(); this.tab_fix = new System.Windows.Forms.TabPage();
this.btn_role_manage = new System.Windows.Forms.Button();
this.btn_fix_role = new System.Windows.Forms.Button(); this.btn_fix_role = new System.Windows.Forms.Button();
this.txt_UserName = new System.Windows.Forms.TextBox(); this.txt_UserName = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label();
this.cbx_role_role = new System.Windows.Forms.ComboBox(); this.cbx_role_role = new System.Windows.Forms.ComboBox();
this.label12 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label();
this.tab_delete = new System.Windows.Forms.TabPage(); this.tab_delete = new System.Windows.Forms.TabPage();
this.btn_delete_user = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.tab_fix_password = new System.Windows.Forms.TabPage(); this.tab_fix_password = new System.Windows.Forms.TabPage();
this.btn_FixPassword = new System.Windows.Forms.Button();
this.txt_password = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.txt_fix_p_UserName = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.btn_delete = new System.Windows.Forms.Button(); this.btn_delete = new System.Windows.Forms.Button();
this.btn_edit_password = new System.Windows.Forms.Button(); this.btn_edit_password = new System.Windows.Forms.Button();
this.btn_editRole = new System.Windows.Forms.Button(); this.btn_editRole = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.btn_delete_user = new System.Windows.Forms.Button();
this.txt_fix_p_UserName = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.txt_password = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.btn_FixPassword = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout();
@ -99,14 +100,14 @@
this.dataGridView1.AllowUserToResizeRows = false; this.dataGridView1.AllowUserToResizeRows = false;
this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dataGridView1.BackgroundColor = System.Drawing.Color.White; this.dataGridView1.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle26.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle26.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle26.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle26.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle26.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle26.WrapMode = System.Windows.Forms.DataGridViewTriState.True; dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle26; this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column1, this.Column1,
@ -128,8 +129,8 @@
// //
// Column1 // Column1
// //
dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.Column1.DefaultCellStyle = dataGridViewCellStyle27; this.Column1.DefaultCellStyle = dataGridViewCellStyle2;
this.Column1.HeaderText = "序号"; this.Column1.HeaderText = "序号";
this.Column1.Name = "Column1"; this.Column1.Name = "Column1";
this.Column1.ReadOnly = true; this.Column1.ReadOnly = true;
@ -137,8 +138,8 @@
// //
// Column2 // Column2
// //
dataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
this.Column2.DefaultCellStyle = dataGridViewCellStyle28; this.Column2.DefaultCellStyle = dataGridViewCellStyle3;
this.Column2.HeaderText = "用户名"; this.Column2.HeaderText = "用户名";
this.Column2.Name = "Column2"; this.Column2.Name = "Column2";
this.Column2.ReadOnly = true; this.Column2.ReadOnly = true;
@ -152,8 +153,8 @@
// //
// Column3 // Column3
// //
dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.Column3.DefaultCellStyle = dataGridViewCellStyle29; this.Column3.DefaultCellStyle = dataGridViewCellStyle4;
this.Column3.HeaderText = "创建时间"; this.Column3.HeaderText = "创建时间";
this.Column3.Name = "Column3"; this.Column3.Name = "Column3";
this.Column3.ReadOnly = true; this.Column3.ReadOnly = true;
@ -161,8 +162,8 @@
// //
// Column4 // Column4
// //
dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.Column4.DefaultCellStyle = dataGridViewCellStyle30; this.Column4.DefaultCellStyle = dataGridViewCellStyle5;
this.Column4.HeaderText = "权限"; this.Column4.HeaderText = "权限";
this.Column4.Name = "Column4"; this.Column4.Name = "Column4";
this.Column4.ReadOnly = true; this.Column4.ReadOnly = true;
@ -184,6 +185,7 @@
// //
// tab_fix // tab_fix
// //
this.tab_fix.Controls.Add(this.btn_role_manage);
this.tab_fix.Controls.Add(this.btn_fix_role); this.tab_fix.Controls.Add(this.btn_fix_role);
this.tab_fix.Controls.Add(this.txt_UserName); this.tab_fix.Controls.Add(this.txt_UserName);
this.tab_fix.Controls.Add(this.label11); this.tab_fix.Controls.Add(this.label11);
@ -197,6 +199,22 @@
this.tab_fix.Text = "修改权限"; this.tab_fix.Text = "修改权限";
this.tab_fix.UseVisualStyleBackColor = true; this.tab_fix.UseVisualStyleBackColor = true;
// //
// btn_role_manage
//
this.btn_role_manage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(32)))), ((int)(((byte)(96)))));
this.btn_role_manage.FlatAppearance.BorderSize = 0;
this.btn_role_manage.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_role_manage.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold);
this.btn_role_manage.ForeColor = System.Drawing.Color.White;
this.btn_role_manage.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btn_role_manage.Location = new System.Drawing.Point(284, 305);
this.btn_role_manage.Name = "btn_role_manage";
this.btn_role_manage.Size = new System.Drawing.Size(101, 38);
this.btn_role_manage.TabIndex = 506;
this.btn_role_manage.Text = "权限管理";
this.btn_role_manage.UseVisualStyleBackColor = false;
this.btn_role_manage.Click += new System.EventHandler(this.btn_role_manage_Click);
//
// btn_fix_role // btn_fix_role
// //
this.btn_fix_role.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(32)))), ((int)(((byte)(96))))); this.btn_fix_role.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(32)))), ((int)(((byte)(96)))));
@ -270,6 +288,31 @@
this.tab_delete.Text = "删除"; this.tab_delete.Text = "删除";
this.tab_delete.UseVisualStyleBackColor = true; this.tab_delete.UseVisualStyleBackColor = true;
// //
// btn_delete_user
//
this.btn_delete_user.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(32)))), ((int)(((byte)(96)))));
this.btn_delete_user.FlatAppearance.BorderSize = 0;
this.btn_delete_user.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_delete_user.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold);
this.btn_delete_user.ForeColor = System.Drawing.Color.White;
this.btn_delete_user.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btn_delete_user.Location = new System.Drawing.Point(155, 74);
this.btn_delete_user.Name = "btn_delete_user";
this.btn_delete_user.Size = new System.Drawing.Size(78, 38);
this.btn_delete_user.TabIndex = 499;
this.btn_delete_user.Text = "删除";
this.btn_delete_user.UseVisualStyleBackColor = false;
this.btn_delete_user.Click += new System.EventHandler(this.btn_delete_user_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(119, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(161, 12);
this.label1.TabIndex = 0;
this.label1.Text = "选中左侧表格的一行即可删除";
//
// tab_fix_password // tab_fix_password
// //
this.tab_fix_password.Controls.Add(this.btn_FixPassword); this.tab_fix_password.Controls.Add(this.btn_FixPassword);
@ -285,6 +328,61 @@
this.tab_fix_password.Text = "修改密码"; this.tab_fix_password.Text = "修改密码";
this.tab_fix_password.UseVisualStyleBackColor = true; this.tab_fix_password.UseVisualStyleBackColor = true;
// //
// btn_FixPassword
//
this.btn_FixPassword.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(32)))), ((int)(((byte)(96)))));
this.btn_FixPassword.FlatAppearance.BorderSize = 0;
this.btn_FixPassword.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_FixPassword.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold);
this.btn_FixPassword.ForeColor = System.Drawing.Color.White;
this.btn_FixPassword.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btn_FixPassword.Location = new System.Drawing.Point(285, 216);
this.btn_FixPassword.Name = "btn_FixPassword";
this.btn_FixPassword.Size = new System.Drawing.Size(101, 38);
this.btn_FixPassword.TabIndex = 509;
this.btn_FixPassword.Text = "修改密码";
this.btn_FixPassword.UseVisualStyleBackColor = false;
this.btn_FixPassword.Click += new System.EventHandler(this.btn_FixPassword_Click);
//
// txt_password
//
this.txt_password.Font = new System.Drawing.Font("宋体", 10F);
this.txt_password.Location = new System.Drawing.Point(94, 148);
this.txt_password.Multiline = true;
this.txt_password.Name = "txt_password";
this.txt_password.Size = new System.Drawing.Size(292, 28);
this.txt_password.TabIndex = 508;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 15F);
this.label3.Location = new System.Drawing.Point(39, 156);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(49, 20);
this.label3.TabIndex = 507;
this.label3.Text = "密码";
//
// txt_fix_p_UserName
//
this.txt_fix_p_UserName.Font = new System.Drawing.Font("宋体", 13F);
this.txt_fix_p_UserName.Location = new System.Drawing.Point(94, 46);
this.txt_fix_p_UserName.Multiline = true;
this.txt_fix_p_UserName.Name = "txt_fix_p_UserName";
this.txt_fix_p_UserName.ReadOnly = true;
this.txt_fix_p_UserName.Size = new System.Drawing.Size(292, 28);
this.txt_fix_p_UserName.TabIndex = 506;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 15F);
this.label2.Location = new System.Drawing.Point(19, 54);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(69, 20);
this.label2.TabIndex = 505;
this.label2.Text = "用户名";
//
// panel1 // panel1
// //
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@ -352,86 +450,6 @@
this.btn_editRole.UseVisualStyleBackColor = false; this.btn_editRole.UseVisualStyleBackColor = false;
this.btn_editRole.Click += new System.EventHandler(this.btn_editRole_Click); this.btn_editRole.Click += new System.EventHandler(this.btn_editRole_Click);
// //
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(119, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(161, 12);
this.label1.TabIndex = 0;
this.label1.Text = "选中左侧表格的一行即可删除";
//
// btn_delete_user
//
this.btn_delete_user.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(32)))), ((int)(((byte)(96)))));
this.btn_delete_user.FlatAppearance.BorderSize = 0;
this.btn_delete_user.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_delete_user.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold);
this.btn_delete_user.ForeColor = System.Drawing.Color.White;
this.btn_delete_user.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btn_delete_user.Location = new System.Drawing.Point(155, 74);
this.btn_delete_user.Name = "btn_delete_user";
this.btn_delete_user.Size = new System.Drawing.Size(78, 38);
this.btn_delete_user.TabIndex = 499;
this.btn_delete_user.Text = "删除";
this.btn_delete_user.UseVisualStyleBackColor = false;
this.btn_delete_user.Click += new System.EventHandler(this.btn_delete_user_Click);
//
// txt_fix_p_UserName
//
this.txt_fix_p_UserName.Font = new System.Drawing.Font("宋体", 13F);
this.txt_fix_p_UserName.Location = new System.Drawing.Point(94, 46);
this.txt_fix_p_UserName.Multiline = true;
this.txt_fix_p_UserName.Name = "txt_fix_p_UserName";
this.txt_fix_p_UserName.ReadOnly = true;
this.txt_fix_p_UserName.Size = new System.Drawing.Size(292, 28);
this.txt_fix_p_UserName.TabIndex = 506;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 15F);
this.label2.Location = new System.Drawing.Point(19, 54);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(69, 20);
this.label2.TabIndex = 505;
this.label2.Text = "用户名";
//
// txt_password
//
this.txt_password.Font = new System.Drawing.Font("宋体", 10F);
this.txt_password.Location = new System.Drawing.Point(94, 148);
this.txt_password.Multiline = true;
this.txt_password.Name = "txt_password";
this.txt_password.Size = new System.Drawing.Size(292, 28);
this.txt_password.TabIndex = 508;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 15F);
this.label3.Location = new System.Drawing.Point(39, 156);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(49, 20);
this.label3.TabIndex = 507;
this.label3.Text = "密码";
//
// btn_FixPassword
//
this.btn_FixPassword.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(32)))), ((int)(((byte)(96)))));
this.btn_FixPassword.FlatAppearance.BorderSize = 0;
this.btn_FixPassword.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_FixPassword.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold);
this.btn_FixPassword.ForeColor = System.Drawing.Color.White;
this.btn_FixPassword.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btn_FixPassword.Location = new System.Drawing.Point(285, 216);
this.btn_FixPassword.Name = "btn_FixPassword";
this.btn_FixPassword.Size = new System.Drawing.Size(101, 38);
this.btn_FixPassword.TabIndex = 509;
this.btn_FixPassword.Text = "修改密码";
this.btn_FixPassword.UseVisualStyleBackColor = false;
this.btn_FixPassword.Click += new System.EventHandler(this.btn_FixPassword_Click);
//
// UserManageForm // UserManageForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -487,5 +505,6 @@
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txt_fix_p_UserName; private System.Windows.Forms.TextBox txt_fix_p_UserName;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btn_role_manage;
} }
} }

View File

@ -48,6 +48,18 @@ namespace PBAnaly.LoginCommon
index++; index++;
} }
} }
if (UserManage.IsLogined)
{
if(UserManage.LogionUser.Role == UserRole.SuperAdministrator)
{
btn_role_manage.Visible = true;
}
else
{
btn_role_manage.Visible = false;
}
}
} }
catch (Exception) catch (Exception)
{ {
@ -220,5 +232,11 @@ namespace PBAnaly.LoginCommon
} }
} }
#endregion #endregion
private void btn_role_manage_Click(object sender, EventArgs e)
{
RoleManageForm roleManageForm = new RoleManageForm();
roleManageForm.ShowDialog();
}
} }
} }

View File

@ -3,6 +3,7 @@ using MaterialSkin;
using MaterialSkin.Controls; using MaterialSkin.Controls;
using OpenCvSharp.Flann; using OpenCvSharp.Flann;
using OpenTK; using OpenTK;
using PBAnaly.LoginCommon;
using PBAnaly.Module; using PBAnaly.Module;
using PBAnaly.Properties; using PBAnaly.Properties;
using PBAnaly.UI; using PBAnaly.UI;
@ -73,6 +74,12 @@ namespace PBAnaly
loginForm.Hide(); loginForm.Hide();
UserManage.LogionUserChanged += OnLogionUserChanged;
InitAccessControls();
OnLogionUser();
UIInit(); UIInit();
FormGenerate_X = 0; FormGenerate_X = 0;
@ -81,6 +88,181 @@ namespace PBAnaly
} }
#region
/// <summary>
/// 用于权限控制将所有要管控的控件保存到mControls中
/// </summary>
private Control[] mControls;
/// <summary>
/// 初始化权限控件集合
/// </summary>
private void InitAccessControls()
{
mControls = new Control[]
{
materialButton_setting, //0、系统设置
materialButton_curveimage, //1、泳道波形图
materialButton_analyzedata, //2、分析数据
materialButton_outimage, //3、导出图像
materialButton_LoadData, //4、加载数据
materialButton_imageProcess, //5、图像处理
materialButton_acidAnalyze, //6、泳道分析
materialButton_roiAnalyze, //7、ROIs分析
materialButton_miniAnalyze, //8、微孔版分析
materialButton_dotcounts, //9、菌落计数
materialButton_correction //10、蛋白归一化
};
}
#region OnLogionUserChanged
/// <summary>
/// 处理登录用户更改事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnLogionUserChanged(object sender, EventArgs e)
{
if (UserManage.IsLogined)
{
switch (UserManage.LogionUser.Role)
{
case UserRole.Operator:
SetOperatorRole();
break;
case UserRole.Engineer:
SetEngineerRole();
break;
case UserRole.Administrator:
SetAdministratorRole();
break;
case UserRole.SuperAdministrator:
SetSuperAdministratorRole();
break;
}
}
else
{
CloseControlEnabled();
}
}
private void OnLogionUser()
{
if (UserManage.IsLogined)
{
switch (UserManage.LogionUser.Role)
{
case UserRole.Operator:
SetOperatorRole();
break;
case UserRole.Engineer:
SetEngineerRole();
break;
case UserRole.Administrator:
SetAdministratorRole();
break;
case UserRole.SuperAdministrator:
SetSuperAdministratorRole();
break;
}
}
else
{
CloseControlEnabled();
}
}
#endregion
#region CloseControlEnabled 使
/// <summary>
/// 关闭控件权限,在未登录时使用
/// </summary>
private void CloseControlEnabled()
{
if (InvokeRequired)
{
BeginInvoke(new Action(CloseControlEnabled));
}
else
{
SetControlsEnabled(false);
}
}
#endregion
#region SetControlsEnabled
/// <summary>
/// 设置控件是否可以对用户交互作出响应。
/// </summary>
/// <param name="isEnabled">true-可以对用户交互作出响应false-不可以对用户交互作出响应。</param>
public void SetControlsEnabled(bool isEnabled)
{
for (int index = 0; index < mControls.Length; index++)
{
mControls[index].Enabled = false;
}
}
#endregion
#region SetOperatorRole
/// <summary>
/// 设置操作员权限
/// </summary>
private void SetOperatorRole()
{
for (int index = 0; index < mControls.Length; index++)
{
mControls[index].Enabled = AccessControl.AccessItems[index].Operator;
}
}
#endregion
#region SetEngineerRole
/// <summary>
/// 设置工程师权限
/// </summary>
private void SetEngineerRole()
{
for (int index = 0; index < mControls.Length; index++)
{
mControls[index].Enabled = AccessControl.AccessItems[index].Engineer;
}
}
#endregion
#region SetAdministratorRole
/// <summary>
/// 设置管理员权限
/// </summary>
private void SetAdministratorRole()
{
for (int index = 0; index < mControls.Length; index++)
{
mControls[index].Enabled = AccessControl.AccessItems[index].Administrator;
}
}
#endregion
#region SetAdministratorRole
/// <summary>
/// 设置超级管理员权限
/// </summary>
private void SetSuperAdministratorRole()
{
for (int index = 0; index < mControls.Length; index++)
{
mControls[index].Enabled = AccessControl.AccessItems[index].SuperAdministrator;
}
}
#endregion
#endregion
[System.Runtime.InteropServices.DllImport("user32.dll")] [System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hWnd, int wMsg, bool wParam, int lParm); private static extern int SendMessage(IntPtr hWnd, int wMsg, bool wParam, int lParm);

View File

@ -75,6 +75,7 @@
<Compile Include="LogForm.Designer.cs"> <Compile Include="LogForm.Designer.cs">
<DependentUpon>LogForm.cs</DependentUpon> <DependentUpon>LogForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="LoginCommon\AccessControl.cs" />
<Compile Include="LoginCommon\BackPassWordForm.cs"> <Compile Include="LoginCommon\BackPassWordForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -94,6 +95,12 @@
<Compile Include="LoginCommon\RegisterFrom.Designer.cs"> <Compile Include="LoginCommon\RegisterFrom.Designer.cs">
<DependentUpon>RegisterFrom.cs</DependentUpon> <DependentUpon>RegisterFrom.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="LoginCommon\RoleManageForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LoginCommon\RoleManageForm.Designer.cs">
<DependentUpon>RoleManageForm.cs</DependentUpon>
</Compile>
<Compile Include="LoginCommon\User.cs" /> <Compile Include="LoginCommon\User.cs" />
<Compile Include="LoginCommon\UserManage.cs" /> <Compile Include="LoginCommon\UserManage.cs" />
<Compile Include="LoginCommon\UserManageForm.cs"> <Compile Include="LoginCommon\UserManageForm.cs">
@ -202,6 +209,9 @@
<EmbeddedResource Include="LoginCommon\RegisterFrom.resx"> <EmbeddedResource Include="LoginCommon\RegisterFrom.resx">
<DependentUpon>RegisterFrom.cs</DependentUpon> <DependentUpon>RegisterFrom.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="LoginCommon\RoleManageForm.resx">
<DependentUpon>RoleManageForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LoginCommon\UserManageForm.resx"> <EmbeddedResource Include="LoginCommon\UserManageForm.resx">
<DependentUpon>UserManageForm.cs</DependentUpon> <DependentUpon>UserManageForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

View File

@ -62,6 +62,7 @@ namespace PBAnaly
return; return;
} }
if (Util.ViKeySoft.Instance.CheckViKey() == false) if (Util.ViKeySoft.Instance.CheckViKey() == false)
{ {
MessageBox.Show("你没有权限,请检查加密狗是否插入","警告"); MessageBox.Show("你没有权限,请检查加密狗是否插入","警告");
@ -75,7 +76,7 @@ namespace PBAnaly
string dbPath = "UserManage.db"; string dbPath = "UserManage.db";
string connectionString = $"Data Source={dbPath};Version=3;"; string connectionString = $"Data Source={dbPath};Version=3;";
UserManage.ConnectDb(); UserManage.ConnectDb();
AccessControl.LoadConfig();//加载权限
var login = new LoginForm(); var login = new LoginForm();
login.StartPosition = FormStartPosition.CenterScreen; login.StartPosition = FormStartPosition.CenterScreen;
Application.Run(new MainForm()); Application.Run(new MainForm());

View File

@ -1,4 +1,5 @@
using PBAnaly.LoginCommon; using PBAnaly.LoginCommon;
using Sunny.UI.Win32;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@ -20,7 +21,10 @@ namespace PBAnaly.UI
pnlMainMenu.BringToFront(); pnlMainMenu.BringToFront();
// 设置窗体的启动位置为屏幕的中心
this.StartPosition = FormStartPosition.CenterScreen;
this.Location = new System.Drawing.Point((Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2,
(Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2);
} }
UserManageForm UserForm; UserManageForm UserForm;
@ -118,6 +122,18 @@ namespace PBAnaly.UI
tab_UserManage.Controls.Add(UserForm); tab_UserManage.Controls.Add(UserForm);
UserForm.InitUser(); UserForm.InitUser();
UserForm.Show(); UserForm.Show();
if (UserManage.IsLogined)
{
if (UserManage.LogionUser.Role == UserRole.SuperAdministrator)
{
tab_UserManage.Parent = tabMain;
}
else
{
tab_UserManage.Parent = null;
}
}
} }
} }
} }