增加用户权限管理页面
This commit is contained in:
commit
4d2506ca7f
5 files changed
+74
-32
No files matched your search
+1
-1
@@ -44,7 +44,7 @@
|
|||||||
<TextBlock Text="{Binding Sys_Time}" VerticalAlignment="Center" FontSize="14" Foreground="White"/>
|
<TextBlock Text="{Binding Sys_Time}" VerticalAlignment="Center" FontSize="14" Foreground="White"/>
|
||||||
<materialDesign:PopupBox Foreground="White" Margin="10" PlacementMode="BottomAndAlignRightEdges" StaysOpen="False">
|
<materialDesign:PopupBox Foreground="White" Margin="10" PlacementMode="BottomAndAlignRightEdges" StaysOpen="False">
|
||||||
<StackPanel Width="150">
|
<StackPanel Width="150">
|
||||||
<Button Content="{x:Static lang:Resources.USER}"/>
|
<Button Content="{x:Static lang:Resources.USER}" Click="ButtonUSER_Click"/>
|
||||||
<Button Content="{x:Static lang:Resources.SysSet}" Click="ButtonSYS_Click"/>
|
<Button Content="{x:Static lang:Resources.SysSet}" Click="ButtonSYS_Click"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<Button Content="{x:Static lang:Resources.Permit}" Click="ButtonPermit_Click"/>
|
<Button Content="{x:Static lang:Resources.Permit}" Click="ButtonPermit_Click"/>
|
||||||
|
|||||||
+7
-3
@@ -103,8 +103,7 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
|||||||
}
|
}
|
||||||
private void ListViewItem_ConveyorCenters(object sender, MouseButtonEventArgs e)
|
private void ListViewItem_ConveyorCenters(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
WindowsView.User user_ =new WindowsView.User();
|
|
||||||
user_.Show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Buttonhelp_Click(object sender, RoutedEventArgs e)
|
private void Buttonhelp_Click(object sender, RoutedEventArgs e)
|
||||||
@@ -116,7 +115,11 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
|||||||
{
|
{
|
||||||
Picture.Content = new View.SYSSetView();
|
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)
|
private void ButtonPermit_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
WindowsView.CDKEY cDKEY = new WindowsView.CDKEY();
|
WindowsView.CDKEY cDKEY = new WindowsView.CDKEY();
|
||||||
@@ -193,5 +196,6 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,8 +29,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
|||||||
public delegate void AddressUpdateHandler(object sender, AddressUpdateEventArgs e);
|
public delegate void AddressUpdateHandler(object sender, AddressUpdateEventArgs e);
|
||||||
//声明一个更新Address的事件
|
//声明一个更新Address的事件
|
||||||
public event AddressUpdateHandler AddressUpdated;
|
public event AddressUpdateHandler AddressUpdated;
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
|
||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
||||||
|
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private string MACHINEDATA;
|
private string MACHINEDATA;
|
||||||
DataTable machine_table;
|
DataTable machine_table;
|
||||||
private List<string> machine;
|
private List<string> machine;
|
||||||
|
|||||||
+11
-9
@@ -9,7 +9,7 @@
|
|||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
|
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
|
||||||
mc:Ignorable="d" Loaded="user_Loaded"
|
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">
|
BorderBrush="White" Background="White">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" Background="#FFCECECE"/>
|
<GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" Background="#FFCECECE"/>
|
||||||
<Grid Grid.Row="0">
|
<Grid Grid.Row="0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition MinWidth="300" MaxWidth="600"/>
|
<ColumnDefinition MinWidth="200" MaxWidth="500"/>
|
||||||
<ColumnDefinition Width="5"/>
|
<ColumnDefinition Width="5"/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
@@ -48,10 +48,12 @@
|
|||||||
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,145,0,50" TextWrapping="Wrap" Text="{x:Static lang:Resources.Remark}"
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,145,0,50" TextWrapping="Wrap" Text="{x:Static lang:Resources.Remark}"
|
||||||
VerticalAlignment="Top" Width="40" FontSize="20"/>
|
VerticalAlignment="Top" Width="40" FontSize="20"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<ScrollViewer Grid.Column="2" Margin="0" VerticalScrollBarVisibility="Auto">
|
<Grid Grid.Column="2" Margin="0">
|
||||||
<WrapPanel Orientation="Horizontal" x:Name="Capacity" Background="White" Margin="0,0,0,0">
|
<ScrollViewer Margin="0" VerticalScrollBarVisibility="Auto">
|
||||||
</WrapPanel>
|
<WrapPanel Orientation="Horizontal" x:Name="Capacity" >
|
||||||
</ScrollViewer>
|
</WrapPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
<!--表-->
|
<!--表-->
|
||||||
<DataGrid Grid.Row="2" x:Name="DataGriduser" MouseDoubleClick="DataGridMac_MouseDoubleClick" SelectionMode="Single" AlternationCount="2" IsReadOnly="True"
|
<DataGrid Grid.Row="2" x:Name="DataGriduser" MouseDoubleClick="DataGridMac_MouseDoubleClick" SelectionMode="Single" AlternationCount="2" IsReadOnly="True"
|
||||||
@@ -88,10 +90,10 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</DataGrid.CellStyle>
|
</DataGrid.CellStyle>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.USER}" Binding="{Binding UserCode}" Width="200" FontSize="15" MaxWidth="200" MinWidth="200" CanUserReorder="False"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.USER}" Binding="{Binding Name}" Width="200" FontSize="15" MaxWidth="200" MinWidth="200" CanUserReorder="False"/>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.Group}" Binding="{Binding GROUP_CODE}" Width="200" FontSize="15" MaxWidth="200" MinWidth="200" CanUserReorder="False"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.Group}" Binding="{Binding Groups}" Width="200" FontSize="15" MaxWidth="200" MinWidth="200" CanUserReorder="False"/>
|
||||||
<DataGridTextColumn Binding="{Binding Capacity}" FontSize="15" MaxWidth="0" MinWidth="0" CanUserReorder="False"/>
|
<DataGridTextColumn Binding="{Binding Capacity}" FontSize="15" MaxWidth="0" MinWidth="0" CanUserReorder="False"/>
|
||||||
<DataGridTextColumn Header="{x:Static lang:Resources.Remark}" Binding="{Binding Note}" Width="600" FontSize="15" MinWidth="100" CanUserReorder="False"/>
|
<DataGridTextColumn Header="{x:Static lang:Resources.Remark}" Binding="{Binding Note}" Width="*" FontSize="15" MinWidth="100" CanUserReorder="False"/>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<!--存储按钮-->
|
<!--存储按钮-->
|
||||||
|
|||||||
+54
-18
@@ -1,5 +1,7 @@
|
|||||||
using SunlightCentralizedControlManagement_SCCM_.View;
|
using nGantt.GanttChart;
|
||||||
|
using SunlightCentralizedControlManagement_SCCM_.View;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -14,30 +16,34 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class User : Window
|
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];
|
CheckBox[] checkBoxes = new CheckBox[99];
|
||||||
string[] strings = new string[0] { };
|
string[] strings = new string[13] {"修改系统设置", "修改用户设置",
|
||||||
|
"单机监控","单机控制","单机设置","新建排程","排程编辑","排程删除",
|
||||||
|
"历史曲线","工艺查看","工艺编辑","工艺删除","输送信息"};
|
||||||
public User()
|
public User()
|
||||||
{
|
{
|
||||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
InitializeComponent();
|
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++)
|
for (int i = 0; i < strings.Length; i++)
|
||||||
{
|
{
|
||||||
checkBoxes[i] = new CheckBox();
|
checkBoxes[i] = new CheckBox();
|
||||||
checkBoxes[i].Content = strings[i].ToString();
|
checkBoxes[i].Content = strings[i].ToString();
|
||||||
checkBoxes[i].FontSize = 20;
|
checkBoxes[i].FontSize = 20;
|
||||||
checkBoxes[i].Width = 80;
|
checkBoxes[i].Width = 200;
|
||||||
checkBoxes[i].Height = 50;
|
checkBoxes[i].Height = 50;
|
||||||
checkBoxes[i].IsEnabled = false;
|
|
||||||
Capacity.Children.Add(checkBoxes[i]);
|
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)//输入事件
|
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]*$");// 非负浮点数
|
Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数
|
||||||
e.Handled = !re.IsMatch(e.Text);
|
e.Handled = !re.IsMatch(e.Text);
|
||||||
}
|
}
|
||||||
string Capacity_;
|
|
||||||
private void DataGridMac_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
|
private void DataGridMac_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
|
||||||
{
|
{
|
||||||
|
string Capacity_;
|
||||||
int rownum = DataGriduser.SelectedIndex;//获取鼠标选中行并定义变量
|
int rownum = DataGriduser.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
if (rownum != -1)//判断鼠标定位是否有效
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
{
|
{
|
||||||
@@ -56,12 +63,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
|||||||
GROUP.Text = (DataGriduser.Columns[1].GetCellContent(DataGriduser.Items[rownum]) as TextBlock).Text.Trim();
|
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();
|
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();
|
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_number = new Regex(@"^[0-9]+(.[0-9]{1,2})?$");//校验用正则表达式有1~2位小数的正实数
|
||||||
Regex re_char = new Regex(@"^[A-Za-z0-9\s@()()/+!!_-]+$");//校验用正则表达式由数字,26个英文字母,空白字符和@()()/+!!_-组成的字符串
|
Regex re_char = new Regex(@"^[A-Za-z0-9\s@()()/+!!_-]+$");//校验用正则表达式由数字,26个英文字母,空白字符和@()()/+!!_-组成的字符串
|
||||||
@@ -69,15 +88,32 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
|||||||
string name = _Name.Text;
|
string name = _Name.Text;
|
||||||
string password = Pasword.Text;
|
string password = Pasword.Text;
|
||||||
string Group = GROUP.Text;
|
string Group = GROUP.Text;
|
||||||
int Cap = 0;
|
string Cap = null;
|
||||||
string note = Note.Text;
|
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<string, object> USER_new = new Dictionary<string, object>();//缓存函数
|
||||||
|
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)//删除按钮事件
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user