You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.0 KiB
C#

using System;
using System.Data;
using System.Linq;
using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.LjPlanning.Db;
namespace Mesnac.Action.ChemicalWeighing.LjRecipeData
{
public class InitDb : ChemicalWeighingAction, IAction
{
private DbMCControl _materialGridControl = null; //物料列表控件
private RuntimeParameter _runtime;
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须调用
this._runtime = runtime;
AddAction.OnAdd -= Process_Event;
AddAction.OnAdd += Process_Event;
UpdateAction.OnUpdate -= Process_Event;
UpdateAction.OnUpdate += Process_Event;
DelAction.OnDel -= Process_Event;
DelAction.OnDel += Process_Event;
DbMCControl materialGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local,
"Lj_Formula").FirstOrDefault(); //获取物料数据控件
this._materialGridControl = materialGridControl;
FileControl();
}
private void FileControl()
{
DataTable table = LjFormulaDb.GetMainTable();
if (this._materialGridControl != null && this._materialGridControl.BaseControl != null)
{
this._materialGridControl.BaseControl.BindDataSource = null;
this._materialGridControl.BaseControl.BindDataSource = table;
}
else
{
ICSharpCode.Core.LoggingService<InitDb>.Warn("配方信息配方数据控件为Null...");
}
}
#region 事件处理方法
private void Process_Event(object sender, EventArgs e)
{
if (sender is RuntimeParameter)
{
this.Run(sender as RuntimeParameter);
}
else
{
this.Run(this._runtime);
}
}
#endregion
}
}