108 lines
3.3 KiB
C#
108 lines
3.3 KiB
C#
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 WindowsFormsApp1.db;
|
|
using WindowsFormsApp1.mod;
|
|
|
|
namespace WindowsFormsApp1.form
|
|
{
|
|
public partial class FLOW_Manage : Form
|
|
{
|
|
public FLOW_Manage()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void 查询_Click(object sender, EventArgs e)
|
|
{
|
|
GetInfo();
|
|
}
|
|
|
|
private void 保存_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
SQLiteHelper<t_flow> sQLiteHelper = new db.SQLiteHelper<t_flow>();
|
|
var result = sQLiteHelper.UpdateAll((List<t_flow>)dataGridView1.DataSource);
|
|
if (result.Success)
|
|
{
|
|
MessageBox.Show("更新成功");
|
|
GetInfo();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("更新失败");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show($"更新失败,错误原因{ex.Message}");
|
|
}
|
|
}
|
|
|
|
private void 关闭_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void FLOW_Mange_Load(object sender, EventArgs e)
|
|
{
|
|
dataGridView1.AutoGenerateColumns = false;
|
|
|
|
SQLiteHelper<t_interface> sQLiteHelper1 = new db.SQLiteHelper<t_interface>();
|
|
var result1 = sQLiteHelper1.QueryAll();
|
|
if (!result1.Success)
|
|
{
|
|
MessageBox.Show("查询失败");
|
|
return;
|
|
}
|
|
result1.Data.Insert(0, new t_interface { id = 0, name = "" });
|
|
|
|
var comboBoxColumn = (DataGridViewComboBoxColumn)dataGridView1.Columns[3];
|
|
// 绑定数据源到 ComboBox
|
|
comboBoxColumn.DataSource = result1.Data;
|
|
comboBoxColumn.DisplayMember = "name";
|
|
comboBoxColumn.ValueMember = "id";
|
|
|
|
// 设置默认值为 Product 的 CategoryId
|
|
comboBoxColumn.DataPropertyName = "hopeinterfaceid"; // 绑定数据源中的 CategoryId 字段
|
|
|
|
var comboBoxColumn1 = (DataGridViewComboBoxColumn)dataGridView1.Columns[5];
|
|
// 绑定数据源到 ComboBox
|
|
comboBoxColumn1.DataSource = result1.Data;
|
|
comboBoxColumn1.DisplayMember = "name";
|
|
comboBoxColumn1.ValueMember = "id";
|
|
|
|
// 设置默认值为 Product 的 CategoryId
|
|
comboBoxColumn1.DataPropertyName = "errinterfaceid"; // 绑定数据源中的 CategoryId 字段
|
|
|
|
GetInfo();
|
|
}
|
|
|
|
public void GetInfo()
|
|
{
|
|
try
|
|
{
|
|
SQLiteHelper<t_flow> sQLiteHelper = new db.SQLiteHelper<t_flow>();
|
|
var result = sQLiteHelper.Query(a => a.flowid == Init.t_Line.flowid);
|
|
if (result.Success)
|
|
{
|
|
dataGridView1.DataSource = null;
|
|
dataGridView1.DataSource = result.Data;
|
|
dataGridView1.Refresh();
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|