예제 #1
0
 /// <summary>
 /// 更新RunParam
 /// </summary>
 /// <param name="id"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public async static Task <int> UpdateRunParam(T_RunParam t_RunParam)
 {
     try
     {
         return(await _sqlSugar.Updateable(t_RunParam).UpdateColumns(t => new { t.keyvalue }).ExecuteCommandAsync());
     }
     catch (Exception ex)
     {
         Log.Error($"修改记录失败!\r\n keyvalue={t_RunParam.keyvalue}", ex);
     }
     return(0);
 }
예제 #2
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtTPMSID.Text == string.Empty || this.txtValue.Text == string.Empty)
                {
                    return;
                }

                //int result =configer.UpdateRunParam(this.txtTPMSID.Text.Trim(), this.txtValue.Text.Trim());

                //if (result >= 1)
                //{
                //    MessageBox.Show("更新成功");
                //    this.FillRunParam();
                //}
                //else
                //{
                //    MessageBox.Show("更新失败");
                //}
                if (!int.TryParse(txtTPMSID.Text.Trim(), out int id))
                {
                    MessageBox.Show("序号不是数字类型!请重新输入");
                    return;
                }
                var item = new T_RunParam
                {
                    id       = id,
                    keyvalue = txtValue.Text.Trim(),
                };
                int tmpK = await Comm.SqlComm.UpdateRunParam(item);

                FillRunParam();
                string msg = tmpK > 0 ? "更新成功" : "更新失败";
                MessageBox.Show(msg);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message + "***" + ex.StackTrace);
            }
        }