Chr☆s Kwok 的技术笔记

.NET, C#, WPF, WCF, WF, .NetCore & LINQ ... I know how it works because I know why it works ...

博客园 首页 新随笔 订阅 管理

报表视图表示器 JetSun.Core.Library.Reports.ReportViewPresenter 增加具体报错信息展示

/// <summary>
/// 
/// </summary>
/// <param name="dataSourceNames"></param>
/// <param name="dataSources"></param>
/// <param name="lp"></param>
/// <returns></returns>
public IDictionary<string, DataSourceInfo> CreateDataSourceInfos(IList<string> dataSourceNames, RdlcDataSourceCollection dataSources, LocalReport lp)
{
	IList<DataSourceInfo> infos = new List<DataSourceInfo>();
	foreach (KeyValuePair<Type, object> kvp in dataSources.AsEnumerable())
	{
		if (kvp.Value is IList)
			infos.Add(new DataSourceInfo(kvp.Key, kvp.Value as IList));
		else
			infos.Add(CreateUserQueryDataSourceInfo(kvp.Key, int.Parse(kvp.Value.ToString()), GetPredicateSetDecorator(lp), GetUserQueryPresenterFormater(lp)));
	}

	Dictionary<string, DataSourceInfo> dsi = new Dictionary<string, DataSourceInfo>();
	foreach (string name in dataSourceNames)
	{
		string member;
		Type type = RdsNameToType(name, out member);
		DataSourceInfo info = FindDataSourceInfo(type, infos);
		if (info == null) 
		{
			MessageHelper.Show($@"报表数据集类型""{type.FullName}""没有传入数据!", "报表入参错误");
			break; 
		}

		dsi[name] = info;
		if (!member.IsNullOrWhiteSpace())
		{
			PropertyInfo prop = ReflectionHelper.GetProperty(info.EntityType, member, a => true);
			info.SetItemsProperty(prop);
		}
		infos.Remove(info);
	}

	return dsi;
}

 

posted on 2026-06-18 11:25  Chr☆s  阅读(3)  评论(0)    收藏  举报