2021-06-05 14:17:30 +08:00
|
|
|
|
using CleanMachineHMI.forms;
|
|
|
|
|
|
using CleanMachineHMI.FrmUserControl;
|
|
|
|
|
|
using CleanMachineHMI.Utils;
|
2021-12-26 21:30:02 +08:00
|
|
|
|
using Krypton.Toolkit;
|
2021-06-05 14:17:30 +08:00
|
|
|
|
using LeadDataBaseUtility;
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
namespace CleanMachineHMI.frmChild
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class frmEditParamater : KryptonForm
|
|
|
|
|
|
{
|
|
|
|
|
|
public frmEditParamater()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
2022-03-18 21:25:34 +08:00
|
|
|
|
|
2021-06-05 14:17:30 +08:00
|
|
|
|
public string ParamaterId { get; set; }
|
|
|
|
|
|
private void txt_GotFocus(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
KeyboardAutoPopUp.ShowInputPanel();
|
|
|
|
|
|
}
|
|
|
|
|
|
private void txt_LostFocus(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
KeyboardAutoPopUp.HideInputPanel();
|
|
|
|
|
|
}
|
|
|
|
|
|
private void InitControlEvent()
|
|
|
|
|
|
{
|
|
|
|
|
|
txtValue.GotFocus += new EventHandler(txt_GotFocus); //获取焦点前发生事件
|
|
|
|
|
|
txtValue.LostFocus += new EventHandler(txt_LostFocus); //失去焦点后发生事件
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void frmEditParamater_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
InitControlEvent();
|
2022-03-18 19:06:26 +08:00
|
|
|
|
this.SetFormControlText();
|
2021-06-05 14:17:30 +08:00
|
|
|
|
string sql = $@"SELECT * FROM SYS_PARAMETER WHERE PARAMETER_ID = '{ParamaterId}'";
|
|
|
|
|
|
DataTable dt = LeadDbHelperSQLite.Query(sql).Tables[0];
|
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
txtKey.Text = dt.Rows[0]["PARAMETER_CODE"].ToString();
|
|
|
|
|
|
txtKey.Enabled = false;
|
|
|
|
|
|
txtValue.Text = dt.Rows[0]["PARAMETER_VALUE"].ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
kryptonPanel1.Focus();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
2022-05-06 08:45:56 +08:00
|
|
|
|
KryptonMessageBox.Show(this.T("编辑参数数据界面加载异常", "LoadEditFrmExp") + $":【{ex.Message}】!");
|
2021-06-05 14:17:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnAdd_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(txtValue.Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
//KryptonMessageBox.Show("请输入参数值!");
|
2022-05-06 08:45:56 +08:00
|
|
|
|
KryptonMessageBox.Show(this.T("请输入参数值!", "EnterparamaterVlaueInfo"));
|
2021-06-05 14:17:30 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2022-05-06 12:28:16 +08:00
|
|
|
|
string sql = $@"update SYS_PARAMETER set PARAMETER_VALUE = '{txtValue.Text}',UPDATE_BY = '{Global.UserInfo.UserId}',UPDATE_TIME = datetime('now', 'localtime') where PARAMETER_ID = '{ParamaterId}'";
|
2022-05-16 09:03:42 +08:00
|
|
|
|
int row = LeadDbHelperSQLite.Execute(sql);
|
2021-06-05 14:17:30 +08:00
|
|
|
|
if (row > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
//KryptonMessageBox.Show("修改参数信息数据成功!");
|
2022-05-06 08:45:56 +08:00
|
|
|
|
KryptonMessageBox.Show(this.T("编辑参数数据成功!", "EditSuccessInfo"));
|
2021-06-05 14:17:30 +08:00
|
|
|
|
frmParamater.RefreshFrmHost();
|
|
|
|
|
|
this.Close();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
//KryptonMessageBox.Show("修改参数信息数据失败!");
|
2022-05-06 08:45:56 +08:00
|
|
|
|
KryptonMessageBox.Show(this.T("编辑参数数据失败!", "EditFailInfo"));
|
2021-06-05 14:17:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
2022-05-06 08:45:56 +08:00
|
|
|
|
KryptonMessageBox.Show(this.T("编辑参数数据发生异常", "EditParamaterDataExp") + $":【{ex.Message}】!");
|
2021-06-05 14:17:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnEdit_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Close();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|