Пример #1
0
 public MD_QueryModel SaveNew()
 {
     using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
     {
         _queryModel                 = new MD_QueryModel();
         _queryModel.Description     = (this.TE_DES.EditValue == null) ? "" : this.TE_DES.EditValue.ToString();
         _queryModel.DisplayTitle    = (this.TE_DISPLAY.EditValue == null) ? this.TE_MODELNAME.EditValue.ToString() : this.TE_DISPLAY.EditValue.ToString();
         _queryModel.DisplayOrder    = Convert.ToInt32((this.TE_DISPLAYORDER.EditValue == null) ? "0" : this.TE_DISPLAYORDER.EditValue.ToString());
         _queryModel.QueryModelName  = this.TE_MODELNAME.EditValue.ToString();
         _queryModel.IsFixQuery      = (this.TE_TYPE.Items[0].CheckState == CheckState.Checked);
         _queryModel.IsRelationQuery = (this.TE_TYPE.Items[1].CheckState == CheckState.Checked);
         _queryModel.IsDataAuditing  = (this.TE_TYPE.Items[2].CheckState == CheckState.Checked);
         _queryModel.QueryInterface  = (this.te_Ics.EditValue.ToString());
         _queryModel.NamespaceName   = (_nameSpace == null) ? "" : _nameSpace.NameSpace;
         _queryModel.DWDM            = _nameSpace.DWDM;
         _queryModel.EXTMeta         = (this.te_ExtMeta.EditValue == null) ? "" : this.te_ExtMeta.EditValue.ToString();
         _mdc.SaveNewQueryModel(_queryModel);
     }
     _haveChange = false;
     RaiseDataChanged();
     return(_queryModel);
 }
Пример #2
0
        private void InitConceptGroup(TreeListNode _fnode)
        {
            using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
            {
                IList <MD_ConceptGroup> _groups = _mdc.GetConceptGroups();
                foreach (MD_ConceptGroup _group in _groups)
                {
                    TreeListNode _node = treeList1.AppendNode(null, _fnode);
                    _node.ImageIndex       = 1;
                    _node.SelectImageIndex = 0;

                    _node.SetValue(this.treeListColumn1, _group);
                    _node.HasChildren = true;
                    foreach (MD_ConceptItem _item in _group.Items)
                    {
                        TreeListNode _cnode = treeList1.AppendNode(null, _node);
                        _cnode.ImageIndex       = 1;
                        _cnode.SelectImageIndex = 0;
                        _cnode.SetValue(this.treeListColumn1, _item);
                        _cnode.HasChildren = false;
                    }
                }
            }
        }
Пример #3
0
        public override void Init(string _title, string _menuName, object _param)
        {
            this.Text = _title;
            Param     = _param.ToString();
            string _queryViewNames = StrUtils.GetMetaByName("查询模型", Param).Trim();

            if (_queryViewNames != "")
            {
                foreach (string _qvName in _queryViewNames.Split(','))
                {
                    if (!ModelNameList.Contains(_qvName))
                    {
                        ModelNameList.Add(_qvName);
                        using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
                        {
                            ModelDict.Add(_qvName, _mdc.GetQueryModelByName(_qvName));
                        }
                    }
                }
            }
            InitTree();
            this._initFinished = true;
            RaiseMenuChanged();
        }
Пример #4
0
 public ContentController()
 {
     _commentService        = new CommentService();
     _identityService       = new IdentityServiceClient();
     _metadataServiceClient = new MetaDataServiceClient();
 }
