using Mesnac.Action.Base;
using Mesnac.Controls.Base;
using Mesnac.Controls.Default;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace Mesnac.Action.ChemicalWeighing.Report.GelDoser
{
///
/// 糊化机报表窗体初始化事件
///
public class InitFormAction : ChemicalWeighingAction, IAction
{
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须要调用的
ICSharpCode.Core.LoggingService.Debug("糊化机报表-窗体初始化...");
#region 获取界面控件
DbMCControl clientGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Report_GelDoser").FirstOrDefault(); //获取本机台计划网格控件
if (clientGridControl == null)
{
ICSharpCode.Core.LoggingService.Error("{糊化机报表-窗体加载} 缺少日志网格控件...");
return;
}
#endregion
List mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
IBaseControl startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
startdate.MCValue = DateTime.Now.AddDays(-3);
var MCCombobox1 = GetAllControls().FirstOrDefault(x => x.Name == "MCCombobox1") as MCCombobox;
DataTable dataTable = new DataTable();
dataTable.Columns.Add("CmbValue", typeof(string));
dataTable.Columns.Add("CmbDisplay", typeof(string));
for (int i = 1; i < 9; i++)
{
var dr = dataTable.NewRow();
dr[0] = i;
dr[1] = i;
dataTable.Rows.Add(dr);
}
MCCombobox1.DataSource = dataTable;
}
}
}