添加用户管理页面
This commit is contained in:
commit
051c015b05
6 files changed
+289
-7
No files matched your search
+9
-3
@@ -68,7 +68,7 @@
|
||||
<materialDesign:PackIcon Kind="Menu" Foreground="#FF00204E" Width="25" Height="25"/>
|
||||
</Button>
|
||||
</Grid>
|
||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
|
||||
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD" >
|
||||
<ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_Whole">
|
||||
<StackPanel Orientation="Horizontal" >
|
||||
<materialDesign:PackIcon Kind="ListBox" Width="25" Height="25" Margin="10" VerticalAlignment="Center" />
|
||||
@@ -115,9 +115,15 @@
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Grid x:Name="gdMian" Background="White" Margin="60,50,0,0">
|
||||
<Grid x:Name="gdMian" Background="White" Margin="60,50,0,0">
|
||||
<ContentControl x:Name="Picture"/>
|
||||
<Grid x:Name="Cdk_page" Visibility="Collapsed" Margin="0,0,0,0" Background="White" Opacity="0.8">
|
||||
<TextBlock Height="150" Margin="0,0,0,300" TextWrapping="Wrap" Text="注册信息到期,处理注册信息预计需要3个工作日,为避免影响系统使用请及时提交注册信息!" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<TextBlock x:Name="keytext" Height="50" Margin="0,0,0,100" TextWrapping="Wrap" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Red"/>
|
||||
<TextBlock Height="50" Margin="0,0,0,0" TextWrapping="Wrap" Text="请联系 SUNLIGHT" Width="300" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Button Content="{x:Static lang:Resources.Permit }" HorizontalAlignment="Center" Height="50" Margin="200,100,0,-100" VerticalAlignment="Center" Width="150" FontSize="24" BorderBrush="{x:Null}" Background="DarkGray" Click="ButtonPermit_Click"/>
|
||||
<Button Content="{x:Static lang:Resources.Help }" HorizontalAlignment="Center" Height="50" Margin="0,100,200,-100" VerticalAlignment="Center" Width="150" FontSize="24" BorderBrush="{x:Null}" Background="DarkGray" Click="Buttonhelp_Click"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
+79
-4
@@ -3,6 +3,7 @@ using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
@@ -15,6 +16,7 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_
|
||||
@@ -28,7 +30,8 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
{
|
||||
DataContext = new MainWindowViewModel();
|
||||
InitializeComponent();
|
||||
|
||||
CountDown();
|
||||
CDkey_();
|
||||
}
|
||||
|
||||
private void ButtonPopUpLogout_Click(object sender, RoutedEventArgs e)
|
||||
@@ -99,14 +102,15 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
Picture.Content = new View.ProgramgroupView();
|
||||
}
|
||||
private void ListViewItem_ConveyorCenters(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
|
||||
{
|
||||
WindowsView.User user_ =new WindowsView.User();
|
||||
user_.Show();
|
||||
}
|
||||
|
||||
private void Buttonhelp_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
WindowsView.Help help_page = new WindowsView.Help();
|
||||
help_page.Show();
|
||||
help_page.Show();
|
||||
}
|
||||
private void ButtonSYS_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
@@ -118,5 +122,76 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
WindowsView.CDKEY cDKEY = new WindowsView.CDKEY();
|
||||
cDKEY.Show();
|
||||
}
|
||||
|
||||
public void CountDown()
|
||||
{
|
||||
DispatcherTimer timer1s = new DispatcherTimer//初始化循环
|
||||
{
|
||||
Interval = TimeSpan.FromHours(1)
|
||||
};
|
||||
timer1s.Tick += Tick_Event_1H;
|
||||
timer1s.Start();
|
||||
}
|
||||
void Tick_Event_1H(object sender, EventArgs e)//Tick_Event周期执行事件
|
||||
{
|
||||
CDkey_();
|
||||
}
|
||||
|
||||
private static UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
||||
private void CDkey_()
|
||||
{
|
||||
try
|
||||
{
|
||||
string id_1 = MainWindowViewModel.SN_ID.Substring(5, 1) + MainWindowViewModel.SN_ID.Substring(0, 1) +
|
||||
MainWindowViewModel.SN_ID.Substring(4, 1) + MainWindowViewModel.SN_ID.Substring(1, 1) +
|
||||
MainWindowViewModel.SN_ID.Substring(3, 1) + MainWindowViewModel.SN_ID.Substring(2, 1);
|
||||
if ((id_1 == MainWindowViewModel.SN_KEY.Substring(0, 6)) && (MainWindowViewModel.SN_KEY.Length == 16))
|
||||
{
|
||||
if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(MainWindowViewModel.SN_KEY.Substring(0, 12)), true) == MainWindowViewModel.SN_KEY.Substring(12, 4)) //校验key的crc校验值
|
||||
{
|
||||
string Y = (2255 - StrToInt.To16Convert10(MainWindowViewModel.SN_KEY.Substring(6, 2))).ToString();
|
||||
string M = (255 - StrToInt.To16Convert10(MainWindowViewModel.SN_KEY.Substring(8, 2))).ToString();
|
||||
string D = (255 - StrToInt.To16Convert10(MainWindowViewModel.SN_KEY.Substring(10, 2))).ToString();
|
||||
|
||||
string YY = DateTime.Now.ToString("yyyy");
|
||||
string MM = DateTime.Now.ToString("MM");
|
||||
string DD = DateTime.Now.ToString("dd");
|
||||
|
||||
keytext.Text = "注册到期时间: " + Y + "/" + M + "/" + D;
|
||||
|
||||
if (string.Compare(Y, YY) < 0)
|
||||
{
|
||||
if (string.Compare(M, MM) < 0)
|
||||
{
|
||||
if (string.Compare(D, DD) < 0)
|
||||
{
|
||||
Configini.IniWritevalue("SN", " SN1", "0000000000000000");
|
||||
Cdk_page.Visibility = Visibility.Visible; //cdk_pageT_T = -1; //防止触发倒计时
|
||||
}
|
||||
else if ((int.Parse(D) - int.Parse(DD)) <= 10)//提前10天提醒
|
||||
{
|
||||
Cdk_page.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Cdk_page.Visibility = Visibility.Visible;
|
||||
keytext.Text = "许可证安全校验错误请重新激活";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Cdk_page.Visibility = Visibility.Visible;
|
||||
keytext.Text = "计算机信息变更当前许可证失效";
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
keytext.Text = "许可证安全校验错误请重新激活";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -187,6 +187,9 @@
|
||||
<Compile Include="WindowsView\SchedulingTime.xaml.cs">
|
||||
<DependentUpon>SchedulingTime.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindowsView\User.xaml.cs">
|
||||
<DependentUpon>User.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindowsView\ViewStep.xaml.cs">
|
||||
<DependentUpon>ViewStep.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -292,6 +295,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="WindowsView\User.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="WindowsView\ViewStep.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -59,12 +59,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
public static string SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||
public static string SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
||||
public static string SQLPASWORD = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
||||
public static string SN_ID = Configini.IniReadvalue("SN", "SN2");
|
||||
public static string SN_KEY = Configini.IniReadvalue("SN", "SN1");
|
||||
public static SqlConnection conn_SC =new SqlConnection();//数据库
|
||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
||||
public static DataTable Machines = new DataTable(); //设备表缓存
|
||||
public static UserControls.info[] inf = new UserControls.info[999]; //定义总览信息卡
|
||||
public static int ERR_c = 0;//错误计数器
|
||||
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.WindowsView.User"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView"
|
||||
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
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"
|
||||
BorderBrush="White" Background="White">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="5"/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="100"/>
|
||||
</Grid.RowDefinitions>
|
||||
<GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" Background="#FFCECECE"/>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition MinWidth="300" MaxWidth="600"/>
|
||||
<ColumnDefinition Width="5"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" Background="#FFCECECE"/>
|
||||
<Grid Grid.Column="0">
|
||||
<!--名-->
|
||||
<TextBox x:Name="_Name" Height="30" Margin="105,10,10,100" VerticalAlignment="Top" FontSize="16" MaxLines="1" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,10,0,100" TextWrapping="Wrap" Text="{x:Static lang:Resources.USER}"
|
||||
VerticalAlignment="Top" Width="85" FontSize="20"/>
|
||||
<!--密码-->
|
||||
<TextBox x:Name="Pasword" Height="30" Margin="105,55,10,50" VerticalAlignment="Top" FontSize="16" MaxLines="1" InputMethod.IsInputMethodEnabled="False" />
|
||||
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,55,0,50" TextWrapping="Wrap" Text="{x:Static lang:Resources.Password}"
|
||||
VerticalAlignment="Top" Width="80" FontSize="20"/>
|
||||
<!--组-->
|
||||
<ComboBox x:Name="GROUP" Height="30" Margin="105,100,10,100" Text="USER" VerticalAlignment="Top" FontSize="16" IsReadOnly="True" IsEditable="True">
|
||||
<ComboBoxItem Content="CHIEF"></ComboBoxItem>
|
||||
<ComboBoxItem Content="POWERUSER"></ComboBoxItem>
|
||||
<ComboBoxItem Content="USER"></ComboBoxItem>
|
||||
</ComboBox>
|
||||
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,100,0,100" TextWrapping="Wrap" Text="{x:Static lang:Resources.Group}"
|
||||
VerticalAlignment="Top" Width="45" FontSize="20"/>
|
||||
<!--备注-->
|
||||
<TextBox x:Name="Note" Height="30" Margin="105,145,10,50" VerticalAlignment="Top" FontSize="16" MaxLines="1"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,145,0,50" TextWrapping="Wrap" Text="{x:Static lang:Resources.Remark}"
|
||||
VerticalAlignment="Top" Width="40" FontSize="20"/>
|
||||
</Grid>
|
||||
<ScrollViewer Grid.Column="2" Margin="0" VerticalScrollBarVisibility="Auto">
|
||||
<WrapPanel Orientation="Horizontal" x:Name="Capacity" Background="White" Margin="0,0,0,0">
|
||||
</WrapPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
<!--表-->
|
||||
<DataGrid Grid.Row="2" x:Name="DataGriduser" MouseDoubleClick="DataGridMac_MouseDoubleClick" SelectionMode="Single" AlternationCount="2" IsReadOnly="True"
|
||||
d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="{x:Null}"
|
||||
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2"
|
||||
CanUserResizeRows="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False"
|
||||
CanUserResizeColumns="False" CanUserSortColumns="False" HeadersVisibility ="Column" Background="{x:Null}">
|
||||
<DataGrid.RowStyle >
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
|
||||
<Setter Property="Background" Value="#FFFFFFFF" />
|
||||
</Trigger>
|
||||
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
|
||||
<Setter Property="Background" Value="#FFF0F0F0" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="False">
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.CellStyle>
|
||||
<Style TargetType="DataGridCell">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="MinWidth" Value="20"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#FFC0C0C0"/>
|
||||
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
|
||||
<Setter Property="Foreground" Value="#000000"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
<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.Group}" Binding="{Binding GROUP_CODE}" Width="200" FontSize="15" MaxWidth="200" MinWidth="200" 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"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<!--存储按钮-->
|
||||
<Button Grid.Row="3" Content="存储" HorizontalAlignment="Right" Height="50" VerticalAlignment="Center" Width="100" FontSize="30"
|
||||
Click="Button_Preservation" Margin="0,0,200,0">
|
||||
</Button>
|
||||
<!--删除按钮-->
|
||||
<Button Grid.Row="3" Content="删除" HorizontalAlignment="Right" Height="50" VerticalAlignment="Center" Width="100" FontSize="30"
|
||||
Click="Button_Delete" Margin="0,0,50,0">
|
||||
</Button>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,85 @@
|
||||
using SunlightCentralizedControlManagement_SCCM_.View;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
||||
{
|
||||
/// <summary>
|
||||
/// Machine.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class User : Window
|
||||
{
|
||||
|
||||
CheckBox[] checkBoxes = new CheckBox[99];
|
||||
string[] strings = new string[0] { };
|
||||
public User()
|
||||
{
|
||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private async 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].Height = 50;
|
||||
checkBoxes[i].IsEnabled = false;
|
||||
Capacity.Children.Add(checkBoxes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void Tb_KeyFloating(object sender, TextCompositionEventArgs e)//输入事件
|
||||
{
|
||||
//Regex re = new Regex("[^0-9.-]+");
|
||||
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)//数据表双击事件
|
||||
{
|
||||
int rownum = DataGriduser.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
/*定位选中行及指定列单元格文本信息*/
|
||||
_Name.Text = (DataGriduser.Columns[0].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();
|
||||
Note.Text = (DataGriduser.Columns[3].GetCellContent(DataGriduser.Items[rownum]) as TextBlock).Text.Trim();
|
||||
}
|
||||
|
||||
Pasword.Text = null; //清除密码框
|
||||
}
|
||||
|
||||
private async 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个英文字母,空白字符和@()()/+!!_-组成的字符串
|
||||
|
||||
string name = _Name.Text;
|
||||
string password = Pasword.Text;
|
||||
string Group = GROUP.Text;
|
||||
int Cap = 0;
|
||||
string note = Note.Text;
|
||||
string Stuff_sql;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user