染色机计算机
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

60 lines
2.4 KiB

using DyeingComputer.View;
using DyeingComputer.ViewModel;
using ScottPlot.Colormaps;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Documents;
using System.Xml.Linq;
using static DyeingComputer.UserClass.SqliteHelper;
namespace DyeingComputer.UserClass
{
public class APILog
{
private static SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly static string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
private readonly static string LOGAddress = Environment.CurrentDirectory + "\\DataBase\\LOG.db"; //数据库路径
public async static void DBlog(string Name ,string ID ,string Api,string MESSAGE)
{
await Task.Run(() =>
{
Dictionary<string, object> API_LOG = new Dictionary<string, object>();//缓存函数
API_LOG.Add("NAME",Name);
API_LOG.Add("ID", ID);
API_LOG.Add("API", Api);
API_LOG.Add("MESSAGE", MESSAGE);
API_LOG.Add("TIME", MainWindowViewModel.SYSTime);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
SQLiteHelpers.InsertData("SERVER", API_LOG);//行插入
SQLiteHelpers.Close(); //关闭连接
API_LOG.Clear();
});
}
public async static void LOGlog(string WorkOrder, string TYPE, string Command, string MESSAGE)
{
await Task.Run(() =>
{
Dictionary<string, object> API_LOG = new Dictionary<string, object>();//缓存函数
API_LOG.Add("WorkOrder", WorkOrder);
API_LOG.Add("TYPE", TYPE);
API_LOG.Add("Command", Command);
API_LOG.Add("MESSAGE", MESSAGE);
API_LOG.Add("TIME", MainWindowViewModel.SYSTime);
SQLiteHelpers = new SQLiteHelper(LOGAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
SQLiteHelpers.InsertData("OperationLog", API_LOG);//行插入
SQLiteHelpers.Close(); //关闭连接
API_LOG.Clear();
});
}
}
}