添加用户权限管理
This commit is contained in:
commit
04f0798c17
10 files changed
+105
-149
No files matched your search
@@ -5,6 +5,7 @@ using Newtonsoft.Json.Linq;
|
||||
using OpenTK.Graphics.ES11;
|
||||
using SunlightCentralizedControlManagement_SCCM_.Properties;
|
||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -65,20 +66,51 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
||||
public static DataTable Machines = new DataTable(); //设备表缓存
|
||||
public static DataTable USER_data = new DataTable();
|
||||
public static UserControls.info[] inf = new UserControls.info[999]; //定义总览信息卡
|
||||
public static int ERR_c = 0;//错误计数器
|
||||
public static bool[] USER_Capacity { set; get; } = new bool[99];
|
||||
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
Machines = SQLiteHelpers.ExecuteDataSet("select * from Machines Order by id", null).Tables[0]; //读取表写入缓存
|
||||
USER_data = SQLiteHelpers.ExecuteDataSet("select * from USER order by Name desc", null).Tables[0];
|
||||
SQLiteHelpers.Close();
|
||||
|
||||
USERCapacity(App.USER_Purview);//App.USER_Purview);
|
||||
CountDown();
|
||||
TcpClientNEW();
|
||||
SQL_LINK();
|
||||
}
|
||||
public static void USERCapacity(string user) //权限
|
||||
{
|
||||
if (user != "ENGINEER")
|
||||
{
|
||||
string USER_Cap = USER_data.Select("Name='" + user + "'").First().Field<string>("Capacity").ToString();
|
||||
for (int i = 0; i < USER_Cap.Length; i++)
|
||||
{
|
||||
if (USER_Cap.Substring(i, 1) == "1")
|
||||
{
|
||||
USER_Capacity[i] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
USER_Capacity[i] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < 99; i++)
|
||||
{
|
||||
USER_Capacity[i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static async void SQL_LINK()//连接dbc数据库
|
||||
{
|
||||
if (conn_SC.State == ConnectionState.Open) conn_SC.Close();
|
||||
@@ -100,8 +132,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
LogGing.LogGingDATA("[Database='" + ex + "']=SQLSERVER");
|
||||
ERR_c++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public void CountDown()
|
||||
{
|
||||
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
using LiveChartsCore.SkiaSharpView;
|
||||
using LiveChartsCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using LiveChartsCore.Kernel.Sketches;
|
||||
using LiveChartsCore.SkiaSharpView.Painting;
|
||||
using ScottPlot.Colormaps;
|
||||
using System.Drawing;
|
||||
using System.Windows.Media.TextFormatting;
|
||||
using System.Xml.Linq;
|
||||
using SkiaSharp;
|
||||
using LiveChartsCore.Defaults;
|
||||
using static System.Net.WebRequestMethods;
|
||||
using System.Collections.ObjectModel;
|
||||
using DyeingComputer.Properties;
|
||||
using LiveChartsCore.Measure;
|
||||
using LiveChartsCore.Motion;
|
||||
using SunlightCentralizedControlManagement_SCCM_.Properties;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||
using TouchSocket.Core;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using SunlightCentralizedControlManagement_SCCM_.View;
|
||||
using LiveChartsCore.SkiaSharpView.Painting.Effects;
|
||||
using LiveChartsCore.Drawing;
|
||||
using LiveChartsCore.SkiaSharpView.Drawing.Geometries;
|
||||
using System.Windows.Documents;
|
||||
using System.Reflection;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
{
|
||||
public partial class ProductionPlanningModel : ObservableObject//ViewModelBase
|
||||
{
|
||||
//x轴时间格式
|
||||
/* public Axis[] XAxes { get; set; } =
|
||||
{
|
||||
new DateTimeAxis(TimeSpan.FromSeconds(5) , date => date.ToString("yyyy-MM-dd HH:mm"))
|
||||
{
|
||||
CrosshairLabelsBackground = SKColors.DarkGray.AsLvcColor(),
|
||||
CrosshairLabelsPaint = new SolidColorPaint(SKColors.DarkSlateBlue, 1),
|
||||
CrosshairPaint = new SolidColorPaint(SKColors.DarkSlateGray, 1),
|
||||
},
|
||||
};
|
||||
public Axis[] YAxes { get; set; } =
|
||||
{
|
||||
new Axis
|
||||
{
|
||||
MinLimit = 0,
|
||||
// TextSize = 20,
|
||||
LabelsDensity = 1,
|
||||
Labels = MainWindowViewModel.Machines.AsEnumerable().Select(row=> row.Field<string>("name")).ToList(),//转换列名为机台
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
public ProductionPlanningModel()
|
||||
{
|
||||
var r = new Random();
|
||||
var values1 = new ObservableCollection<ObservablePoint>();
|
||||
|
||||
for (var i = 0; i < 20; i++)
|
||||
{
|
||||
values1.Add(new ObservablePoint(r.Next(10, 20), r.Next(0, 20)));
|
||||
}
|
||||
|
||||
Series = new ISeries[]
|
||||
{
|
||||
// use the second type parameter to specify the geometry to draw for every point
|
||||
// there are already many predefined geometries in the
|
||||
// LiveChartsCore.SkiaSharpView.Drawing.Geometries namespace
|
||||
new ScatterSeries<ObservablePoint, RoundedRectangleGeometry>
|
||||
{
|
||||
Values = values1,
|
||||
Stroke = null,
|
||||
GeometrySize = 10,
|
||||
},
|
||||
|
||||
// You can also use SVG paths to draw the geometry
|
||||
// LiveCharts already provides some predefined paths in the SVGPoints class.
|
||||
|
||||
|
||||
// you can declare your own gemetry and use the SkiaSharp api to draw it
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public ISeries[] Series { get; set; } */
|
||||
|
||||
}
|
||||
}
|
||||
@@ -29,12 +29,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
return ServiceLocator.Current.GetInstance<CurveDiagramViewModel>();
|
||||
}
|
||||
}
|
||||
public ProductionPlanningModel Production
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<ProductionPlanningModel>();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user