62 lines
1.9 KiB
C#
62 lines
1.9 KiB
C#
|
using Api.Framework;
|
|||
|
using Api.Framework.Model;
|
|||
|
using System;
|
|||
|
using UI.Framework.Forms;
|
|||
|
|
|||
|
namespace FLSystem.Forms
|
|||
|
{
|
|||
|
public partial class edit_uservariate_form : BaseForm
|
|||
|
{
|
|||
|
private fl_uservariate_info uservariate_Info;
|
|||
|
public edit_uservariate_form(fl_uservariate_info uservariate_Info = null)
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
this.uservariate_Info = uservariate_Info;
|
|||
|
}
|
|||
|
|
|||
|
private void button1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (string.IsNullOrWhiteSpace(textBox1.Text)) throw new Exception("请填写变量名");
|
|||
|
if (string.IsNullOrEmpty(memoEdit1.Text)) throw new Exception("请填写替换内容");
|
|||
|
if (uservariate_Info == null)
|
|||
|
uservariate_Info = new fl_uservariate_info();
|
|||
|
uservariate_Info.variate = textBox1.Text.Trim();
|
|||
|
uservariate_Info.data = memoEdit1.Text;
|
|||
|
string mess = uservariate_Info.id == 0 ? "增加成功" : "修改成功";
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
session.Saveable(uservariate_Info).ExecuteCommand();
|
|||
|
session.FindUserVariates(true);
|
|||
|
ShowSuccess(mess);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
ShowError(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void button2_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.Close();
|
|||
|
}
|
|||
|
|
|||
|
private void edit_uservariate_form_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (uservariate_Info != null)
|
|||
|
{
|
|||
|
textBox1.Text = uservariate_Info.variate;
|
|||
|
memoEdit1.Text = uservariate_Info.data;
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
ShowError(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|