|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using Mesnac.Codd.Session;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.CylinderManage
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 添加拉缸业务
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class InsertAction : ChemicalWeighingAction, IAction
|
|
|
|
|
{
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
base.RunIni(runtime); //必须调用
|
|
|
|
|
ICSharpCode.Core.LoggingService<InsertAction>.Debug("拉缸管理-添加...");
|
|
|
|
|
|
|
|
|
|
FrmInsert frmInsert = new FrmInsert();
|
|
|
|
|
DialogResult result = frmInsert.ShowDialog();
|
|
|
|
|
if (result == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
var hw = frmInsert._hw;
|
|
|
|
|
|
|
|
|
|
string strSql = @"insert into Hw_Cylinder(Name, BarCode, CreateTime)
|
|
|
|
|
values (@Name, @BarCode, @CreateTime)";
|
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
|
|
dbHelper.ClearParameter();
|
|
|
|
|
dbHelper.CommandText = strSql;
|
|
|
|
|
dbHelper.CommandType = System.Data.CommandType.Text;
|
|
|
|
|
dbHelper.AddParameter("@Name", hw.Name);
|
|
|
|
|
dbHelper.AddParameter("@BarCode", hw.BarCode);
|
|
|
|
|
dbHelper.AddParameter("@CreateTime", DateTime.Now);
|
|
|
|
|
dbHelper.ExecuteNonQuery();
|
|
|
|
|
|
|
|
|
|
//刷新DataGridView数据
|
|
|
|
|
DbMCControl d = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Hw_Cylinder").FirstOrDefault();
|
|
|
|
|
if (d == null || !(d.BaseControl is DataGridView))
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<InsertAction>.Warn("报警参数-添加-缺少报警参数DataGridView控件...");
|
|
|
|
|
runtime.IsReturn = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string sql = "select * from Hw_Cylinder";
|
|
|
|
|
DataTable table = dbHelper.GetDataTableBySql(sql);
|
|
|
|
|
d.BaseControl.BindDataSource = null;
|
|
|
|
|
d.BaseControl.BindDataSource = table;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|