예제 #1
0
        /// <summary>
        /// 卸载一个图标(通过数据库类型枚举值和ID)  cyf 20110627 modify
        /// </summary>
        /// <param name="enumDBType">数据库类型枚举值</param>
        /// <param name="lDBID">数据库ID</param>
        //public void RemoveDataBasePro(string DBTypeStr, long lDBID)
        //{
        //    if (this.m_DBProjects.ContainsKey(DBTypeStr))
        //    {
        //        List<ClsDataBaseProject> pDataBasePros = null;
        //        this.m_DBProjects.TryGetValue(DBTypeStr, out pDataBasePros);
        //        if (pDataBasePros == null) return;
        //        for (int i=0;i<pDataBasePros.Count;i++)
        //        {
        //            ClsDataBaseProject pGetDataBasePro=pDataBasePros[i];
        //            if (pGetDataBasePro.lDBID == lDBID)
        //            {
        //                pDataBasePros.Remove(pGetDataBasePro);
        //                break;
        //            }
        //        }
        //        Refurbish();
        //    }
        //}

        /// <summary>
        /// 卸载一个图标(通过数据库类型文本和ID)
        /// </summary>
        /// <param name="enumDBTypeStr">数据库类型的文本</param>
        /// <param name="lDBID">数据库ID</param>
        public void RemoveDataBasePro(string enumDBTypeStr, long lDBID)
        {
            //cyf 20110627 modify
            Exception ex = null;

            //enumInterDBType pDBType = GetDBType(enumDBTypeStr, out ex);
            if (ex != null)
            {
                return;
            }
            if (this.m_DBProjects.ContainsKey(enumDBTypeStr))
            {
                List <ClsDataBaseProject> pDataBasePros = null;
                this.m_DBProjects.TryGetValue(enumDBTypeStr, out pDataBasePros);
                if (pDataBasePros == null)
                {
                    return;
                }
                for (int i = 0; i < pDataBasePros.Count; i++)
                {
                    ClsDataBaseProject pGetDataBasePro = pDataBasePros[i];
                    if (pGetDataBasePro.lDBID == lDBID)
                    {
                        pDataBasePros.Remove(pGetDataBasePro);
                        //added by chulili 20110725删除的彻底一些
                        m_DBLables.Remove(lDBID.ToString());
                        //end added by chulili
                        break;
                    }
                }
                Refurbish();
            }
        }
