コード例 #1
0
 private string GetNewID(string _oldid, string _tname, string _colname, MetaDataServiceClient _mdc)
 {
     try
     {
         if (ImportMode == "0")
         {
             return(_mdc.GetNewID());
         }
         else
         {
             if (_mdc.IsExistID(_oldid, _tname, _colname))
             {
                 throw new Exception(string.Format("在{0}表中存在{2}值为{1}的记录!", _tname, _oldid, _colname));
             }
             else
             {
                 return(_oldid);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        /// <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);
            }
        }
コード例 #3
0
        private IList <MD_TableColumn> CurrentDBColumns(IList <DB_ColumnMeta> _dbColumnList, IList <MD_TableColumn> _oldList)
        {
            using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
            {
                IList <MD_TableColumn> _retList = new List <MD_TableColumn>();

                foreach (DB_ColumnMeta _dbc in _dbColumnList)
                {
                    MD_TableColumn _mtc = FindInOldList(_dbc.ColumnName, _oldList);
                    if (_mtc == null)
                    {
                        //添加新字段
                        string _displayName = MatchStringFromComment2(_dbc.Comments, MD_ConstDefine.RegExStrFN);
                        _displayName = (_displayName == "") ? _dbc.ColumnName : _displayName;
                        MD_TableColumn _newtc = new MD_TableColumn(_mdc.GetNewID(), this._tableDefine.TID, _dbc.ColumnName, _dbc.Nullable,
                                                                   _dbc.DataType, _dbc.DataPrecision, 0, _dbc.DataLength, "", "", 0, _displayName, "", 1, 1, 0, true, 1, "", "", "");
                        _retList.Add(_newtc);
                    }
                    else
                    {
                        //添加旧字段
                        _retList.Add(_mtc);
                    }
                }

                return(_retList);
            }
        }
コード例 #4
0
 private void ChangeChildrenID(MD_GuideLine _fGuideLine)
 {
     if (_fGuideLine.Children != null)
     {
         using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
         {
             foreach (MD_GuideLine _gl in _fGuideLine.Children)
             {
                 _gl.ID       = _mdc.GetNewID();
                 _gl.FatherID = _fGuideLine.ID;
                 ChangeChildrenID(_gl);
             }
         }
     }
 }
コード例 #5
0
        private IList <MD_TableColumn> CreateNewColumns(IList <DB_ColumnMeta> _dbColumnList)
        {
            using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
            {
                IList <MD_TableColumn> _cols = new List <MD_TableColumn>();

                foreach (DB_ColumnMeta _dbc in _dbColumnList)
                {
                    string _displayName = MatchStringFromComment2(_dbc.Comments, MD_ConstDefine.RegExStrFN);
                    _displayName = (_displayName == "") ? _dbc.ColumnName : _displayName;
                    MD_TableColumn _newtc = new MD_TableColumn(_mdc.GetNewID(), this._tableDefine.TID, _dbc.ColumnName, _dbc.Nullable,
                                                               _dbc.DataType, _dbc.DataPrecision, 0, _dbc.DataLength, "", "", 0, _displayName, "", 1, 1, 0, true, 1, "", "", "");
                    _cols.Add(_newtc);
                }
                return(_cols);
            }
        }
コード例 #6
0
        private void ImportByNewID()
        {
            using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
            {
                //将所有顶级的指标的父指向当前的指标ID,并修改指标ID
                List <MD_GuideLine> _topLevelGuideLine = GetTopLevelGuideLines();
                decimal             _count             = Convert.ToDecimal(_topLevelGuideLine.Count);
                decimal             i = 0;
                foreach (MD_GuideLine _gl in _topLevelGuideLine)
                {
                    _gl.FatherID = this.CurrentGuideLine.ID;

                    _gl.ID = _mdc.GetNewID();
                    ChangeChildrenID(_gl);

                    decimal _progress = i / _count * 50;
                    i++;
                    this.backgroundWorker1.ReportProgress(Convert.ToInt32(_progress));
                }

                _count = Convert.ToDecimal(SelectedGuideLines.Count);
                i      = 0;
                foreach (MD_GuideLine _gl in this.SelectedGuideLines)
                {
                    if (_mdc.IsExistGuideLineID(_gl.ID))
                    {
                        XtraMessageBox.Show(string.Format("新建的ID:{0}已经存在,请管理员检查序列产生器!!!", _gl.ID), "系统提示");
                        break;
                    }
                    else
                    {
                        _mdc.SaveNewGuideLine(_gl);
                    }

                    decimal _progress = i / _count * 50 + 50;
                    i++;
                    this.backgroundWorker1.ReportProgress(Convert.ToInt32(_progress));
                }
            }
        }