diff --git a/MainWindow.xaml b/MainWindow.xaml
index 44886a5..a09d172 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -44,7 +44,7 @@
-
+
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 1cf29e1..2bf4ee5 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -103,8 +103,7 @@ namespace SunlightCentralizedControlManagement_SCCM_
}
private void ListViewItem_ConveyorCenters(object sender, MouseButtonEventArgs e)
{
- WindowsView.User user_ =new WindowsView.User();
- user_.Show();
+
}
private void Buttonhelp_Click(object sender, RoutedEventArgs e)
@@ -116,7 +115,11 @@ namespace SunlightCentralizedControlManagement_SCCM_
{
Picture.Content = new View.SYSSetView();
}
-
+ private void ButtonUSER_Click(object sender, RoutedEventArgs e)
+ {
+ WindowsView.User user_ = new WindowsView.User();
+ user_.Show();
+ }
private void ButtonPermit_Click(object sender, RoutedEventArgs e)
{
WindowsView.CDKEY cDKEY = new WindowsView.CDKEY();
@@ -193,5 +196,6 @@ namespace SunlightCentralizedControlManagement_SCCM_
}
}
+
}
}
diff --git a/WindowsView/MachineSelection.xaml.cs b/WindowsView/MachineSelection.xaml.cs
index 805a0e5..f180d87 100644
--- a/WindowsView/MachineSelection.xaml.cs
+++ b/WindowsView/MachineSelection.xaml.cs
@@ -29,8 +29,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
public delegate void AddressUpdateHandler(object sender, AddressUpdateEventArgs e);
//声明一个更新Address的事件
public event AddressUpdateHandler AddressUpdated;
- private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
+ private SQLiteHelper SQLiteHelpers = null; //定义数据库
private string MACHINEDATA;
DataTable machine_table;
private List machine;
diff --git a/WindowsView/User.xaml b/WindowsView/User.xaml
index 32246b7..62d43d6 100644
--- a/WindowsView/User.xaml
+++ b/WindowsView/User.xaml
@@ -9,7 +9,7 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
mc:Ignorable="d" Loaded="user_Loaded"
- Title="MAC_SET" Height="720" Width="900" MinHeight="720" MinWidth="900"
+ Title="MAC_SET" Height="900" Width="1440" MinHeight="900" MinWidth="1440"
BorderBrush="White" Background="White">
@@ -21,7 +21,7 @@
-
+
@@ -48,10 +48,12 @@
-
-
-
-
+
+
+
+
+
+
-
-
+
+
-
+
diff --git a/WindowsView/User.xaml.cs b/WindowsView/User.xaml.cs
index c230873..5da6c4f 100644
--- a/WindowsView/User.xaml.cs
+++ b/WindowsView/User.xaml.cs
@@ -1,5 +1,7 @@
-using SunlightCentralizedControlManagement_SCCM_.View;
+using nGantt.GanttChart;
+using SunlightCentralizedControlManagement_SCCM_.View;
using System;
+using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
@@ -14,30 +16,34 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
///
public partial class User : Window
{
-
+ private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
+ private UserClass.SqliteHelper.SQLiteHelper SQLiteHelpers = null; //定义数据库
CheckBox[] checkBoxes = new CheckBox[99];
- string[] strings = new string[0] { };
+ string[] strings = new string[13] {"修改系统设置", "修改用户设置",
+ "单机监控","单机控制","单机设置","新建排程","排程编辑","排程删除",
+ "历史曲线","工艺查看","工艺编辑","工艺删除","输送信息"};
public User()
{
WindowStartupLocation = WindowStartupLocation.CenterScreen;
InitializeComponent();
}
- private async void user_Loaded(object sender, RoutedEventArgs e)//打开页面执行
+ private void user_Loaded(object sender, RoutedEventArgs e)//打开页面执行
{
for (int i = 0; i < strings.Length; i++)
{
checkBoxes[i] = new CheckBox();
checkBoxes[i].Content = strings[i].ToString();
checkBoxes[i].FontSize = 20;
- checkBoxes[i].Width = 80;
+ checkBoxes[i].Width = 200;
checkBoxes[i].Height = 50;
- checkBoxes[i].IsEnabled = false;
Capacity.Children.Add(checkBoxes[i]);
}
- }
-
-
+ SQLiteHelpers = new UserClass.SqliteHelper.SQLiteHelper(DBAddress); //数据库连接路径
+ SQLiteHelpers.Open(); //打开数据库
+ DataGriduser.ItemsSource = SQLiteHelpers.ExecuteDataSet("select * from USER order by Name desc", null).Tables[0].DefaultView;
+ SQLiteHelpers.Close();
+ }
private void Tb_KeyFloating(object sender, TextCompositionEventArgs e)//输入事件
{
@@ -45,9 +51,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数
e.Handled = !re.IsMatch(e.Text);
}
- string Capacity_;
+
private void DataGridMac_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
{
+ string Capacity_;
int rownum = DataGriduser.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效
{
@@ -56,12 +63,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
GROUP.Text = (DataGriduser.Columns[1].GetCellContent(DataGriduser.Items[rownum]) as TextBlock).Text.Trim();
Capacity_ = (DataGriduser.Columns[2].GetCellContent(DataGriduser.Items[rownum]) as TextBlock).Text.Trim();
Note.Text = (DataGriduser.Columns[3].GetCellContent(DataGriduser.Items[rownum]) as TextBlock).Text.Trim();
- }
- Pasword.Text = null; //清除密码框
+ for (int i = 0; i < Capacity_.Length; i++)
+ {
+ if (Capacity_.Substring(i, 1) == "1")
+ {
+ checkBoxes[i].IsChecked = true;
+ }
+ else
+ {
+
+ checkBoxes[i].IsChecked = false;
+ }
+ }
+ }
+ Pasword.Text = null; //清除密码框
}
- private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
+ private void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
{
Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,2})?$");//校验用正则表达式有1~2位小数的正实数
Regex re_char = new Regex(@"^[A-Za-z0-9\s@()()/+!!_-]+$");//校验用正则表达式由数字,26个英文字母,空白字符和@()()/+!!_-组成的字符串
@@ -69,15 +88,32 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
string name = _Name.Text;
string password = Pasword.Text;
string Group = GROUP.Text;
- int Cap = 0;
+ string Cap = null;
string note = Note.Text;
- string Stuff_sql;
-
-
+ string t = null;
+ for (int i = 0; i < strings.Length; i++)
+ {
+ if ((bool)checkBoxes[i].IsChecked)
+ {
+ Cap = Cap + "1";
+ }
+ else { Cap = Cap + "0"; }
+ }
+ Dictionary USER_new = new Dictionary();//缓存函数
+ USER_new.Add("Name", name);
+ USER_new.Add("Password", password);
+ USER_new.Add("Groups", Group);
+ USER_new.Add("Capacity", Cap);
+ USER_new.Add("Note", note);
+ SQLiteHelpers = new UserClass.SqliteHelper.SQLiteHelper(DBAddress); //数据库连接路径
+ SQLiteHelpers.Open(); //打开数据库
+ SQLiteHelpers.Delete("USER", "Name='" + name + "'", null);
+ SQLiteHelpers.InsertData("USER", USER_new);// 执行插入
+ SQLiteHelpers.Close();
}
- private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
+ private void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
{
}