예제 #2
0
        /// <summary>
        /// 判断一个数据库工程是否已存在(通过ClsDataBaseProject对象)
        /// </summary>
        /// <param name="in_DataBasePro"></param>
        /// <returns>存在返回True,不存在返回False,内部异常返回False</returns>
        private bool JudgeADataBaseProIsExist(ClsDataBaseProject in_DataBasePro)
        {
            if (in_DataBasePro == null)
            {
                return(false);
            }
            if (this.m_DBProjects == null)
            {
                return(false);
            }
            //cyf 20110627 modify
            if (!m_DBProjects.ContainsKey(in_DataBasePro.DBTypeStr))
            {
                return(false);
            }
            List <ClsDataBaseProject> GetDataBasePros = null;

            m_DBProjects.TryGetValue(in_DataBasePro.DBTypeStr, out GetDataBasePros);
            if (null == GetDataBasePros)
            {
                return(false);
            }
            foreach (ClsDataBaseProject GetExistDataBase in GetDataBasePros)
            {
                if (GetExistDataBase.lDBID == in_DataBasePro.lDBID)
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #3
0
        // *---------------------------------------------------------------------------------------
        // *开 发 者:陈亚飞
        // *功能函数:修改数据源时同步修改控件label
        // *开发日期:2011-06-27
        // *参    数:数据源ID,数据源名称
        public void EditLabel(string pDBTypeStr, string mProID, string mProName)
        {
            if (m_DBLables.ContainsKey(mProID))
            {
                DevComponents.DotNetBar.LabelX pLabel = null;  //选中数据源工程项对应的标签
                pLabel = m_DBLables[mProID];
                //added by chulili 20110714更新界面中的label
                for (int i = 0; i < this.m_DataBaseGroupPanel.Controls.Count; i++)
                {
                    DevComponents.DotNetBar.LabelX pTmpLabel = this.m_DataBaseGroupPanel.Controls[i] as DevComponents.DotNetBar.LabelX;
                    if (pTmpLabel == null)
                    {
                        continue;
                    }
                    if (pTmpLabel.Location.X == pLabel.Location.X && pTmpLabel.Location.Y == pLabel.Location.Y && pTmpLabel.Text == pLabel.Text)
                    {
                        pTmpLabel.Text = mProName;
                        break;
                    }
                }
                //end add
                pLabel.Text = mProName;
                System.Windows.Forms.Application.DoEvents();
                //cyf 20110630  add
                if (m_DBButtons.ContainsKey(pDBTypeStr))
                {
                    List <DevComponents.DotNetBar.ButtonX> Getbuttons = new List <DevComponents.DotNetBar.ButtonX>();
                    m_DBButtons.TryGetValue(pDBTypeStr, out Getbuttons);
                    if (Getbuttons == null)
                    {
                        return;
                    }
                    foreach (DevComponents.DotNetBar.ButtonX Getbutton in Getbuttons)
                    {
                        if (Getbutton.Tag == null)
                        {
                            continue;
                        }
                        ClsDataBaseProject ClsDataBase = Getbutton.Tag as ClsDataBaseProject; if (ClsDataBase == null)
                        {
                            continue;
                        }
                        if (ClsDataBase.lDBID.ToString() == mProID)
                        {
                            Getbutton.Tooltip = mProName;
                            break;
                        }
                    }
                }

                //end
            }
        }
예제 #4
0
        /// <summary>
        /// 将一个数据库相应的Button变为焦点状态
        /// </summary>
        /// <param name="enumDBTypeStr">数据库类型的文本</param>
        /// <param name="lDBID">数据库ID</param>
        public void SelectButton(DevComponents.AdvTree.Node treenode)
        {
            Exception ex = null;

            try
            {
                //cyf 20110627 modify
                //enumInterDBType DataBaseTpe = GetDBType(enumDBTypeStr, out ex); if (ex != null) return;
                if (treenode.Level == 2)
                {
                    XmlElement DbInfoEle     = treenode.Tag as XmlElement;
                    string     enumDBTypeStr = DbInfoEle.GetAttribute("数据库类型"); if (string.IsNullOrEmpty(enumDBTypeStr))
                    {
                        return;
                    }
                    if (m_DBButtons.ContainsKey(enumDBTypeStr))
                    {
                        List <DevComponents.DotNetBar.ButtonX> Getbuttons = new List <DevComponents.DotNetBar.ButtonX>();
                        m_DBButtons.TryGetValue(enumDBTypeStr, out Getbuttons);
                        if (Getbuttons == null)
                        {
                            return;
                        }
                        foreach (DevComponents.DotNetBar.ButtonX Getbutton in Getbuttons)
                        {
                            if (Getbutton.Tag == null)
                            {
                                continue;
                            }
                            ClsDataBaseProject ClsDataBase = Getbutton.Tag as ClsDataBaseProject; if (ClsDataBase == null)
                            {
                                continue;
                            }
                            if (ClsDataBase.lDBID == (long)treenode.DataKey)
                            {
                                Getbutton.Focus();
                                break;
                            }
                        }
                    }
                }
                Refurbish(treenode);
                //end
            }
            catch
            {
            }
        }
예제 #5
0
        /// <summary>
        /// 刷新界面的Button   cyf 20110627 modify
        /// </summary>
        /// <param name="sDBName">数据库工程名</param>
        /// <param name="sDBType">数据库类型</param>
        /// <param name="sDBFormate">数据库平台</param>
        /// <param name="DBInFo">数据库信息</param>
        /// <param name="DBConInfo">数据库连接信息</param>
        public void UpDataButton(long lDBID, string sDBName, long lDBTypeID, long lDBFormatID, string sDBType, string sDBFormate, XmlElement DBInFo, XmlElement DBConInfo)
        {
            Exception ex = null;
            //cyf 20110627 delete:
            //enumInterDBType DBType = GetDBType(lDBTypeID, out ex); ; if (null != ex) return;
            //enumInterDBFormat DBFormat = GetDBFormate(lDBFormatID, out ex);; if (null != ex) return;
            ClsDataBaseProject pDBPro = new ClsDataBaseProject(lDBID, lDBTypeID, lDBFormatID, sDBType, sDBFormate, sDBName, DBInFo, DBConInfo);

            //end
            try
            {
                ModuleData.v_DataBaseProPanel.AddDataBasePro(pDBPro);
            }
            catch
            {
            }
        }
예제 #6
0
        /// <summary>
        /// 将一个数据库相应的Button变为焦点状态
        /// </summary>
        /// <param name="enumDBTypeStr">数据库类型的文本</param>
        /// <param name="lDBID">数据库ID</param>
        public void SelectButton(string enumDBTypeStr, long lDBID)
        {
            Exception ex = null;

            try
            {
                //cyf 20110627 modify
                //enumInterDBType DataBaseTpe = GetDBType(enumDBTypeStr, out ex); if (ex != null) return;
                if (m_DBButtons.ContainsKey(enumDBTypeStr))
                {
                    List <DevComponents.DotNetBar.ButtonX> Getbuttons = new List <DevComponents.DotNetBar.ButtonX>();
                    m_DBButtons.TryGetValue(enumDBTypeStr, out Getbuttons);
                    if (Getbuttons == null)
                    {
                        return;
                    }
                    foreach (DevComponents.DotNetBar.ButtonX Getbutton in Getbuttons)
                    {
                        if (Getbutton.Tag == null)
                        {
                            continue;
                        }
                        ClsDataBaseProject ClsDataBase = Getbutton.Tag as ClsDataBaseProject; if (ClsDataBase == null)
                        {
                            continue;
                        }
                        if (ClsDataBase.lDBID == lDBID)
                        {
                            Getbutton.Focus();
                            break;
                        }
                    }
                }
                //end
            }
            catch
            {
            }
        }
예제 #7
0
 /// <summary>
 /// 增加一个数据库工程,并刷新容器面板
 /// </summary>
 /// <param name="in_DataBasePro"></param>
 public void AddDataBasePro(ClsDataBaseProject in_DataBasePro)
 {
     if (in_DataBasePro == null)
     {
         return;
     }
     //cyf 20110627
     if (this.m_DBProjects == null)
     {
         this.m_DBProjects = new Dictionary <string, List <ClsDataBaseProject> >();                        // new Dictionary<enumInterDBType, List<ClsDataBaseProject>>();
     }
     if (this.m_DBProjects.ContainsKey(in_DataBasePro.DBTypeStr))
     {
         if (JudgeADataBaseProIsExist(in_DataBasePro))
         {
             return;
         }
         List <ClsDataBaseProject> GetDataBasePros = null;
         m_DBProjects.TryGetValue(in_DataBasePro.DBTypeStr, out GetDataBasePros);
         if (GetDataBasePros == null)
         {
             GetDataBasePros = new List <ClsDataBaseProject>();
         }
         //if (GetDataBasePros.Contains(in_DataBasePro)) return;//没有起作用
         GetDataBasePros.Add(in_DataBasePro);
         m_DBProjects.Remove(in_DataBasePro.DBTypeStr);
         m_DBProjects.Add(in_DataBasePro.DBTypeStr, GetDataBasePros);
     }
     else
     {
         List <ClsDataBaseProject> GetDataBasePros = null;
         GetDataBasePros = new List <ClsDataBaseProject>();
         GetDataBasePros.Add(in_DataBasePro);
         m_DBProjects.Add(in_DataBasePro.DBTypeStr, GetDataBasePros);
     }
     Refurbish();
     //end
 }
예제 #8
0
 /// <summary>
 /// 为每一个数据库项目添加控件实例
 /// </summary>
 /// <param name="pDataBaseProjects"></param>
 /// <param name="iCurrentRow"></param>
 /// <param name="iCurrentCol"></param>
 private void AddButtons(List <ClsDataBaseProject> pDataBaseProjects, ref int iCurrentRow, ref int iCurrentCol)
 {
     if (pDataBaseProjects == null)
     {
         return;
     }
     if (pDataBaseProjects.Count <= 0)
     {
         return;
     }
     ////////////////////为不同的数据库工程创建控件//////////////////////
     for (int i = 0; i < pDataBaseProjects.Count; i++)
     {
         ClsDataBaseProject pDataBasePro = pDataBaseProjects[i];
         if (null == pDataBasePro)
         {
             continue;
         }
         ///ZQ  20111103  处理一行添加个数的长度超出控件大小产生滚动条的问题
         if (m_lBID > 0 && pDataBasePro.lDBID != m_lBID)
         {
             continue;
         }
         int Length = (iCurrentCol + 1) * this.iNewButtonWith + iButtonDiatance * iCurrentCol + this.iButtonDiatance;
         if (Length > this.m_DataBaseGroupPanel.Width)
         {
             ChangeRow(ref iCurrentRow, ref iCurrentCol);
             Length = (iCurrentCol + 1) * this.iNewButtonWith + iButtonDiatance * iCurrentCol + this.iButtonDiatance;
             ///ZQ  20111103   解决换行存在位置重置问题
             iCurrentCol += 1;
             ///
         }
         else
         {
             iCurrentCol += 1;
         }
         //////////////////创建控件实例//////////////////
         DevComponents.DotNetBar.ButtonX NewbtnDB = new DevComponents.DotNetBar.ButtonX();
         //////////////////计算出现位置///////////////////
         int x = Length - this.iNewButtonWith;
         ///end  ZQ
         int y = 0;
         if (iCurrentRow == 0)
         {
             y = iCurrentRow * this.iNewButtonHeigh + iCurrentRow * iButtonDiatance + iDataBaseTypeLableHeight + iDataBaseTypeLableCount * iDataBaseTypeLableHeight;
         }
         else
         {
             y = iCurrentRow * this.iNewButtonHeigh + iCurrentRow * iButtonDiatance + (iDataBaseTypeLableCount) * iDataBaseTypeLableHeight + iDataBaseTypeLableHeight;
         }
         NewbtnDB.Location = new System.Drawing.Point(x, y);
         NewbtnDB.Size     = new System.Drawing.Size(this.iNewButtonWith, this.iNewButtonHeigh);
         // NewbtnDB.Text = pDataBasePro.sDbName;
         NewbtnDB.Tooltip    = pDataBasePro.sDbName;
         NewbtnDB.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
         NewbtnDB.Tag        = pDataBasePro;
         NewbtnDB.Image      = GeoDBIntegration.Properties.Resources.database100x100;/////////////////在此为不同数据库类型设置不同图标
         NewbtnDB.Shape      = new DevComponents.DotNetBar.RoundRectangleShapeDescriptor(17, 2, 2, 2);
         NewbtnDB.BackColor  = System.Drawing.Color.Transparent;
         NewbtnDB.Click     += new System.EventHandler(btn_click);
         //事件绑定
         //NewbtnDB.DoubleClick += new System.EventHandler(btn_Doubleclick);
         this.m_DataBaseGroupPanel.Controls.Add(NewbtnDB);
         /////////////////////把button记录下来///////////////
         //cyf 20110627 modify:
         if (m_DBButtons == null)
         {
             m_DBButtons = new Dictionary <string, List <DevComponents.DotNetBar.ButtonX> >();                  // new Dictionary<enumInterDBType, List<DevComponents.DotNetBar.ButtonX>>();
         }
         if (m_DBButtons.ContainsKey(pDataBasePro.DBTypeStr))
         {
             List <DevComponents.DotNetBar.ButtonX> Getbuttons = null;
             m_DBButtons.TryGetValue(pDataBasePro.DBTypeStr, out Getbuttons);
             if (Getbuttons == null)
             {
                 Getbuttons = new List <DevComponents.DotNetBar.ButtonX>();
             }
             if (!Getbuttons.Contains(NewbtnDB))
             {
                 Getbuttons.Add(NewbtnDB);
             }
         }
         else
         {
             List <DevComponents.DotNetBar.ButtonX> Getbuttons = new List <DevComponents.DotNetBar.ButtonX>();
             Getbuttons.Add(NewbtnDB);
             m_DBButtons.Add(pDataBasePro.DBTypeStr, Getbuttons);
         }
         //end
         AddLabledownButton(pDataBasePro.lDBID.ToString(), pDataBasePro.sDbName, NewbtnDB);
     }
 }