Пример #5
0
        private void WriteTableDefine(string _oldNameSpace, MD_Namespace _ns, DataSet _ds)
        {
            using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
            {
                DataRow[] _TableDefineRows = _ds.Tables["MD_TABLE"].Select(string.Format("NAMESPACE='{0}'", _oldNameSpace));
                foreach (DataRow _dr in _TableDefineRows)
                {
                    DB_TableMeta _tm = new DB_TableMeta();
                    _tm.TableName    = _dr["TABLENAME"].ToString();
                    _tm.TableComment = _dr["DESCRIPTION"].ToString();
                    _tm.TableType    = _dr["TABLETYPE"].ToString();

                    string _oldid = _dr["TID"].ToString();
                    string _newid = GetNewID(_oldid, "MD_TABLE", "TID", _mdc);

                    this.IDTable.Add(_oldid, _newid);

                    MD_Table _tableDefine = new MD_Table(
                        _newid,
                        _ns.NameSpace,
                        _tm.TableName,
                        _tm.TableType,
                        _tm.TableComment,
                        _dr.IsNull("DISPLAYNAME") ? "" : _dr["DISPLAYNAME"].ToString(),
                        _dr.IsNull("MAINKEY") ? "" : _dr["MAINKEY"].ToString(),
                        _ns.DWDM,
                        _dr.IsNull("SECRETFUN") ? "" : _dr["SECRETFUN"].ToString(),
                        _dr.IsNull("EXTSECRET") ? "" : _dr["EXTSECRET"].ToString()
                        );

                    _tableDefine.Columns = new List <MD_TableColumn>();
                    DataRow[] _columnRow = _ds.Tables["MD_TABLECOLUMN"].Select(string.Format("TID={0}", _dr["TID"]));
                    foreach (DataRow _dcrow in _columnRow)
                    {
                        string _oldTCid = _dcrow["TCID"].ToString();
                        string _newTCid = GetNewID(_oldTCid, "MD_TABLECOLUMN", "TCID", _mdc);
                        try
                        {
                            this.IDTable.Add(_oldTCid, _newTCid);
                        }
                        catch (Exception e)
                        {
                            throw e;
                        }

                        MD_TableColumn _tc = new MD_TableColumn(
                            _newTCid,
                            _newid,
                            _dcrow["COLUMNNAME"].ToString(),
                            (_dcrow["ISNULLABLE"].ToString() == "Y"),
                            _dcrow["TYPE"].ToString(),
                            _dcrow.IsNull("PRECISION") ? 1 : Convert.ToInt32(_dcrow["PRECISION"]),
                            _dcrow.IsNull("SCALE") ? 1 : Convert.ToInt32(_dcrow["SCALE"]),
                            _dcrow.IsNull("LENGTH") ? 1 : Convert.ToInt32(_dcrow["LENGTH"]),
                            _dcrow.IsNull("REFDMB") ? "" : _dcrow["REFDMB"].ToString(),
                            _dcrow.IsNull("DMBLEVELFORMAT") ? "" : _dcrow["DMBLEVELFORMAT"].ToString(),
                            _dcrow.IsNull("SECRETLEVEL") ? 0 : Convert.ToInt32(_dcrow["SECRETLEVEL"]),
                            _dcrow.IsNull("DISPLAYTITLE") ? "" : _dcrow["DISPLAYTITLE"].ToString(),
                            _dcrow.IsNull("DISPLAYFORMAT") ? "" : _dcrow["DISPLAYFORMAT"].ToString(),
                            _dcrow.IsNull("DISPLAYLENGTH") ? 1 : Convert.ToInt32(_dcrow["DISPLAYLENGTH"]),
                            _dcrow.IsNull("DISPLAYHEIGHT") ? 1 : Convert.ToInt32(_dcrow["DISPLAYHEIGHT"]),
                            _dcrow.IsNull("DISPLAYORDER") ? 0 : Convert.ToInt32(_dcrow["DISPLAYORDER"]),
                            _dcrow.IsNull("CANDISPLAY") ? true : ((decimal)_dcrow["CANDISPLAY"] > 0),
                            _dcrow.IsNull("COLWIDTH") ? 1 : Convert.ToInt32(_dcrow["COLWIDTH"]),
                            _ns.DWDM,
                            _dcrow.IsNull("CTAG") ? "" : _dcrow["CTAG"].ToString(),
                            ""
                            );
                        _tableDefine.Columns.Add(_tc);
                    }
                    _mdc.ImportTableDefine(_tableDefine);
                }
            }
        }
