Esempio n. 1
0
        public static DBInfoModel GetBDList()
        {
            DBInfoModel model  = new DBInfoModel();
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(Path.Combine(Environment.CurrentDirectory, "AppData", "DBLinkInfo.xml"));
            XmlNodeList xnList = xmlDoc.SelectNodes("DBInfoList/DBInfo");

            if (xnList != null && xnList.Count > 0)
            {
                foreach (XmlNode node in xnList)
                {
                    DBInfo info = new DBInfo()
                    {
                        DBName = node["DBName"].InnerText,
                        Port   = node["Port"].InnerText,
                        Pwd    = node["Pwd"].InnerText,
                        Server = node["Server"].InnerText,
                        Type   = (DBEnum)Enum.Parse(typeof(DBEnum), node["Type"].InnerText),
                        Uid    = node["Uid"].InnerText
                    };
                    GetTableList(info);
                    model.DBInfoList.Add(info);
                }
            }
            return(model);
        }
Esempio n. 2
0
 /// <summary>
 /// IF Exist Update Else Add
 /// </summary>
 /// <param name="model"></param>
 public DBInfoModel Add(DBInfoModel model)
 {
     if (ExistDBInfo(model.ServerName, model.DBName))
     {
         DBInfoModel existModel = DBInfoList.Find(new Predicate <DBInfoModel>((m) => { return(m.UniqueID() == model.UniqueID()); }));
         if (existModel != null)
         {
             existModel.ServerName = model.ServerName;
             existModel.UserID     = model.UserID;
             existModel.Password   = model.Password;
             existModel.DBName     = model.DBName;
             return(existModel);
         }
         else
         {
             DBInfoList.Add(model);
             return(model);
         }
     }
     else
     {
         DBInfoList.Add(model);
         return(model);
     }
 }
Esempio n. 3
0
 public ABMainForm(AutoBuildEntityContent abContent)
 {
     InitializeComponent();
     ABContent = abContent;
     DBInfo    = GetDBLink.GetBDList();
     BindData(DBInfo);
     OutputWindowHelper.OutPutMessage("数据已加载完成");
 }
 public BEMainForm(BuildEverythingContent beContent)
 {
     InitializeComponent();
     BEContent = beContent;
     InitFiles();
     DBInfo = new GetDBLink().GetBDList(BEContent.SelectedProject.ABEPath);
     BindData();
     OutPutMsg($"资源配置地址:{BEContent.SelectedProject.RootPath}");
     OutPutMsg("数据已加载完成...");
 }
Esempio n. 5
0
        private void cbxServerNames_SelectedIndexChanged(object sender, EventArgs e)
        {
            DBInfoModel dbInfo = cbxServerNames.SelectedItem as DBInfoModel;

            if (dbInfo == null)
            {
                return;
            }

            tbxUserID.Text   = dbInfo.UserID;
            tbxPassword.Text = dbInfo.Password;
            tbxDBName.Text   = dbInfo.DBName;
        }
Esempio n. 6
0
 /// <summary>
 /// 数据绑定
 /// </summary>
 /// <param name="model"></param>
 /// <param name="tview"></param>
 private void BindData(DBInfoModel model)
 {
     foreach (DBInfo info in model.DBInfoList)
     {
         TreeNode node = new TreeNode();
         node.ImageKey         = "database.png";
         node.SelectedImageKey = "database.png";
         node.Name             = info.DBName;
         node.Text             = info.DBName;
         foreach (var table in info.TableStruList.Select(s => s.TableName).Distinct())
         {
             TreeNode subNode = new TreeNode()
             {
                 Name             = table,
                 Text             = table,
                 ImageKey         = "table.png",
                 SelectedImageKey = "table.png"
             };
             node.Nodes.Add(subNode);
         }
         tv_DBList.Nodes.Add(node);
     }
     cbx_Folder.DataSource = ABContent.SelectedProject.FolderNames;
 }