添加项目文件。
This commit is contained in:
99
CleanMachineHMI/frmChild/frmEditParamater.cs
Normal file
99
CleanMachineHMI/frmChild/frmEditParamater.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using CleanMachineHMI.forms;
|
||||
using CleanMachineHMI.FrmUserControl;
|
||||
using CleanMachineHMI.Utils;
|
||||
using ComponentFactory.Krypton.Toolkit;
|
||||
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();
|
||||
_InfoLanguageTextList = this.GetInfoLanguageText(GlobalHelper.LanguageCode);
|
||||
}
|
||||
private DataTable _InfoLanguageTextList;
|
||||
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();
|
||||
this.SetFormControlText(GlobalHelper.LanguageCode);
|
||||
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)
|
||||
{
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("编辑参数数据界面加载异常", "LoadEditFrmExp") + $":【{ex.Message}】!");
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(txtValue.Text))
|
||||
{
|
||||
//KryptonMessageBox.Show("请输入参数值!");
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("请输入参数值!", "EnterparamaterVlaueInfo"));
|
||||
return;
|
||||
}
|
||||
string sql = $@"update SYS_PARAMETER set PARAMETER_VALUE = '{txtValue.Text}',UPDATE_BY = '{GlobalHelper.UserInfo.USER_ID}',UPDATE_TIME = datetime('now', 'localtime') where PARAMETER_ID = '{ParamaterId}'";
|
||||
int row = LeadDbHelperSQLite.ExecuteSql(sql);
|
||||
if (row > 0)
|
||||
{
|
||||
//KryptonMessageBox.Show("修改参数信息数据成功!");
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("编辑参数数据成功!", "EditSuccessInfo"));
|
||||
frmParamater.RefreshFrmHost();
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
//KryptonMessageBox.Show("修改参数信息数据失败!");
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("编辑参数数据失败!", "EditFailInfo"));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("编辑参数数据发生异常", "EditParamaterDataExp") + $":【{ex.Message}】!");
|
||||
}
|
||||
}
|
||||
|
||||
private void btnEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user