using System; using System.Collections.Generic; using System.Linq; using System.Text; using Mesnac.Action.Base; using Mesnac.Codd.Session; using System.Data; using Mesnac.Controls.Default; using Mesnac.Controls.Base; namespace Mesnac.Action.Feeding.Qingquan.Report { #region 通用报表绑定 public class ReportCommon : FeedingAction, IAction { public void Run(RuntimeParameter runtime) { base.RunIni(runtime); IBaseControl report1 = this.GetComponentContral("MCReport1").FirstOrDefault(); if (report1 == null) { base.LogError("{报表} 缺少name值为MCReport1表格控件..."); return; } DbHelper dbHelper = NewDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local); if (dbHelper == null) { return; } if (report1.ActionDataSource==null) { if (report1 is MCReport) { MCReport mcreport = report1 as MCReport; mcreport.Load(mcreport.FilePath); mcreport.Show(); } } else { dbHelper.ClearParameter(); dbHelper.CommandType = CommandType.Text; string sqlstr = report1.ActionDataSource; dbHelper.CommandText = sqlstr; DataTable table = dbHelper.ToDataTable(); if (report1 is MCReport) { MCReport mcreport = report1 as MCReport; if (mcreport.SourceName == null) { base.LogError("{报表} MCReport1表格控件的[数据源名称]属性值为空,请赋值..."); return; } mcreport.Load(mcreport.FilePath); mcreport.RegisterData(table, mcreport.SourceName); mcreport.Show(); } } } } #endregion }