Пример #6
0
        private void WriteModelDefine(string _oldNameSpace, MD_Namespace _ns, DataSet _ds)
        {
            using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
            {
                DataRow[] _qvDefineRows = _ds.Tables["MD_VIEW"].Select(string.Format("NAMESPACE='{0}'", _oldNameSpace));
                foreach (DataRow _dr in _qvDefineRows)
                {
                    string _oldid = _dr["VIEWID"].ToString();
                    string _newid = GetNewID(_oldid, "MD_VIEW", "VIEWID", _mdc);

                    this.IDTable.Add(_oldid, _newid);

                    MD_QueryModel _qv = new MD_QueryModel(
                        _newid,
                        _ns.NameSpace,
                        _dr.IsNull("VIEWNAME") ? "" : _dr["VIEWNAME"].ToString(),
                        _dr.IsNull("DESCRIPTION") ? "" : _dr["DESCRIPTION"].ToString(),
                        _dr.IsNull("DISPLAYNAME") ? "" : _dr["DISPLAYNAME"].ToString(),
                        _ns.DWDM,
                        _dr.IsNull("IS_GDCX") ? false : ((decimal)_dr["IS_GDCX"] > 0),
                        _dr.IsNull("IS_GLCX") ? false : ((decimal)_dr["IS_GLCX"] > 0),
                        _dr.IsNull("IS_SJSH") ? false : ((decimal)_dr["IS_SJSH"] > 0),
                        _dr.IsNull("DISPLAYORDER") ? 0 : Convert.ToInt32(_dr["DISPLAYORDER"]),
                        "ORA_JSIS"
                        );

                    _qv.ChildTables = new List <MD_ViewTable>();

                    DataRow[] _childTableRows = _ds.Tables["MD_VIEWTABLE"].Select(string.Format("VIEWID='{0}'", _oldid));
                    foreach (DataRow _ctRow in _childTableRows)
                    {
                        string _oldVTid = _ctRow["VTID"].ToString();
                        string _newVTid = GetNewID(_oldVTid, "MD_VIEWTABLE", "VTID", _mdc);

                        string _newTid = IDTable[_ctRow["TID"].ToString()];
                        this.IDTable.Add(_oldVTid, _newVTid);

                        int _displayType = 0;
                        if (_ds.Tables["MD_VIEWTABLE"].Columns.Contains("DISPLAYTYPE"))
                        {
                            _displayType = _ctRow.IsNull("DISPLAYTYPE") ? 0 : Convert.ToInt32(_ctRow["DISPLAYTYPE"]);
                        }
                        string _intApp = "";
                        if (_ds.Tables["MD_VIEWTABLE"].Columns.Contains("INTEGRATEDAPP"))
                        {
                            _intApp = _ctRow.IsNull("INTEGRATEDAPP") ? "" : _ctRow["INTEGRATEDAPP"].ToString();
                        }
                        MD_ViewTable _vt = new MD_ViewTable(
                            _newVTid,
                            _newid,
                            _newTid,
                            _ctRow["TABLETYPE"].ToString(),
                            _ctRow.IsNull("TABLERELATION") ? "" : _ctRow["TABLERELATION"].ToString(),
                            _ctRow.IsNull("CANCONDITION") ? "" : _ctRow["CANCONDITION"].ToString(),
                            _ctRow.IsNull("DISPLAYNAME") ? "" : _ctRow["DISPLAYNAME"].ToString(),
                            _ctRow.IsNull("DISPLAYORDER") ? 0 : Convert.ToInt32(_ctRow["DISPLAYORDER"]),
                            _ns.DWDM,
                            _ctRow.IsNull("FATHERID") ? "" : _ctRow["FATHERID"].ToString(),
                            0,
                            _displayType,
                            _intApp
                            );
                        _qv.ChildTables.Add(_vt);

                        _vt.Columns = new List <MD_ViewTableColumn>();

                        DataRow[] _vtRows = _ds.Tables["MD_VIEWTABLECOLUMN"].Select(string.Format("VTID='{0}'", _oldVTid));
                        foreach (DataRow _vtRow in _vtRows)
                        {
                            string             _oldVTCid = _vtRow["VTCID"].ToString();
                            string             _newVTCid = GetNewID(_oldVTCid, "MD_VIEWTABLECOLUMN", "VTCID", _mdc);
                            string             _newTCid  = IDTable[_vtRow["TCID"].ToString()];
                            MD_ViewTableColumn _vtc      = new MD_ViewTableColumn(
                                _newVTCid,
                                _newVTid,
                                _newTCid,
                                _vtRow.IsNull("CANCONDITIONSHOW") ? false : ((decimal)_vtRow["CANCONDITIONSHOW"] > 0),
                                _vtRow.IsNull("CANRESULTSHOW") ? false : ((decimal)_vtRow["CANRESULTSHOW"] > 0),
                                _vtRow.IsNull("DEFAULTSHOW") ? false : ((decimal)_vtRow["DEFAULTSHOW"] > 0),
                                _vtRow.IsNull("FIXQUERYITEM") ? false : ((decimal)_vtRow["FIXQUERYITEM"] > 0),
                                _vtRow.IsNull("CANMODIFY") ? false : ((decimal)_vtRow["CANMODIFY"] > 0),
                                _ns.DWDM,
                                0,
                                0
                                );

                            _vt.Columns.Add(_vtc);
                        }
                    }
                    _mdc.ImportQueryModelDefine(_qv);
                }
            }
        }
Пример #7
0
        private void ChangeView2GuideLineID(MD_View_GuideLine _v2g, MD_QueryModel _qv, MetaDataServiceClient _mdc)
        {
            if (_v2g == null)
            {
                return;
            }
            _v2g.ViewID = _qv.QueryModelID;
            string _newid = GetNewID(_v2g.ID, "MD_VIEW2GUIDELINE", "ID", _mdc);

            try
            {
                IDTable.Add(_v2g.ID, _newid);
            }
            catch (Exception e)
            {
                throw e;
            }
            _v2g.ID = _newid;
        }
