|
|
|
|
using Chloe.PostgreSQL.DDL;
|
|
|
|
|
using Chloe.RDBMS.DDL;
|
|
|
|
|
using DB.Entity;
|
|
|
|
|
using DB;
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Microsoft.VisualBasic.ApplicationServices;
|
|
|
|
|
using Tool;
|
|
|
|
|
|
|
|
|
|
namespace RfidWeb
|
|
|
|
|
{
|
|
|
|
|
public partial class FromSQl : Form
|
|
|
|
|
{
|
|
|
|
|
public FromSQl()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ucBtnExt1_BtnClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//DbInfo.Init(typeof(RoleMapper).Assembly);
|
|
|
|
|
DbInfo.Init(typeof(UserInfo).Assembly);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dbContext = DbFactory.GetContext;
|
|
|
|
|
new PostgreSQLTableGenerator(dbContext).CreateTables(TableCreateMode.CreateIfNotExists);
|
|
|
|
|
|
|
|
|
|
//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
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//dbContext.Insert(new UserInfo()
|
|
|
|
|
//{
|
|
|
|
|
// ID = SnowflakeFactory.NewId,
|
|
|
|
|
// RoleId =
|
|
|
|
|
// 7254091842295074816,
|
|
|
|
|
// UserName = "管理员1",
|
|
|
|
|
// Pwd = "E10ADC3949BA59ABBE56E057F20F883E",
|
|
|
|
|
|
|
|
|
|
//});
|
|
|
|
|
//dbContext.Insert(new UserInfo()
|
|
|
|
|
//{
|
|
|
|
|
// ID = SnowflakeFactory.NewId,
|
|
|
|
|
// RoleId =
|
|
|
|
|
// 7254091842295074816,
|
|
|
|
|
// UserName = "管理员2",
|
|
|
|
|
// Pwd = "E10ADC3949BA59ABBE56E057F20F883E",
|
|
|
|
|
|
|
|
|
|
//});
|
|
|
|
|
//dbContext.Insert(new UserInfo()
|
|
|
|
|
//{
|
|
|
|
|
// ID = SnowflakeFactory.NewId,
|
|
|
|
|
// RoleId =
|
|
|
|
|
// 7254091842295074816,
|
|
|
|
|
// UserName = "管理员2",
|
|
|
|
|
// Pwd = "E10ADC3949BA59ABBE56E057F20F883E",
|
|
|
|
|
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//dbContext.Insert(new UserInfo()
|
|
|
|
|
//{
|
|
|
|
|
// ID = SnowflakeFactory.NewId,
|
|
|
|
|
// RoleId =
|
|
|
|
|
// 7254091842987134976,
|
|
|
|
|
// UserName = "设备层1",
|
|
|
|
|
// Pwd = "E10ADC3949BA59ABBE56E057F20F883E",
|
|
|
|
|
|
|
|
|
|
//});
|
|
|
|
|
//dbContext.Insert(new UserInfo()
|
|
|
|
|
//{
|
|
|
|
|
// ID = SnowflakeFactory.NewId,
|
|
|
|
|
// RoleId =
|
|
|
|
|
// 7254091842987134976,
|
|
|
|
|
// UserName = "设备层2",
|
|
|
|
|
// Pwd = "E10ADC3949BA59ABBE56E057F20F883E",
|
|
|
|
|
|
|
|
|
|
//});
|
|
|
|
|
//dbContext.Insert(new UserInfo()
|
|
|
|
|
//{
|
|
|
|
|
// ID = SnowflakeFactory.NewId,
|
|
|
|
|
// RoleId =
|
|
|
|
|
// 7254091842987134976,
|
|
|
|
|
// UserName = "设备层2",
|
|
|
|
|
// Pwd = "E10ADC3949BA59ABBE56E057F20F883E",
|
|
|
|
|
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//dbContext.Insert(new UserInfo()
|
|
|
|
|
//{
|
|
|
|
|
// ID = SnowflakeFactory.NewId,
|
|
|
|
|
// RoleId =
|
|
|
|
|
// 7254091842999717888,
|
|
|
|
|
// UserName = "使用层1",
|
|
|
|
|
// Pwd = "E10ADC3949BA59ABBE56E057F20F883E",
|
|
|
|
|
|
|
|
|
|
//});
|
|
|
|
|
//dbContext.Insert(new UserInfo()
|
|
|
|
|
//{
|
|
|
|
|
// ID = SnowflakeFactory.NewId,
|
|
|
|
|
// RoleId =
|
|
|
|
|
// 7254091842999717888,
|
|
|
|
|
// UserName = "使用层2",
|
|
|
|
|
// Pwd = "E10ADC3949BA59ABBE56E057F20F883E",
|
|
|
|
|
|
|
|
|
|
//});
|
|
|
|
|
//dbContext.Insert(new UserInfo()
|
|
|
|
|
//{
|
|
|
|
|
// ID = SnowflakeFactory.NewId,
|
|
|
|
|
// RoleId =
|
|
|
|
|
// 7254091842999717888,
|
|
|
|
|
// UserName = "使用层2",
|
|
|
|
|
// Pwd = "E10ADC3949BA59ABBE56E057F20F883E",
|
|
|
|
|
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// new PostgreSQLTableGenerator(dbContext).CreateTables(TableCreateMode.CreateNew);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ucBtnExt2_BtnClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var dbContext = DbFactory.GetContext;
|
|
|
|
|
for (int i = 0; i < 100; i++)
|
|
|
|
|
{
|
|
|
|
|
PointLog log = new PointLog();
|
|
|
|
|
log.ID = SnowflakeFactory.NewId;
|
|
|
|
|
log.PointName = "测试:" + i;
|
|
|
|
|
log.PointAddress = "DB:" + i;
|
|
|
|
|
log.Msg = "test:" + i;
|
|
|
|
|
log.CreateDate=DateTime.Now;
|
|
|
|
|
log.LastModifyDate=DateTime.Now;
|
|
|
|
|
log.LastModifyUserId = "123";
|
|
|
|
|
log.CreateUserId = "123";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dbContext.Insert(log);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|