79 lines
2.0 KiB
C#
79 lines
2.0 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
|
|
{
|
|
public partial class MES_URL : Form
|
|
{
|
|
public MES_URL()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void MES_URL_Load(object sender, EventArgs e)
|
|
{
|
|
dataGridView1.AutoGenerateColumns = false;
|
|
GetInfo();
|
|
}
|
|
|
|
private void 保存_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
SQLiteHelper<t_interface> sQLiteHelper = new db.SQLiteHelper<t_interface>();
|
|
var result = sQLiteHelper.UpdateAll((List<t_interface>)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 查询_Click(object sender, EventArgs e)
|
|
{
|
|
GetInfo();
|
|
}
|
|
|
|
public void GetInfo()
|
|
{
|
|
try
|
|
{
|
|
SQLiteHelper<t_interface> sQLiteHelper = new db.SQLiteHelper<t_interface>();
|
|
var result = sQLiteHelper.QueryAll();
|
|
if (result.Success)
|
|
{
|
|
dataGridView1.DataSource = null;
|
|
dataGridView1.DataSource = result.Data;
|
|
dataGridView1.Refresh();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|