添加项目文件。
This commit is contained in:
1 parent
d68cdea124
commit
faaf9136d6
51 files changed
+11674
No files matched your search
@@ -0,0 +1,78 @@
|
||||
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 PLC_Manage : Form
|
||||
{
|
||||
public PLC_Manage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void 查询_Click(object sender, EventArgs e)
|
||||
{
|
||||
GetInfo();
|
||||
}
|
||||
|
||||
private void 保存_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
SQLiteHelper<t_plc> sQLiteHelper = new db.SQLiteHelper<t_plc>();
|
||||
var result = sQLiteHelper.UpdateAll((List<t_plc>)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 PLC_Manage_Load(object sender, EventArgs e)
|
||||
{
|
||||
dataGridView1.AutoGenerateColumns = false;
|
||||
GetInfo();
|
||||
}
|
||||
|
||||
public void GetInfo()
|
||||
{
|
||||
try
|
||||
{
|
||||
SQLiteHelper<t_plc> sQLiteHelper = new db.SQLiteHelper<t_plc>();
|
||||
var result = sQLiteHelper.Query(a=> a.id == Init.t_Line.plcid1 || a.id == Init.t_Line.plcid2);
|
||||
if (result.Success)
|
||||
{
|
||||
dataGridView1.DataSource = null;
|
||||
dataGridView1.DataSource = result.Data;
|
||||
dataGridView1.Refresh();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user