|
|
|
@ -9,7 +9,12 @@ using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
using Chloe.PostgreSQL.DDL;
|
|
|
|
|
using Chloe.RDBMS.DDL;
|
|
|
|
|
using DB;
|
|
|
|
|
using DB.Entity;
|
|
|
|
|
using NewLife.Data;
|
|
|
|
|
using NewLife.Log;
|
|
|
|
|
using Tool;
|
|
|
|
|
|
|
|
|
|
namespace RfidWeb
|
|
|
|
@ -22,20 +27,48 @@ namespace RfidWeb
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
|
|
|
|
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
// 如果所有的日志在记录之前需要在控制台显示出来
|
|
|
|
|
logNet.BeforeSaveToFile += (object sender, HslEventArgs e) =>
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(e.HslMessage.ToString());
|
|
|
|
|
};
|
|
|
|
|
logNet.ConsoleOutput = true;
|
|
|
|
|
|
|
|
|
|
logNet.WriteInfo("nihao");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果所有的日志在记录之前需要在控制台显示出来
|
|
|
|
|
logNet.BeforeSaveToFile += (object sender, HslEventArgs e) =>
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(e.HslMessage.ToString());
|
|
|
|
|
};
|
|
|
|
|
DbInfo.Init(typeof(RoleMapper).Assembly);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dbContext = DbFactory.GetContext;
|
|
|
|
|
new PostgreSQLTableGenerator(dbContext).CreateTables(TableCreateMode.CreateNew);
|
|
|
|
|
|
|
|
|
|
dbContext.Insert(new Role()
|
|
|
|
|
{
|
|
|
|
|
ID = SnowflakeFactory.NewId,
|
|
|
|
|
RoleName = "管理层",
|
|
|
|
|
RoleLevel = 1
|
|
|
|
|
});
|
|
|
|
|
dbContext.Insert(new Role()
|
|
|
|
|
{
|
|
|
|
|
ID = SnowflakeFactory.NewId,
|
|
|
|
|
RoleName = "设备层",
|
|
|
|
|
RoleLevel = 2
|
|
|
|
|
});
|
|
|
|
|
dbContext.Insert(new Role()
|
|
|
|
|
{
|
|
|
|
|
ID = SnowflakeFactory.NewId,
|
|
|
|
|
RoleName = "使用层",
|
|
|
|
|
RoleLevel = 3
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|