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.

71 lines
2.3 KiB
C#

1 year ago
using System;
using System.Data;
using System.Linq;
using Mesnac.Action.Base;
using Mesnac.Codd.Session;
namespace Mesnac.Action.ChemicalWeighing.LjMaterial
{
public class InitDbAction:ChemicalWeighingAction,IAction
{
private DbMCControl _materialGridControl = null; //物料列表控件
private RuntimeParameter _runtime;
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须调用
this._runtime = runtime;
InsertAction.OnInsertMaterial -= Process_Event;
InsertAction.OnInsertMaterial += Process_Event;
UpdateAction.OnUpdateMaterial -= Process_Event;
UpdateAction.OnUpdateMaterial += Process_Event;
1 year ago
DelAction.OnDelMaterial -= Process_Event;
DelAction.OnDelMaterial += Process_Event;
DbMCControl materialGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "MaterialInfoType").FirstOrDefault(); //获取物料数据控件
this._materialGridControl = materialGridControl;
FileControl();
}
private void FileControl()
{
1 year ago
DataTable table = MaterialInfoTypeHelp.GetTable(@"select a.*,b.Name as bname from lj_material as a left join lj_material_type as b
on a.MtypeId = b.Id");
1 year ago
if (this._materialGridControl != null && this._materialGridControl.BaseControl != null)
{
this._materialGridControl.BaseControl.BindDataSource = null;
this._materialGridControl.BaseControl.BindDataSource = table;
//DBLog("成功!");
}
else
{
ICSharpCode.Core.LoggingService<InitDbAction>.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
}
}