private void ReloadData() { //先判断_curBizData中是否含有Dictionary和DataRow类型的数据,如果有,则直接提取到_curBizData中 foreach (KeyValuePair <string, object> kvSource in _curBizData) { Dictionary <string, object> dicData = kvSource.Value as Dictionary <string, object>; if (dicData != null) { foreach (KeyValuePair <string, object> kv in dicData) { if (_curBizData.ContainsKey(kv.Key)) { continue; } _curBizData.Add(kv.Key, kv.Value); } } DataRow dr = kvSource.Value as DataRow; if (dr != null) { foreach (DataColumn dc in dr.Table.Columns) { if (_curBizData.ContainsKey(dc.ColumnName)) { continue; } _curBizData.Add(dc.ColumnName, dr[dc]); } } } //如果配置了查询,则先重查询中获取数据 if (string.IsNullOrEmpty(_summaryDesign.DBSource.查询语句) == false) { DataTable dtInfo = SqlHelper.GetDataSource(_summaryDesign.DBSource.查询语句, _summaryDesign.DBSource.数据源别名, _dbQuery, QueryParValueEvent); if (dtInfo != null && dtInfo.Rows.Count > 0) { foreach (DataColumn dc in dtInfo.Columns) { if (_curBizData.ContainsKey(dc.ColumnName)) { _curBizData[dc.ColumnName] = dtInfo.Rows[0][dc]; } else { _curBizData.Add(dc.ColumnName, dtInfo.Rows[0][dc]); } } } } ReloadDictionary(_curBizData as Dictionary <string, object>); }
public override bool ExecuteAction(string callModuleName, ISysDesign callModuleInstance, object sender, string actName, string tag, IBizDataItems bizDatas, object eventArgs = null) { try { switch (actName) { case ViewTableProviderActionDefine.Action_LoadData: if (bizDatas == null) { return(false); } if (bizDatas.Count == 1) { IBizDataItem bd = bizDatas[0]; //先提取HIS服务配置,然后再做其他事情,避免_hisServerCfgData为空 if (bd.ContainsKey("HIS服务配置")) { _hisServerCfgData = bd["HIS服务配置"]; } else { _hisServerCfgData = null; } if (bd.ContainsKey("查询结果")) { DataTable dt = bd["查询结果"] as DataTable; DataTable rdt = CustomizeDT(dt); RefreshTable(rdt); } } break; default: break; } return(true); } catch (Exception ex) { MsgBox.ShowException(ex, this); return(false); } }
static private object GetItemValue(IBizDataItem dataItems, string stdParName, string[] parAlias, bool isCheckAttach = true) { object value = null; if (dataItems.ContainsKey(stdParName) == false) { foreach (string curAlias in parAlias) { if (dataItems.ContainsKey(curAlias)) { value = dataItems[curAlias]; } //获取到对应值则直接终止当前循环 if (value != null) { break; } } } else { value = dataItems[stdParName]; } if (value == null && isCheckAttach) { if (dataItems.ParentData != null) { if (dataItems.ParentData.AttachDatas != null && dataItems.ParentData.AttachDatas.Count > 0) { foreach (IBizDataItems bizDatas in dataItems.ParentData.AttachDatas) { if (bizDatas.Count > 0) { value = GetItemValue(bizDatas[0], stdParName, parAlias, false); } } } } } return(value); }
private void ReloadData() { //先判断_curBizData中是否含有Dictionary和DataRow类型的数据,如果有,则直接提取到_curBizData中 foreach (KeyValuePair <string, object> kvSource in _curBizData) { Dictionary <string, object> dicData = kvSource.Value as Dictionary <string, object>; if (dicData != null) { foreach (KeyValuePair <string, object> kv in dicData) { if (_curBizData.ContainsKey(kv.Key)) { continue; } _curBizData.Add(kv.Key, kv.Value); } } DataRow dr = kvSource.Value as DataRow; if (dr != null) { foreach (DataColumn dc in dr.Table.Columns) { if (_curBizData.ContainsKey(dc.ColumnName)) { continue; } _curBizData.Add(dc.ColumnName, dr[dc]); } } } //如果配置了查询,则先重查询中获取数据 if (string.IsNullOrEmpty(_infoDesign.查询语句) == false) { DataTable dtInfo = SqlHelper.GetDataSource(_infoDesign.查询语句, _infoDesign.数据源别名, _dbQuery, QueryParValueEvent); if (dtInfo != null && dtInfo.Rows.Count > 0) { foreach (DataColumn dc in dtInfo.Columns) { if (_curBizData.ContainsKey(dc.ColumnName)) { _curBizData[dc.ColumnName] = dtInfo.Rows[0][dc]; } else { _curBizData.Add(dc.ColumnName, dtInfo.Rows[0][dc]); } } } } int strSize = 18; string strFormatContext = @"{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fcharset134 \'cb\'ce\'cc\'e5;}}" + @"{\colortbl ;\red255\green104\blue104;\red19\green164\blue160;}" + @"{\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\sl276\slmult1\lang2052\b\f0\fs" + strSize + " "; if (string.IsNullOrEmpty(_infoDesign.显示项目) == false) { foreach (string dItem in _infoDesign.显示项目.Split(',')) { if (string.IsNullOrEmpty(dItem)) { continue; } if (_curBizData.ContainsKey(dItem)) { string dataContext = SqlHelper.Nvl(_curBizData[dItem], "").Replace("\n", @" \par\cf0\fs" + strSize + " "); strFormatContext = strFormatContext + @"\b\cf0\fs" + strSize + " " + dItem + ":" + @" \b0\cf0\fs" + strSize + " " + dataContext + @"\par"; } else { strFormatContext = strFormatContext + @"\b\cf0\fs" + strSize + " " + dItem + ":" + @" \b0\cf0\fs" + strSize + " " + @"\par"; } } } else { foreach (KeyValuePair <string, object> item in _curBizData) { string dataContext = SqlHelper.Nvl(item.Value, "").Replace("\n", @" \par\cf0\fs" + strSize + " "); strFormatContext = strFormatContext + @"\b\cf0\fs" + strSize + " " + item.Key + ":" + @" \b0\cf0\fs" + strSize + " " + dataContext + @"\par"; } } richTextBox1.Rtf = strFormatContext; richTextBox1.ZoomFactor = _ic.ZoomFactor; }