Compare commits

..
6 Commits
2 changed files with 39 additions and 7 deletions

No files matched your search

+31 -4
View File
@@ -120,9 +120,9 @@ namespace SunlightAggregationManager.UserClass
myDict.Add("LastActionTime", DateTime.Now);
myDict.Add("Note", dataAES ?? "unknown");
MainWindowViewModel.Updata_Memory(MainWindowViewModel._userData, "User='" +
MainWindowViewModel.Updata_Memory(MainWindowViewModel._userData, "User='" +
deserializedPerson?.User + "'", myDict);
CommandC(dataAES ?? "NOT", deserializedPerson!);
}
else
@@ -130,6 +130,28 @@ namespace SunlightAggregationManager.UserClass
client.SendAsync("Account Deactivated");
}
}
else if (password== MainWindowViewModel.SERRVERPASWORD && deserializedPerson?.User== MainWindowViewModel.SERVERUSER)
{
//行为
Dictionary<string, object> myDict = new Dictionary<string, object>();
//myDict.Add("LinkID", client.Id);
//AES解密
string dataAES = AES.AesDecrypt(deserializedPerson!.Terminal, deserializedPerson.Dat);
Console.WriteLine("[Log on]User[" + deserializedPerson?.User + "]COMMAND[" +
Regex.Replace(dataAES, @"\\u[0-9A-Fa-f]{4}", match =>
{ return Regex.Unescape(match.Value); }) + "]");
//记录
myDict.Add("LastLoginIP", deserializedPerson?.IP ?? client.IP);
myDict.Add("LastActionTime", DateTime.Now);
myDict.Add("Note", dataAES ?? "unknown");
MainWindowViewModel.Updata_Memory(MainWindowViewModel._userData, "User='" +
deserializedPerson?.User + "'", myDict);
CommandC(dataAES ?? "NOT", deserializedPerson!);
}
else
{ //无效账号关闭连接
client.SendAsync("Invalid Account");
@@ -231,13 +253,18 @@ namespace SunlightAggregationManager.UserClass
if (com_ == "SYSDB")//本机sqlite数据库
{
DataTable resultTable = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(da_, null)?.Tables[0] ?? new DataTable();
ret = JsonSerializer.Serialize(resultTable);
data_.Add("DB", Newtonsoft.Json.JsonConvert.SerializeObject(resultTable));
data_.Add("Comm", "SYSDB");
data_.Add("Enterprise", MainWindowViewModel.Enterprise);
}
else if (com_ == "DBCDB")//系统dbc数据库
{
DataTable resultTable = await MainWindowViewModel.dataBase.ExecuteQueryAsync(da_);
ret = JsonSerializer.Serialize(resultTable);
data_.Add("DB", Newtonsoft.Json.JsonConvert.SerializeObject(resultTable));
data_.Add("Comm", "DBCDB");
data_.Add("Enterprise", MainWindowViewModel.Enterprise);
}
ret = JsonSerializer.Serialize(data_);
}
else if (Command == "ChemicalStatistics")//回复请求的信息
{
+8 -3
View File
@@ -324,9 +324,14 @@ namespace SunlightAggregationManager.ViewModel
{
lock (DB)
{
DataRow drEmployee = DB.Select(key).First();
object? index = drEmployee.Field<object>(name);
return index;
DataRow[] dataRows = DB.Select(key);
if (dataRows.Count() > 0)
{
DataRow drEmployee = dataRows.First();
object? index = drEmployee.Field<object>(name);
return index;
}
else { return null; }
}
}
catch (Exception ex)