Пример #8
0
        private void WriteModelDefine_New(MD_Namespace _ns)
        {
            using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
            {
                foreach (MD_QueryModel _qv in _ns.QueryModelList)
                {
                    this.label2.Text = string.Format("写入查询模型[{0}]的定义 ....", _qv.QueryModelName);
                    Application.DoEvents();
                    _qv.NamespaceName = _ns.NameSpace;
                    string _newid = GetNewID(_qv.QueryModelID, "MD_VIEW", "VIEWID", _mdc);
                    try
                    {
                        IDTable.Add(_qv.QueryModelID, _newid);
                    }
                    catch (Exception e)
                    {
                        throw e;
                    }
                    _qv.QueryModelID = _newid;
                    _qv.DWDM         = _ns.DWDM;
                    //处理主表

                    MD_ViewTable _mainTable = _qv.MainTable;
                    string       old_fid    = "";
                    if (_mainTable != null)
                    {
                        old_fid = _mainTable.ViewTableID;
                        try
                        {
                            ChangeTableID(_mainTable, _qv, _mdc);
                        }
                        catch (Exception e)
                        {
                            throw e;
                        }
                    }


                    List <MD_ViewTable> _newTables = new List <MD_ViewTable>();
                    //处理子表
                    foreach (MD_ViewTable _vTable in _qv.ChildTables)
                    {
                        try
                        {
                            _vTable.FatherTableID = old_fid;
                            ChangeTableID(_vTable, _qv, _mdc);
                            _newTables.Add(_vTable);
                        }
                        catch (Exception e)
                        {
                            throw e;
                        }
                    }
                    _newTables.Add(_qv.MainTable);
                    _qv.ChildTables = _newTables;

                    //处理关联表
                    if (_qv.View2ViewGroup != null)
                    {
                        foreach (MD_View2ViewGroup _group in _qv.View2ViewGroup)
                        {
                            ChangeView2ViewGroupID(_group, _qv, _mdc);
                        }
                    }

                    //处理关联指标
                    if (_qv.View2GuideLines != null)
                    {
                        foreach (MD_View_GuideLine _v2g in _qv.View2GuideLines)
                        {
                            ChangeView2GuideLineID(_v2g, _qv, _mdc);
                        }
                    }

                    //处理关联注册应用
                    if (_qv.View2Application != null)
                    {
                        foreach (MD_View2App _v2a in _qv.View2Application)
                        {
                            ChangeView2AppID(_v2a, _qv, _mdc);
                        }
                    }

                    bool _ret = _mdc.ImportQueryModelDefine(_qv);
                    if (!_ret)
                    {
                        MessageBox.Show("导入失败!", "系统提示");
                    }
                }
            }
        }
Пример #9
0
        private void LoadChildData(TreeListNode _fnode, object _value)
        {
            using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
            {
                if (_value is MD_Nodes)
                {
                    _fnode.Nodes.Clear();
                    MD_Nodes _nodes = _value as MD_Nodes;

                    MD_Title     _mt      = new MD_Title("统计指标", "MD_TJZB", _nodes);
                    TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                    _newnode.SetValue(this.treeListColumn1, _mt);
                    _newnode.HasChildren      = true;
                    _newnode.ImageIndex       = 1;
                    _newnode.SelectImageIndex = 2;

                    _mt      = new MD_Title("报表指标", "MD_REPORTGUIDLINE", _nodes);
                    _newnode = treeList1.AppendNode(null, _fnode);
                    _newnode.SetValue(this.treeListColumn1, _mt);
                    _newnode.HasChildren      = true;
                    _newnode.ImageIndex       = 1;
                    _newnode.SelectImageIndex = 2;
                }

                if (_value is MD_Title)
                {
                    IList <MD_GuideLineGroup> _guideLineGroups = null;
                    _fnode.Nodes.Clear();
                    MD_Title _mdtitle = _value as MD_Title;
                    MD_Nodes _nodes   = (MD_Nodes)_mdtitle.FatherObj;
                    switch (_mdtitle.TitleType)
                    {
                    case "MD_TJZB":

                        _guideLineGroups = _mdc.GetGuideLineGroup(_nodes.DWDM, "3");      //参数3表示统计指标
                        foreach (MD_GuideLineGroup _tb in _guideLineGroups)
                        {
                            TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                            _newnode.SetValue(this.treeListColumn1, _tb);
                            _newnode.ImageIndex       = 0;
                            _newnode.SelectImageIndex = 2;
                            _newnode.HasChildren      = true;
                        }
                        break;

                    case "MD_REPORTGUIDLINE":
                        _guideLineGroups = _mdc.GetGuideLineGroup(_nodes.DWDM, "1");      //参数1表示报表指标

                        foreach (MD_GuideLineGroup _tb in _guideLineGroups)
                        {
                            TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                            _newnode.SetValue(this.treeListColumn1, _tb);
                            _newnode.ImageIndex       = 0;
                            _newnode.SelectImageIndex = 2;
                            _newnode.HasChildren      = true;
                        }
                        break;
                    }
                }

                if (_value is MD_GuideLineGroup)
                {
                    MD_GuideLineGroup _glg = _value as MD_GuideLineGroup;
                    switch (_glg.LX)
                    {
                    case 1:             //报表指标
                        break;

                    case 3:             //统计指标
                        List <MD_GuideLine> _guideLineList = _mdc.GetGuideLineOfGroup(_glg.ZBZTMC).ToList <MD_GuideLine>();
                        _glg.ChildGuideLines = _guideLineList;
                        foreach (MD_GuideLine _gl in _guideLineList)
                        {
                            TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                            _newnode.SetValue(this.treeListColumn1, _gl);
                            _newnode.ImageIndex       = 0;
                            _newnode.SelectImageIndex = 2;
                            _newnode.HasChildren      = true;
                            _gl.MD_GuideLineGroup     = _glg;
                        }
                        break;
                    }
                }

                if (_value is MD_GuideLine)
                {
                    MD_GuideLine        _gline = _value as MD_GuideLine;
                    List <MD_GuideLine> _childGuideLineList = _mdc.GetChildGuideLines(_gline.ID).ToList <MD_GuideLine>();
                    _gline.Children = _childGuideLineList;
                    foreach (MD_GuideLine _gl in _childGuideLineList)
                    {
                        TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                        _newnode.SetValue(this.treeListColumn1, _gl);
                        _newnode.ImageIndex       = 0;
                        _newnode.SelectImageIndex = 2;
                        _newnode.HasChildren      = true;
                    }
                }
            }
        }
