private void SaveQueryCondition() { string _errorMsg = ""; if (!this.sinoSZUC_MD_Model_FieldList1.CheckItems(ref _errorMsg)) { XtraMessageBox.Show(string.Format("选择查询结果不正确:{0}", _errorMsg), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!this.sinoSZUC_ConditionPanel1.CheckInput(ref _errorMsg)) { XtraMessageBox.Show(string.Format("查询条件不正确:{0}", _errorMsg), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Dialog_SaveQuery _f = new Dialog_SaveQuery(); if (_f.ShowDialog() == DialogResult.OK) { MC_QueryRequsetFactory _rf = new MC_QueryRequsetFactory(); _rf.QueryModelName = this.QueryModelName; this.sinoSZUC_ConditionPanel1.InsertConditions2QueryRequest(_rf); this.sinoSZUC_MD_Model_FieldList1.InsertResultFields2QueryRequest(_rf); using (MetaDataQueryServiceClient _msc = new MetaDataQueryServiceClient()) { _msc.SaveQuery(_f.SaveName, _f.IsPublic, _rf.GetQueryRequest()); } } }
private void InsertQueryResult(MC_QueryRequsetFactory _queryRequestFactory) { _queryRequestFactory.AddResultTable(this._queryModel.MainTable); foreach (MDModel_Table_Column _tc in this._queryModel.MainTable.Columns) { if (_tc.ColumnDefine.DefaultResult) { _queryRequestFactory.AddResultTableColumn(this._queryModel.MainTable, _tc); } } foreach (CheckedListBoxItem _item in this.checkedListBoxControl1.CheckedItems) { FixChildItem _itemData = _item.Value as FixChildItem; MDModel_Table _table = _itemData.TableDefine; _queryRequestFactory.AddResultTable(_table); foreach (MDModel_Table_Column _tc2 in _table.Columns) { if (_tc2.ColumnDefine.DefaultResult) { _queryRequestFactory.AddResultTableColumn(_table, _tc2); } } } }
public void InsertConditions2QueryRequest(MC_QueryRequsetFactory _queryRequestFactory) { _queryRequestFactory.AddExpression(this.textEdit1.EditValue.ToString()); foreach (SinoSZUC_ConditionItem _c in this.xtraScrollableControl1.Controls) { MDQuery_ConditionItem _cItem = _c.GetConditionItem(); _queryRequestFactory.AddConditonItem(_cItem); } }
private MDQuery_Request GetQueryRequest() { MC_QueryRequsetFactory _rf = new MC_QueryRequsetFactory(); _rf.QueryModelName = this.QueryModelName; this.sinoSZUC_FixConditionPanel1.InsertConditions2QueryRequest(_rf); this.sinoSZUC_MD_Model_FieldList1.InsertResultFields2QueryRequest(_rf); return(_rf.GetQueryRequest()); }
protected override void QueryData(SinoSZPluginFramework.IApplication _application) { if (_application == null) { return; } string _errorMsg = ""; if (!this.sinoSZUC_MD_Model_FieldList1.CheckItems(ref _errorMsg)) { XtraMessageBox.Show(string.Format("选择查询结果不正确:{0}", _errorMsg), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!this.sinoSZUC_ConditionPanel1.CheckInput(ref _errorMsg)) { XtraMessageBox.Show(string.Format("查询条件不正确:{0}", _errorMsg), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MC_QueryRequsetFactory _rf = new MC_QueryRequsetFactory(); _rf.QueryModelName = this.QueryModelName; this.sinoSZUC_ConditionPanel1.InsertConditions2QueryRequest(_rf); this.sinoSZUC_MD_Model_FieldList1.InsertResultFields2QueryRequest(_rf); MDQuery_Request _queryRequest = _rf.GetQueryRequest(); if (_queryRequest.MainResultTable.Columns.Count < 1) { XtraMessageBox.Show("主表必须至少选择一个结果字段!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Dialog_TaskInfo _f = new Dialog_TaskInfo(); if (_f.ShowDialog() == DialogResult.OK) { using (MetaDataQueryServiceClient _msc = new MetaDataQueryServiceClient()) { string _taskid = _msc.AddNewQueryTask(_f.Task_Name, _queryRequest); if (_taskid != "") { XtraMessageBox.Show("此查询请求已经添加到查询任务中!请稍后在查询任务列表中查看查询结果!"); this.Close(); } else { XtraMessageBox.Show("添加到查询任务失败!"); } } } }
private void AddTableColumn(MC_QueryRequsetFactory _queryRequestFactory, MDModel_Table _mtable, TreeListNode _fnode) { foreach (TreeListNode _cnode in _fnode.Nodes) { string _itemType = (string)_cnode.GetValue("ItemType"); if (_itemType == "COLUMN") { //如果是表则处理 int _state = (int)_cnode.GetValue("State"); if (_state > 0 && _state < 3) { //如果是选中部分或全选中状态 MDModel_Table_Column _mColumn = _cnode.GetValue("Data") as MDModel_Table_Column; _queryRequestFactory.AddResultTableColumn(_mtable, _mColumn); } } } }
protected override bool SaveRule() { MC_QueryRequsetFactory _rf = new MC_QueryRequsetFactory(); _rf.QueryModelName = _queryModel.FullQueryModelName; this.sinoSZUC_ConditionPanel1.InsertConditions2QueryRequest(_rf); string _gzsf = MC_CheckRule.QueryRequestToRule(_rf.GetQueryRequest(), this._queryModel); using (SinoSZClientBase.MetaDataQueryService.MetaDataQueryServiceClient _rsc = new SinoSZClientBase.MetaDataQueryService.MetaDataQueryServiceClient()) { if (!_rsc.ChangeDataCheckRule(CurrentRule.ID, _gzsf)) { XtraMessageBox.Show("修改算法失败!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } return(true); } }
public void InsertConditions2QueryRequest(MC_QueryRequsetFactory _queryRequestFactory) { string _expression = ""; string _fg = ""; foreach (SinoSZUC_ConditionItem _c in this.xtraScrollableControl1.Controls) { string _msg = ""; if (_c.CheckInput(ref _msg)) { MDQuery_ConditionItem _cItem = _c.GetConditionItem(); _queryRequestFactory.AddConditonItem(_cItem); _expression += string.Format("{0}{1}", _fg, _cItem.ColumnIndex); _fg = "*"; } } _queryRequestFactory.AddExpression(_expression); }
private MDQuery_Request CreateZGDQueryRequest(string _dh, DateTime _sdate, DateTime _edate) { string _qvName = "HG_GDFS.海关报关单"; MDModel_QueryModel _qv = MetaDataCache.GetQueryModelDefine(_qvName); MC_QueryRequsetFactory _rf = new MC_QueryRequsetFactory(); _rf.QueryModelName = _qvName; //加条件 MDQuery_ConditionItem _cItem = new MDQuery_ConditionItem(); _cItem.ColumnIndex = "1"; _cItem.Column = new MDQuery_TableColumn(_qv.MainTable.GetColumnByName("VOYAGE_NO")); _cItem.Operator = "等于"; _cItem.Values = new List <string>(); _cItem.Values.Add(_dh); _rf.AddConditonItem(_cItem); _cItem = new MDQuery_ConditionItem(); _cItem.ColumnIndex = "2"; _cItem.Column = new MDQuery_TableColumn(_qv.MainTable.GetColumnByName("D_DATE")); _cItem.Operator = "时间段"; _cItem.Values = new List <string>(); _cItem.Values.Add(_sdate.ToString("yyyyMMdd")); _cItem.Values.Add(_edate.ToString("yyyyMMdd")); _rf.AddConditonItem(_cItem); _rf.AddExpression("1*2"); //加结果 _rf.AddResultTable(_qv.MainTable); foreach (MDModel_Table_Column _tc in _qv.MainTable.Columns) { _rf.AddResultTableColumn(_qv.MainTable, _tc); } foreach (string _cTName in _qv.ChildTableDict.Keys) { MDModel_Table _ctable = _qv.ChildTableDict[_cTName]; _rf.AddResultTable(_ctable); foreach (MDModel_Table_Column _ccol in _ctable.Columns) { _rf.AddResultTableColumn(_ctable, _ccol); } } return(_rf.GetQueryRequest()); }
public void InsertResultFields2QueryRequest(MC_QueryRequsetFactory _queryRequestFactory) { _queryRequestFactory.AddResultTable(this.QueryModel.MainTable); foreach (TreeListNode _node in this.treeList1.Nodes) { string _itemType = (string)_node.GetValue("ItemType"); if (_itemType == "TABLE") { //如果是表则处理 int _state = (int)_node.GetValue("State"); if (_state > 0) { //如果是选中部分或全选中状态 MDModel_Table _ctable = _node.GetValue("Data") as MDModel_Table; _queryRequestFactory.AddResultTable(_ctable); AddTableColumn(_queryRequestFactory, _ctable, _node); } } } }
private void QueryData() { string _errorMsg = ""; if (!this.sinoSZUC_FixConditionPanel1.IsValid(ref _errorMsg)) { XtraMessageBox.Show(string.Format("查询条件不正确:{0}", _errorMsg), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MC_QueryRequsetFactory _rf = new MC_QueryRequsetFactory(); _rf.QueryModelName = this.QueryModelName; this.sinoSZUC_FixConditionPanel1.InsertConditions2QueryRequest(_rf); InsertQueryResult(_rf); MDQuery_Request _queryRequest = _rf.GetQueryRequest(); frmSinoSZ_QueryResult _qr = new frmSinoSZ_QueryResult(_queryModel, _queryRequest); _application.AddForm(Guid.NewGuid().ToString(), _qr); }
private MDQuery_Request CreateBGDQueryRequest(string _dh) { string _qvName = "HG_GDFS.海关报关单"; MDModel_QueryModel _qv = MetaDataCache.GetQueryModelDefine(_qvName); MC_QueryRequsetFactory _rf = new MC_QueryRequsetFactory(); _rf.QueryModelName = _qvName; //加条件 MDQuery_ConditionItem _cItem = new MDQuery_ConditionItem(); _cItem.ColumnIndex = "1"; _cItem.Column = new MDQuery_TableColumn(_qv.MainTable.GetColumnByName("ENTRY_ID_14")); _cItem.Operator = "等于"; _cItem.Values = new List <string>(); foreach (string _s in _dh.Split(',')) { _cItem.Values.Add(_s); } _rf.AddConditonItem(_cItem); _rf.AddExpression("1"); //加结果 _rf.AddResultTable(_qv.MainTable); foreach (MDModel_Table_Column _tc in _qv.MainTable.Columns) { _rf.AddResultTableColumn(_qv.MainTable, _tc); } foreach (string _cTName in _qv.ChildTableDict.Keys) { MDModel_Table _ctable = _qv.ChildTableDict[_cTName]; _rf.AddResultTable(_ctable); foreach (MDModel_Table_Column _ccol in _ctable.Columns) { _rf.AddResultTableColumn(_ctable, _ccol); } } return(_rf.GetQueryRequest()); }
/// <summary> /// 查询数据 /// </summary> virtual protected void QueryData(IApplication _application) { if (_application == null) { return; } string _errorMsg = ""; if (!this.sinoSZUC_MD_Model_FieldList1.CheckItems(ref _errorMsg)) { XtraMessageBox.Show(string.Format("选择查询结果不正确:{0}", _errorMsg), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!this.sinoSZUC_ConditionPanel1.CheckInput(ref _errorMsg)) { XtraMessageBox.Show(string.Format("查询条件不正确:{0}", _errorMsg), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MC_QueryRequsetFactory _rf = new MC_QueryRequsetFactory(); _rf.QueryModelName = this.QueryModelName; this.sinoSZUC_ConditionPanel1.InsertConditions2QueryRequest(_rf); this.sinoSZUC_MD_Model_FieldList1.InsertResultFields2QueryRequest(_rf); MDQuery_Request _queryRequest = _rf.GetQueryRequest(); if (_queryRequest.MainResultTable.Columns == null || _queryRequest.MainResultTable.Columns.Count < 1) { XtraMessageBox.Show("主表必须至少选择一个结果字段!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } frmSinoSZ_QueryResult _qr = new frmSinoSZ_QueryResult(_queryModel, _queryRequest); AddExtMenu(_qr); _application.AddForm(Guid.NewGuid().ToString(), _qr); //XtraMessageBox.Show(string.Format("查询请求包占用存{0}Byte", CalcMemory.CalcInstanceMemory(_rf.GetQueryRequest()))); }
private MDQuery_Request CreateBGDQueryRequest2(DateTime I_E_Date, string _IEFlagNum, string _formID) { string _qvName = "HG_GDFS.海关报关单"; MDModel_QueryModel _qv = MetaDataCache.GetQueryModelDefine(_qvName); MC_QueryRequsetFactory _rf = new MC_QueryRequsetFactory(); _rf.QueryModelName = _qvName; //加条件 D_Date> I_E_DATE-半年 MDQuery_ConditionItem _cItem_startDate = new MDQuery_ConditionItem(); _cItem_startDate.ColumnIndex = "1"; _cItem_startDate.Column = new MDQuery_TableColumn(_qv.MainTable.GetColumnByName("D_DATE")); _cItem_startDate.Operator = "大于"; _cItem_startDate.Values = new List <string>(); DateTime _startDate = I_E_Date.AddMonths(-6); _cItem_startDate.Values.Add(_startDate.ToString("yyyyMMdd")); _rf.AddConditonItem(_cItem_startDate); //加条件 ENTRY_ID_SHORT = 进出口标志+单证号 MDQuery_ConditionItem _cItem = new MDQuery_ConditionItem(); _cItem.ColumnIndex = "2"; _cItem.Column = new MDQuery_TableColumn(_qv.MainTable.GetColumnByName("ENTRY_ID_SHORT")); _cItem.Operator = "等于"; _cItem.Values = new List <string>(); _cItem.Values.Add(string.Format("{0}{1}", _IEFlagNum, _formID)); _rf.AddConditonItem(_cItem); //加条件 D_DATE<I_E_DATE MDQuery_ConditionItem _cItem_endDate = new MDQuery_ConditionItem(); _cItem_endDate.ColumnIndex = "3"; _cItem_endDate.Column = new MDQuery_TableColumn(_qv.MainTable.GetColumnByName("D_DATE")); _cItem_endDate.Operator = "小于"; _cItem_endDate.Values = new List <string>(); DateTime _endDate = I_E_Date.AddDays(1); _cItem_endDate.Values.Add(_endDate.ToString("yyyyMMdd")); _rf.AddConditonItem(_cItem_endDate); _rf.AddExpression("1*2*3"); //加结果 _rf.AddResultTable(_qv.MainTable); foreach (MDModel_Table_Column _tc in _qv.MainTable.Columns) { _rf.AddResultTableColumn(_qv.MainTable, _tc); } foreach (string _cTName in _qv.ChildTableDict.Keys) { MDModel_Table _ctable = _qv.ChildTableDict[_cTName]; _rf.AddResultTable(_ctable); foreach (MDModel_Table_Column _ccol in _ctable.Columns) { _rf.AddResultTableColumn(_ctable, _ccol); } } return(_rf.GetQueryRequest()); }