You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using System;
|
|
using System.Windows.Forms;
|
|
using Mesnac.Action.ChemicalWeighing.LjMaterial;
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjDevice
|
|
{
|
|
public partial class FrmDevice : Form
|
|
{
|
|
public FrmDevice()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private DeviceModel _deviceModel;
|
|
public FrmDevice(DeviceModel deviceModel):this()
|
|
{
|
|
_deviceModel = deviceModel;
|
|
this.txtDeviceName.Text = _deviceModel.Name;
|
|
this.txtDeviceName.MaxLength = 12;
|
|
}
|
|
|
|
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
{
|
|
string name = this.txtDeviceName.Text.Trim();
|
|
if (string.IsNullOrEmpty(name))
|
|
{
|
|
this.txtDeviceName.Focus();
|
|
MessageBox.Show("设备名称不能为空");
|
|
return;
|
|
}
|
|
|
|
string sql = $"update Device set [name]='{name}' where id={_deviceModel.ID}";
|
|
DBHelp.ExecuteNonQuery(sql);
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
|
|
}
|
|
|
|
private void btnCancel_Click_1(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
} |