Пример #10
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);
            }
        }
Пример #11
0
        private void LoadChildData(TreeListNode _fnode, object _value)
        {
            using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
            {
                MD_Title     _mt;
                MD_Namespace _ns;
                if (_value is MD_Nodes)
                {
                    _fnode.Nodes.Clear();
                    MD_Nodes _node = _value as MD_Nodes;

                    IList <MD_Namespace> _namespaces = _mdc.GetNameSpaceAtNode(_node.DWDM);
                    if (_node.NameSpaces == null)
                    {
                        _node.NameSpaces = new List <MD_Namespace>();
                    }
                    foreach (MD_Namespace _space in _namespaces)
                    {
                        TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                        _newnode.SetValue(this.treeListColumn1, _space);
                        _newnode.ImageIndex       = 1;
                        _newnode.SelectImageIndex = 0;
                        _newnode.HasChildren      = true;
                        _node.NameSpaces.Add(_space);
                    }

                    _mt = new MD_Title("菜单定义", "MD_MENU", _node);
                    TreeListNode _newnode2 = treeList1.AppendNode(null, _fnode);
                    _newnode2.SetValue(this.treeListColumn1, _mt);
                    _newnode2.ImageIndex       = 1;
                    _newnode2.SelectImageIndex = 0;
                    _newnode2.HasChildren      = true;
                }

                if (_value is MD_Namespace)
                {
                    _fnode.Nodes.Clear();
                    _ns = _value as MD_Namespace;
                    _mt = new MD_Title("数据表", "MD_TABLE", _ns);
                    TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                    _newnode.SetValue(this.treeListColumn1, _mt);
                    _newnode.ImageIndex       = 1;
                    _newnode.SelectImageIndex = 0;
                    _newnode.HasChildren      = true;

                    _mt                       = new MD_Title("查询模型", "MD_QUERYMODEL", _ns);
                    _newnode                  = treeList1.AppendNode(null, _fnode);
                    _newnode.ImageIndex       = 1;
                    _newnode.SelectImageIndex = 0;
                    _newnode.SetValue(this.treeListColumn1, _mt);
                    _newnode.HasChildren = true;

                    _mt                       = new MD_Title("代码表", "MD_REFTABLE", _ns);
                    _newnode                  = treeList1.AppendNode(null, _fnode);
                    _newnode.ImageIndex       = 1;
                    _newnode.SelectImageIndex = 0;
                    _newnode.SetValue(this.treeListColumn1, _mt);
                    _newnode.HasChildren = true;
                }

                if (_value is MD_Title)
                {
                    _fnode.Nodes.Clear();
                    MD_Title _mdtitle = _value as MD_Title;

                    switch (_mdtitle.TitleType)
                    {
                    case "MD_TABLE":
                        _ns = (MD_Namespace)_mdtitle.FatherObj;
                        IList <MD_Table> _tables = _mdc.GetTablesAtNamespace(_ns.NameSpace);
                        if (_ns.TableList == null)
                        {
                            _ns.TableList = new List <MD_Table>();
                        }

                        foreach (MD_Table _tb in _tables)
                        {
                            TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                            _newnode.SetValue(this.treeListColumn1, _tb);
                            _newnode.HasChildren      = true;
                            _newnode.ImageIndex       = 2;
                            _newnode.SelectImageIndex = 0;
                            _ns.TableList.Add(_tb);
                            _tb.NamespaceName = _ns.NameSpace;
                        }
                        break;

                    case "MD_QUERYMODEL":
                        _ns = (MD_Namespace)_mdtitle.FatherObj;
                        IList <MD_QueryModel> _models = _mdc.GetQueryModelAtNamespace(_ns.NameSpace);
                        if (_ns.QueryModelList == null)
                        {
                            _ns.QueryModelList = new List <MD_QueryModel>();
                        }
                        foreach (MD_QueryModel _model in _models)
                        {
                            TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                            _newnode.SetValue(this.treeListColumn1, _model);
                            _newnode.ImageIndex       = 1;
                            _newnode.SelectImageIndex = 0;
                            _newnode.HasChildren      = true;
                            _ns.QueryModelList.Add(_model);
                            _model.Namespace = _ns;
                        }
                        break;

                    case "MD_REFTABLE":
                        _ns = (MD_Namespace)_mdtitle.FatherObj;
                        IList <MD_RefTable> _refTables = _mdc.GetRefTableAtNamespace(_ns.NameSpace);
                        if (_ns.RefTableList == null)
                        {
                            _ns.RefTableList = new List <MD_RefTable>();
                        }
                        foreach (MD_RefTable _rt in _refTables)
                        {
                            TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                            _newnode.SetValue(this.treeListColumn1, _rt);
                            _newnode.ImageIndex       = 2;
                            _newnode.SelectImageIndex = 0;
                            _newnode.HasChildren      = false;
                            _ns.RefTableList.Add(_rt);
                            _rt.Namespace = _ns;
                        }
                        break;

                    case "MD_MENU":
                        MD_Nodes        _node      = (MD_Nodes)_mdtitle.FatherObj;
                        IList <MD_Menu> _menuTable = _mdc.GetMenuDefineOfNode(_node.DWDM);
                        foreach (MD_Menu _menu in _menuTable)
                        {
                            TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                            _newnode.SetValue(this.treeListColumn1, _menu);

                            if (_menu.MenuType.Length > 3 && _menu.MenuType.Substring(0, 3) == "WEB")
                            {
                                _newnode.ImageIndex       = 4;
                                _newnode.SelectImageIndex = 0;
                            }
                            else if (_menu.MenuType.Length > 3 && _menu.MenuType.Substring(0, 3) == "SL_")
                            {
                                _newnode.ImageIndex       = 5;
                                _newnode.SelectImageIndex = 0;
                            }
                            else
                            {
                                _newnode.ImageIndex       = 2;
                                _newnode.SelectImageIndex = 0;
                            }
                            _newnode.HasChildren = true;
                            _menu.NodeID         = _node.ID;
                            _menu.MD_Nodes       = _node;
                        }
                        break;

                    case "MD_CONCEPTGROUP":
                        InitConceptGroup(_fnode);
                        break;

                    case "MD_VIEW_GUIDELINE":
                        InitView2GuideLine(_fnode, (MD_QueryModel)_mdtitle.FatherObj);
                        break;

                    case "MD_VIEW_APPLICATION":
                        InitView2Application(_fnode, (MD_QueryModel)_mdtitle.FatherObj);
                        break;

                    case "MD_VIEW_EXRIGHT":
                        InitViewExRight(_fnode, (MD_QueryModel)_mdtitle.FatherObj);
                        break;
                    }
                }

                if (_value is MD_QueryModel_ExRight)
                {
                    _fnode.Nodes.Clear();
                    MD_QueryModel_ExRight         _fright = _value as MD_QueryModel_ExRight;
                    IList <MD_QueryModel_ExRight> _erList = _mdc.GetQueryModelExRights(_fright.ModelID, _fright.ID);
                    foreach (MD_QueryModel_ExRight _right in _erList)
                    {
                        TreeListNode _node = treeList1.AppendNode(null, _fnode);
                        _node.ImageIndex       = 1;
                        _node.SelectImageIndex = 0;
                        _node.SetValue(this.treeListColumn1, _right);
                        _node.HasChildren = true;
                    }
                }

                if (_value is MD_QueryModel)
                {
                    _fnode.Nodes.Clear();
                    MD_QueryModel _qm        = _value as MD_QueryModel;
                    MD_ViewTable  _mainTable = _mdc.GetMainTableOfQueryModel(_qm.QueryModelID);
                    if (_mainTable != null)
                    {
                        TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                        _newnode.SetValue(this.treeListColumn1, _mainTable);
                        _newnode.ImageIndex       = 2;
                        _newnode.SelectImageIndex = 0;
                        _newnode.HasChildren      = true;
                        _mainTable.QueryModelID   = _qm.QueryModelID;
                        _qm.MainTable             = _mainTable;
                    }
                    List <MD_View2ViewGroup> _v2vGroup = _mdc.GetView2ViewGroupOfQueryModel(_qm.QueryModelID).ToList <MD_View2ViewGroup>();
                    if (_v2vGroup != null && _v2vGroup.Count > 0)
                    {
                        foreach (MD_View2ViewGroup _g in _v2vGroup)
                        {
                            TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                            _newnode.SetValue(this.treeListColumn1, _g);
                            _newnode.ImageIndex       = 3;
                            _newnode.SelectImageIndex = 0;
                            _newnode.HasChildren      = true;
                            _g.QueryModelID           = _qm.QueryModelID;
                        }
                    }
                    _mt = new MD_Title("关联数据指标", "MD_VIEW_GUIDELINE", _qm);
                    TreeListNode _newqxnode2 = treeList1.AppendNode(null, _fnode);
                    _newqxnode2.ImageIndex       = 8;
                    _newqxnode2.SelectImageIndex = 0;
                    _newqxnode2.SetValue(this.treeListColumn1, _mt);
                    _newqxnode2.HasChildren = true;

                    _mt = new MD_Title("集成应用展示", "MD_VIEW_APPLICATION", _qm);
                    TreeListNode _newAppnode = treeList1.AppendNode(null, _fnode);
                    _newAppnode.ImageIndex       = 8;
                    _newAppnode.SelectImageIndex = 0;
                    _newAppnode.SetValue(this.treeListColumn1, _mt);
                    _newAppnode.HasChildren = true;

                    _mt = new MD_Title("扩展权限定义", "MD_VIEW_EXRIGHT", _qm);
                    TreeListNode _newqxnode = treeList1.AppendNode(null, _fnode);
                    _newqxnode.ImageIndex       = 6;
                    _newqxnode.SelectImageIndex = 0;
                    _newqxnode.SetValue(this.treeListColumn1, _mt);
                    _newqxnode.HasChildren = true;
                }



                if (_value is MD_View2ViewGroup)
                {
                    _fnode.Nodes.Clear();
                    MD_View2ViewGroup   _v2vg = _value as MD_View2ViewGroup;
                    List <MD_View2View> _v2vs = _mdc.GetView2ViewList(_v2vg.ID, _v2vg.QueryModelID).ToList <MD_View2View>();
                    if (_v2vs != null)
                    {
                        foreach (MD_View2View _v in _v2vs)
                        {
                            TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                            _v.QueryModelID = _v2vg.QueryModelID;
                            _v.ViewGroupID  = _v2vg.ID;
                            _newnode.SetValue(this.treeListColumn1, _v);
                            _newnode.ImageIndex       = 2;
                            _newnode.SelectImageIndex = 0;
                            _newnode.HasChildren      = true;
                        }
                    }
                }



                if (_value is MD_Table)
                {
                    _fnode.Nodes.Clear();
                    MD_Table             _tb   = _value as MD_Table;
                    List <MD_Table2View> _t2vs = _mdc.GetTable2ViewList(_tb.TID).ToList <MD_Table2View>();
                    if (_t2vs != null)
                    {
                        foreach (MD_Table2View _t2v in _t2vs)
                        {
                            TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                            _newnode.SetValue(this.treeListColumn1, _t2v);
                            _newnode.ImageIndex       = 2;
                            _newnode.SelectImageIndex = 0;
                            _newnode.HasChildren      = true;
                        }
                    }
                }

                if (_value is MD_ViewTable)
                {
                    _fnode.Nodes.Clear();
                    MD_ViewTable _vt = _value as MD_ViewTable;
                    if (_vt.ViewTableType == MDType_ViewTable.MainTable)
                    {
                        MetaDataServiceClient _msc         = new MetaDataServiceClient();
                        IList <MD_ViewTable>  _childTables = _msc.GetChildTableOfQueryModel(_vt.QueryModelID);


                        foreach (MD_ViewTable _cvt in _childTables)
                        {
                            TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                            _newnode.SetValue(this.treeListColumn1, _cvt);
                            _newnode.ImageIndex       = 2;
                            _newnode.SelectImageIndex = 0;
                            _newnode.HasChildren      = true;
                            _cvt.QueryModelID         = _vt.QueryModelID;
                        }
                    }
                }

                if (_value is MD_Menu)
                {
                    MD_Menu         _fmenu     = _value as MD_Menu;
                    IList <MD_Menu> _menuTable = _mdc.GetSubMenuDefine(_fmenu.MenuID);
                    foreach (MD_Menu _menu in _menuTable)
                    {
                        TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                        _newnode.SetValue(this.treeListColumn1, _menu);
                        if (_menu.MenuType.Length > 3 && _menu.MenuType.Substring(0, 3) == "WEB")
                        {
                            _newnode.ImageIndex       = 4;
                            _newnode.SelectImageIndex = 0;
                        }
                        else if (_menu.MenuType.Length > 3 && _menu.MenuType.Substring(0, 3) == "SL_")
                        {
                            _newnode.ImageIndex       = 5;
                            _newnode.SelectImageIndex = 0;
                        }
                        else
                        {
                            _newnode.ImageIndex       = 2;
                            _newnode.SelectImageIndex = 0;
                        }
                        _newnode.HasChildren = true;
                        _menu.NodeID         = _fmenu.MD_Nodes.ID;
                        _menu.MD_Nodes       = _fmenu.MD_Nodes;
                    }
                }

                if (_value is MD_ConceptGroup)
                {
                    MD_ConceptGroup       _cGroup      = _value as MD_ConceptGroup;
                    List <MD_ConceptItem> _itemDefines = _mdc.GetSubConceptTagDefine(_cGroup.Name).ToList <MD_ConceptItem>();
                    _cGroup.Items = _itemDefines;
                    _fnode.Nodes.Clear();
                    foreach (MD_ConceptItem _item in _itemDefines)
                    {
                        TreeListNode _newnode = treeList1.AppendNode(null, _fnode);
                        _newnode.SetValue(this.treeListColumn1, _item);
                        _newnode.HasChildren = false;
                    }
                }
            }
        }
