增加修改删除页面,增加COM口的配置等
This commit is contained in:
1 parent
f3110791a7
commit
e96e2d3651
89 files changed
+10692
-727
No files matched your search
@@ -8,13 +8,14 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using WindowsFormsApp1.db;
|
||||
using WindowsFormsApp1.form;
|
||||
using WindowsFormsApp1.mod;
|
||||
|
||||
namespace WindowsFormsApp1
|
||||
{
|
||||
public partial class USER_Manage : Form
|
||||
public partial class User_Manage : Form
|
||||
{
|
||||
public USER_Manage()
|
||||
public User_Manage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
@@ -83,6 +84,71 @@ namespace WindowsFormsApp1
|
||||
private void USER_Manage_Load(object sender, EventArgs e)
|
||||
{
|
||||
dataGridView1.AutoGenerateColumns = false;
|
||||
DataGridViewButtonColumn modifyColumn = new DataGridViewButtonColumn();
|
||||
modifyColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
modifyColumn.Name = "ModifyColumn";
|
||||
modifyColumn.HeaderText = "修改";
|
||||
modifyColumn.Text = "修改";
|
||||
modifyColumn.UseColumnTextForButtonValue = true;
|
||||
dataGridView1.Columns.Add(modifyColumn);
|
||||
|
||||
// 添加删除按钮列
|
||||
DataGridViewButtonColumn deleteColumn = new DataGridViewButtonColumn();
|
||||
deleteColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
deleteColumn.Name = "DeleteColumn";
|
||||
deleteColumn.HeaderText = "删除";
|
||||
deleteColumn.Text = "删除";
|
||||
deleteColumn.UseColumnTextForButtonValue = true;
|
||||
dataGridView1.Columns.Add(deleteColumn);
|
||||
|
||||
dataGridView1.CellContentClick += DataGridView1_CellContentClick;
|
||||
GetInfo();
|
||||
}
|
||||
|
||||
private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
// 检查点击的是否为按钮列
|
||||
if (e.RowIndex >= 0)
|
||||
{
|
||||
DataGridView dataGridView = (DataGridView)sender;
|
||||
DataGridViewRow row = dataGridView.Rows[e.RowIndex];
|
||||
|
||||
int selectid = int.Parse(row.Cells[0].Value.ToString());
|
||||
if (e.ColumnIndex == 3)
|
||||
{
|
||||
User_Insert fLOW_Insert = new User_Insert();
|
||||
fLOW_Insert.dataid = selectid;
|
||||
fLOW_Insert.Operation = OperationType.Edit;
|
||||
fLOW_Insert.ShowDialog();
|
||||
GetInfo();
|
||||
|
||||
}
|
||||
else if (e.ColumnIndex == 4)
|
||||
{
|
||||
DialogResult result = MessageBox.Show("你确定要删除数据吗?", "确认提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
||||
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
SQLiteHelper<t_user> sQLiteHelper = new db.SQLiteHelper<t_user>();
|
||||
var delresult = sQLiteHelper.Delete(selectid);
|
||||
if (delresult.Success)
|
||||
{
|
||||
MessageBox.Show("删除成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("删除失败");
|
||||
}
|
||||
GetInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
User_Insert fLOW_Insert = new User_Insert();
|
||||
fLOW_Insert.ShowDialog();
|
||||
GetInfo();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user