/// <summary>
        /// 同步模型中的表字段
        /// </summary>
        /// <param name="_vt"></param>
        /// <returns></returns>
        private bool CMD_ViewTableColumnSync(MD_ViewTable _vt)
        {
            IList <MD_ViewTableColumn> _vtc = _vt.Columns;

            using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
            {
                IList <MD_TableColumn> _tcolumns = _mdc.GetColumnsOfTable(_vt.TableID);

                IList <MD_ViewTableColumn> _newvtColumns          = new List <MD_ViewTableColumn>();
                IDictionary <string, MD_ViewTableColumn> _vtcDict = new Dictionary <string, MD_ViewTableColumn>();
                foreach (MD_ViewTableColumn _vtColumn in _vtc)
                {
                    _vtcDict.Add(_vtColumn.TableColumn.ColumnName, _vtColumn);
                }


                IDictionary <string, MD_TableColumn> _tcDict = new Dictionary <string, MD_TableColumn>();
                foreach (MD_TableColumn _tbcol in _tcolumns)
                {
                    _tcDict.Add(_tbcol.ColumnName, _tbcol);
                }

                ArrayList _delkeys = new ArrayList();
                foreach (string _key in _vtcDict.Keys)
                {
                    if (_tcDict.ContainsKey(_key))
                    {
                        _newvtColumns.Add(_vtcDict[_key]);
                    }
                }

                foreach (string _key in _tcDict.Keys)
                {
                    if (!_vtcDict.ContainsKey(_key))
                    {
                        MD_TableColumn     _thistc = _tcDict[_key];
                        MD_ViewTableColumn _newvtc = new MD_ViewTableColumn(
                            _mdc.GetNewID(),
                            _vt.ViewTableID,
                            _thistc.ColumnID,
                            true,
                            true,
                            true,
                            false,
                            false,
                            _thistc.DWDM,
                            0,
                            0);
                        _newvtc.TableColumn = _thistc;

                        _newvtColumns.Add(_newvtc);
                    }
                }
                _vt.Columns = _newvtColumns;
                this.gridControl1.DataSource = _vt.Columns;
                this._haveChange             = true;
                RaiseDataChanged();
                return(true);
            }
        }
예제 #2
0
 private void RefreshData()
 {
     if (_tableDefine == null)
     {
         return;
     }
     this.TE_DES.EditValue       = this._tableDefine.Description;
     this.TE_DISPLAY.EditValue   = this._tableDefine.DisplayTitle;
     this.TE_EXTFUN.EditValue    = this._tableDefine.ExtSecret;
     this.TE_ID.EditValue        = this._tableDefine.TID;
     this.TE_MAINKEY.EditValue   = this._tableDefine.MainKey;
     this.TE_NAMESPACE.EditValue = this._tableDefine.NamespaceName;
     this.TE_SECRETFUN.EditValue = this._tableDefine.SecretFun;
     this.TE_TABLENAME.EditValue = this._tableDefine.TableName;
     this.TE_TYPE.EditValue      = this._tableDefine.TableType;
     this.te_Res.EditValue       = this._tableDefine.ResourceType == null? "":string.Join(",", this._tableDefine.ResourceType);
     if (this._tableDefine.Columns == null)
     {
         using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
         {
             this._tableDefine.Columns = _mdc.GetColumnsOfTable(this._tableDefine.TID);
         }
     }
     this.gridView1.BeginUpdate();
     this.gridControl1.DataSource = this._tableDefine.Columns;
     this.gridView1.EndUpdate();
     this._haveChange = false;
 }
예제 #3
0
        private bool ExportNameSpace()
        {
            using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
            {
                //取表定义
                this.panelWait.Visible = true;
                SetProgress("正在读取数据表的元数据定义...", 0);

                IList <MD_Table> _tbList = _mdc.GetTablesAtNamespace(Namespace.NameSpace);
                SetProgressStep(10, 40, _tbList.Count);

                foreach (MD_Table _tb in _tbList)
                {
                    ShowProgressContinu(string.Format("正在读取{0}表的字段定义...", _tb.TableName));
                    _tb.Columns = _mdc.GetColumnsOfTable(_tb.TID);
                }

                //取查询模型定义
                SetProgress("正在读取查询模型的元数据定义...", 42);

                IList <MD_QueryModel> _qvList = _mdc.GetQueryModelAtNamespace(Namespace.NameSpace);
                SetProgressStep(45, 90, _qvList.Count);
                foreach (MD_QueryModel _qv in _qvList)
                {
                    ShowProgressContinu(string.Format("正在读取{0}的模型定义...", _qv.DisplayTitle));
                    _qv.MainTable      = _mdc.GetMainTableOfQueryModel(_qv.QueryModelID);
                    _qv.ChildTables    = _mdc.GetChildTableOfQueryModel(_qv.QueryModelID);
                    _qv.View2ViewGroup = _mdc.GetView2ViewGroupOfQueryModel(_qv.QueryModelID);

                    if (_qv.View2ViewGroup != null)
                    {
                        foreach (MD_View2ViewGroup _gr in _qv.View2ViewGroup)
                        {
                            _gr.View2Views = _mdc.GetView2ViewList(_gr.ID, _qv.QueryModelID);
                        }
                    }

                    try
                    {
                        _qv.View2GuideLines = _mdc.GetView2GuideLineList(_qv.QueryModelID);
                    }
                    catch (FaultException ex)
                    {
                        MessageBox.Show(ex.Message, "系统错误");
                    }
                    _qv.View2Application = _mdc.GetView2ApplicationList(_qv.QueryModelID);
                }

                //取代码表
                SetProgress("正在读取代码表的元数据定义...", 92);
                IList <MD_RefTable> _refList = _mdc.GetRefTableAtNamespace(Namespace.NameSpace);

                Namespace.RefTableList   = _refList;
                Namespace.QueryModelList = _qvList;
                Namespace.TableList      = _tbList;
                SetProgress("正在写入导出文件...", 92);
                WriteExportFile(Namespace);
                SetProgress("导出完成!", 100);
                return(true);
            }
        }