Пример #12
0
        private void AddChildMenuRight(MD_Menu _fmenu, string _fRightID, List <MD_RightDefine> _ret, MetaDataServiceClient _mdc)
        {
            IList <MD_Menu> _menuList = _mdc.GetSubMenuDefine(_fmenu.MenuID);

            foreach (MD_Menu _menu in _menuList)
            {
                MD_RightDefine _item    = new MD_RightDefine();
                decimal        _rightid = decimal.Parse(_menu.MenuID) * 1000;
                _item.RightID       = _rightid.ToString();
                _item.MenuID        = _menu.MenuID;
                _item.FatherRightID = _fRightID;
                _item.DisplayOrder  = _menu.DisplayOrder;
                _item.RightDescript = _menu.MenuToolTip;
                _item.RightName     = _menu.MenuName;
                _item.RightType     = "动态菜单";
                _item.RightMeta     = "";
                _ret.Add(_item);

                if (_menu.MenuType != null || _menu.MenuType != "")
                {
                    if (_menu.MenuType == "WEB.MENU")
                    {
                        AddWebMenuRight(_menu, _item, _ret);
                    }
                    else
                    {
                        AddPluginRight(_menu.MenuType, _item, _ret);
                    }
                }

                AddChildMenuRight(_menu, _item.RightID, _ret, _mdc);
            }
        }
