private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { string _fname = ""; QueryModel = MetaDataCache.GetQueryModelDefine(compareRequest.QueryModelName); //处理比对数据表 srcData = new DataTable(); foreach (DataColumn _dc in compareRequest.ExcelData.Columns) { if (_dc.ColumnName == "XH") { _fname = "XH"; } else { ExcelColumnAlias _alias = ExcelColumns[_dc.ColumnName]; _fname = _alias.Alias; } srcData.Columns.Add(_fname, _dc.DataType); } foreach (DataRow _dr in compareRequest.ExcelData.Rows) { DataRow _newrow = srcData.NewRow(); foreach (DataColumn _dc in compareRequest.ExcelData.Columns) { if (_dc.ColumnName == "XH") { _fname = "XH"; } else { ExcelColumnAlias _alias = ExcelColumns[_dc.ColumnName]; _fname = _alias.Alias; } _newrow[_fname] = _dr[_dc.ColumnName]; } srcData.Rows.Add(_newrow); } //调用比对服务 using (MetaDataQueryServiceClient _msc = new MetaDataQueryServiceClient()) { CompareResult = _msc.CompareData(compareRequest, srcData); } //建立关系 MC_QueryModel.CreateDataRelation(this.QueryModel, CompareResult); DataTable _mtable = CompareResult.Tables[QueryModel.MainTable.TableName]; DataTable _ctable = CompareResult.Tables["EXCELRESULTDATA"]; CompareResult.Relations.Add("比对的EXCEL文件", _mtable.Columns["MAINID"], _ctable.Columns["MAINID"]); }
private void QueryByModel() { if (this.QueryRequest != null) { using (MetaDataQueryServiceClient _msc = new MetaDataQueryServiceClient()) { QueryResultData = _msc.QueryData(this.QueryRequest); } //多表关联处理 MC_QueryModel.CreateDataRelation(this.QueryModel, QueryResultData); } }
private void QueryTaskID() { if (this._queryTask != null) { using (MetaDataQueryServiceClient _msc = new MetaDataQueryServiceClient()) { QueryRequest = _msc.GetQueryTaskRequestContext(this._queryTask.TaskID); QueryModel = MetaDataCache.GetQueryModelDefine(QueryRequest.QueryModelName); switch (this._queryTask.TaskType) { case "HGSQL": QueryResultData = _msc.GetTaskQueryResult_DataSet(this._queryTask.TaskID); MC_QueryModel.CreateDataRelation(this.QueryModel, QueryResultData); break; case "LOCALORA": QueryResultData = _msc.GetTaskQueryResult_ORA(this._queryTask.TaskID); MC_QueryModel.CreateDataRelation(this.QueryModel, QueryResultData); break; } } } }