private void LoadColumnInfo(string tabName) { ERP.DAL.ERPRepository repository = new DAL.ERPRepository(); var tableInfos = repository.GetTables(tabName); this.dataGridView1.DataSource = tableInfos.FirstOrDefault().ColumnInfos.ToDataTable(); }
private void Form1_Load(object sender, EventArgs e) { ERP.DAL.ERPRepository repository = new DAL.ERPRepository(); var tableInfo = repository.GetTableInfos("pre_customers"); string s = tableInfo.GetColumnSql(); var sortColumnInfos = tableInfo.SortColumnInfos; var data = repository.GetDataTable(s); this.dataGridView1.DataSource = data; }
private void EditTab_Frm_Load(object sender, EventArgs e) { ERP.DAL.ERPRepository repository = new DAL.ERPRepository(); var tableInfos = repository.GetTables(); var tabNames = from p in tableInfos select new { id = p.Id, name = p.Name }; foreach (var item in tabNames) { var node = this.treeView1.Nodes.Add(item.name); node.Tag = item.id; } }
public void Test_Add() { TableInfo tab = new TableInfo(); tab.Name = "pre_customers_demo"; tab.Type = 0; tab.ParentId = 0; tab.Desc = "客户信息表"; tab.AddColumnInfo("Id", "int", "自动编号", true, 1); tab.AddColumnInfo("Name", "nvarchar(100)", "客户名称", true, 2); tab.AddColumnInfo("Tel", "varchar(20)", "客户电话", true, 3); tab.AddColumnInfo("Company", "nvarchar(100)", "所属公司", true, 4); tab.AddColumnInfo("Email", "varchar(50)", "客户邮箱", false, 5); ERP.DAL.ERPRepository repository = new DAL.ERPRepository(); repository.AddTableInfo(tab); }
private void button1_Click(object sender, EventArgs e) { string tabName = this.treeView1.SelectedNode.Text; ERP.DAL.ERPRepository repository = new DAL.ERPRepository(); var colInfo = new Domain.ColumnInfo { Name = txt_name.Text, Type = txt_type.Text, IsSystem = txt_issystem.Text == "0" ? false : true, Sort = Convert.ToInt32(txt_sort.Text), Desc = txt_desc.Text, TableInfoId = Convert.ToInt32(treeView1.SelectedNode.Tag) }; repository.AddColToTabel(tabName, colInfo); repository.AddColToTableInfo(tabName, colInfo); this.LoadColumnInfo(tabName); }
public void TestMethod1() { ERP.DAL.ERPRepository repository = new DAL.ERPRepository(); var tableInfo = repository.GetTableInfos("pre_customers"); //ICollection<string> rs = repository.GetCols("pre_customers"); string s = tableInfo.GetColumnSql(); var sortColumnInfos = tableInfo.SortColumnInfos; Console.WriteLine(s); //repository.AddPreCustomers(); var data = repository.GetDataTable(s); foreach (DataRow row in data.Rows) { sortColumnInfos.ToList().ForEach(colInfo => { Console.Write(row[colInfo.Name].ToString() + ","); }); Console.WriteLine(); } }
public void AddPreCustomers_Test() { ERP.DAL.ERPRepository repository = new DAL.ERPRepository(); repository.AddPreCustomers(); }