Пример #13
0
        /// <summary>
        /// 创建新的权限树
        /// </summary>
        private void CreateNewRightTree()
        {
            IList <MD_Menu>       _menuList;
            List <MD_RightDefine> _ret = new List <MD_RightDefine>();

            using (MetaDataServiceClient _mdc = new MetaDataServiceClient())
            {
                #region 通过菜单定义建立权限项
                try
                {
                    this.backgroundWorker2.ReportProgress(10, "正在取菜单定义数据...");
                    _menuList = _mdc.GetMenuDefineOfNode(this.NodesData.DWDM);
                    this.backgroundWorker2.ReportProgress(10, "取菜单定义成功!");
                }
                catch (Exception ex)
                {
                    this.backgroundWorker2.ReportProgress(10, string.Format("取菜单定义数据失败!!!{0}", ex.Message));
                    return;
                }

                try
                {
                    foreach (MD_Menu _menu in _menuList)
                    {
                        MD_RightDefine _item    = new MD_RightDefine();
                        decimal        _rightid = decimal.Parse(_menu.MenuID) * 1000;
                        _item.RightID       = _rightid.ToString();
                        _item.MenuID        = _menu.MenuID;
                        _item.FatherRightID = "";
                        _item.DisplayOrder  = _menu.DisplayOrder;
                        _item.RightDescript = _menu.MenuToolTip;
                        _item.RightName     = _menu.MenuName;
                        _item.RightType     = "动态菜单";
                        _item.RightMeta     = "";
                        _ret.Add(_item);


                        if (_menu.MenuType != null || _menu.MenuType != "")
                        {
                            //添加此类型菜单中的功能权限
                            AddPluginRight(_menu.MenuType, _item, _ret);
                        }

                        AddChildMenuRight(_menu, _item.RightID, _ret, _mdc);
                    }
                }
                catch (Exception ex)
                {
                    this.backgroundWorker2.ReportProgress(10, string.Format("处理权限定义数据失败!!!{0}", ex.Message));
                    return;
                }
                #endregion


                this.backgroundWorker2.ReportProgress(10, "处理权限数据完成!正在写入...");
                try
                {
                    if (_mdc.SaveRightDefine(_ret.ToArray()))
                    {
                        this.RightData = _ret;
                    }
                    this.backgroundWorker2.ReportProgress(10, "写入权限数据完成...");
                }
                catch (Exception ex)
                {
                    this.backgroundWorker2.ReportProgress(10, string.Format("写入权限定义数据失败!!!{0}", ex.Message));
                }
            }
        }