Пример #1
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BatchForm_Load(object sender, EventArgs e)
        {
            sysconfigModel    = Utils.GetSysconfigModel();
            txtNamaspace.Text = sysconfigModel.Namespace;

            llServer.Text       = connectionModel.Name;
            llDatabaseName.Text = DatabaseName;
            txtPath.Text        = sysconfigModel.BatchDirectoryPath;


            DataTable tablesDT = null;

            if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.MsAccess.ToString()))
            {
                dbObject = new Dos.DbObjects.OleDb.DbObject(ConnectionModel.ConnectionString);
            }
            else if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.SqlServer.ToString()))
            {
                dbObject = new Dos.DbObjects.SQL2000.DbObject(ConnectionModel.ConnectionString);
            }
            else if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.SqlServer9.ToString()))
            {
                dbObject = new Dos.DbObjects.SQL2005.DbObject(ConnectionModel.ConnectionString);
            }
            else if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.Oracle.ToString()))
            {
                dbObject = new Dos.DbObjects.Oracle.DbObject(ConnectionModel.ConnectionString);
            }
            else if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.Sqlite3.ToString()))
            {
                dbObject = new Dos.DbObjects.SQLite.DbObject(ConnectionModel.ConnectionString);
            }
            else if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.MySql.ToString()))
            {
                dbObject = new Dos.DbObjects.MySQL.DbObject(ConnectionModel.ConnectionString);
            }

            tablesDT = dbObject.GetTables(DatabaseName);
            DataRow[] drs = tablesDT.Select("", "name asc");
            if (null != drs && drs.Length > 0)
            {
                foreach (DataRow dr in drs)
                {
                    lbleft.Items.Add(dr[0]);
                    tableview.Add(dr[0].ToString(), false);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 设置系统配置
        /// </summary>
        /// <returns></returns>
        public static void GetSysconfigModel(Model.Sysconfig sysconfigModel)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(SysconfigPath);
            XmlNode node = doc.SelectSingleNode("configs/config[@key='namespace']");

            if (null != node)
            {
                node.FirstChild.Value = sysconfigModel.Namespace;
            }
            node = doc.SelectSingleNode("configs/config[@key='batchdirectorypath']");
            if (null != node)
            {
                node.FirstChild.Value = sysconfigModel.BatchDirectoryPath;
            }

            doc.Save(SysconfigPath);
        }