You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CaiQie/RfidWeb/FromSQl.cs

198 lines
5.3 KiB
C#

3 weeks ago

1 month ago
using DB.Entity;
using DB;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
3 weeks ago
using Chloe.PostgreSQL.DDL;
using Chloe.RDBMS.DDL;
1 month ago
using Tool;
namespace RfidWeb
{
public partial class FromSQl : Form
{
public FromSQl()
{
InitializeComponent();
3 weeks ago
4 weeks ago
1 month ago
}
private void ucBtnExt1_BtnClick(object sender, EventArgs e)
{
//DbInfo.Init(typeof(RoleMapper).Assembly);
DbInfo.Init(typeof(UserInfo).Assembly);
var dbContext = DbFactory.GetContext;
1 month ago
new PostgreSQLTableGenerator(dbContext).CreateTables(TableCreateMode.CreateIfNotExists);
1 month ago
//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
//});
1 month ago
//dbContext.Insert(new UserInfo()
//{
// ID = SnowflakeFactory.NewId,
// RoleId =
// 7254091842295074816,
// UserName = "管理员1",
// Pwd = "E10ADC3949BA59ABBE56E057F20F883E",
1 month ago
1 month ago
//});
//dbContext.Insert(new UserInfo()
//{
// ID = SnowflakeFactory.NewId,
// RoleId =
// 7254091842295074816,
// UserName = "管理员2",
// Pwd = "E10ADC3949BA59ABBE56E057F20F883E",
1 month ago
1 month ago
//});
//dbContext.Insert(new UserInfo()
//{
// ID = SnowflakeFactory.NewId,
// RoleId =
// 7254091842295074816,
// UserName = "管理员2",
// Pwd = "E10ADC3949BA59ABBE56E057F20F883E",
1 month ago
1 month ago
//});
1 month ago
1 month ago
//dbContext.Insert(new UserInfo()
//{
// ID = SnowflakeFactory.NewId,
// RoleId =
// 7254091842987134976,
// UserName = "设备层1",
// Pwd = "E10ADC3949BA59ABBE56E057F20F883E",
1 month ago
1 month ago
//});
//dbContext.Insert(new UserInfo()
//{
// ID = SnowflakeFactory.NewId,
// RoleId =
// 7254091842987134976,
// UserName = "设备层2",
// Pwd = "E10ADC3949BA59ABBE56E057F20F883E",
1 month ago
1 month ago
//});
//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",
//});
1 month ago
// new PostgreSQLTableGenerator(dbContext).CreateTables(TableCreateMode.CreateNew);
}
1 month ago
3 weeks ago
private long GetId=> SnowflakeFactory.NewId;
1 month ago
private void ucBtnExt2_BtnClick(object sender, EventArgs e)
{
var dbContext = DbFactory.GetContext;
3 weeks ago
var dic = new Dictionary<string, string>();
dic["HMI_button_LP_ON[0].0"] = "右料盘横移电缸";
for (int i = 1; i < 31; i++)
{
string key = "HMI_button_LP_ON[0]." + i;
dic[key] = "";
}
for (int i = 0; i < 31; i++)
{
string key = "HMI_button_LP_ON[1]." + i;
dic[key] = "";
}
foreach (var eti in dic)
{
Point p = new Point()
{
ID = GetId,
FromType = "料盘页手动界面",
DataType = "bool",
CreateDate = DateTime.Now,
LastModifyDate = DateTime.Now,
CreateUserId = "",
CreateUserName = "",
LastModifyUserId = "",
LastModifyUserName = "",
PointName = eti.Value,
PointAddress = eti.Key
};
dbContext.Insert(p);
}
1 month ago
}
1 month ago
}
}