using Aitex.Core.RT.DBCore; using Aitex.Sorter.Common; using DocumentFormat.OpenXml.Drawing.Charts; using DocumentFormat.OpenXml.Spreadsheet; using MECF.Framework.Common.ControlDataContext; using MECF.Framework.Common.Equipment; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using Venus_Core; namespace MECF.Framework.Common.DBCore { public class UserDataRecorder { public static void InserUser(UserItem userItem) { string sql = string.Format( "INSERT INTO \"user\" (" + "\"UserName\"," + "\"Role\"," + "\"Password\"," + "\"Notes\"" + ") VALUES (" + $"'{userItem.Name}'," + $"'{userItem.Role}'," + $"'{userItem.Password}'," + $"'{userItem.Notes}'" + ");"); DB.Insert(sql); } public static void DeleteUser(string userName) { string sql = string.Format( "DELETE FROM \"user\" where \"UserName\"=" + $"'{userName}'" + ";"); DB.Insert(sql); } public static List GetUserItems() { List result = new List(); string sql = string.Format($"SELECT * FROM \"user\""); DataSet ds = DB.ExecuteDataset(sql); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { result.Add(new UserItem() { No =Convert.ToInt32( ds.Tables[0].Rows[i]["No"]), Name= ds.Tables[0].Rows[i]["UserName"].ToString(), Role = ds.Tables[0].Rows[i]["Role"].ToString(), Password= ds.Tables[0].Rows[i]["Password"].ToString(), Notes= ds.Tables[0].Rows[i]["Notes"].ToString() }); } ds.Clear(); return result; } } }