Exemplo n.º 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 Hxj.DbObjects.OleDb.DbObject(ConnectionModel.ConnectionString);
            }
            else if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.SqlServer.ToString()))
            {
                dbObject = new Hxj.DbObjects.SQL2000.DbObject(ConnectionModel.ConnectionString);
            }
            else if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.SqlServer9.ToString()))
            {
                dbObject = new Hxj.DbObjects.SQL2005.DbObject(ConnectionModel.ConnectionString);
            }
            else if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.Oracle.ToString()))
            {
                dbObject = new Hxj.DbObjects.Oracle.DbObject(ConnectionModel.ConnectionString);
            }
            else if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.Sqlite3.ToString()))
            {
                dbObject = new Hxj.DbObjects.SQLite.DbObject(ConnectionModel.ConnectionString);
            }
            else if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.MySql.ToString()))
            {
                dbObject = new Hxj.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);
                }
            }

        }
Exemplo n.º 2
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 Hxj.DbObjects.OleDb.DbObject(ConnectionModel.ConnectionString);
            }
            else if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.SqlServer.ToString()))
            {
                dbObject = new Hxj.DbObjects.SQL2000.DbObject(ConnectionModel.ConnectionString);
            }
            else if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.SqlServer9.ToString()))
            {
                dbObject = new Hxj.DbObjects.SQL2005.DbObject(ConnectionModel.ConnectionString);
            }
            else if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.Oracle.ToString()))
            {
                dbObject = new Hxj.DbObjects.Oracle.DbObject(ConnectionModel.ConnectionString);
            }
            else if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.Sqlite3.ToString()))
            {
                dbObject = new Hxj.DbObjects.SQLite.DbObject(ConnectionModel.ConnectionString);
            }
            else if (ConnectionModel.DbType.Equals(Dos.ORM.DatabaseType.MySql.ToString()))
            {
                dbObject = new Hxj.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);
                }
            }
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取系统配置
        /// </summary>
        /// <returns></returns>
        public static Model.Sysconfig GetSysconfigModel()
        {
            Model.Sysconfig sysconfigModel = new Sysconfig();

            XmlDocument doc = new XmlDocument();
            doc.Load(SysconfigPath);
            XmlNode node = doc.SelectSingleNode("configs/config[@key='namespace']");
            if (null != node)
            {
                sysconfigModel.Namespace = node.FirstChild.InnerText;
            }
            node = doc.SelectSingleNode("configs/config[@key='batchdirectorypath']");
            if (null != node)
            {
                sysconfigModel.BatchDirectoryPath = node.FirstChild.InnerText;
            }

            return sysconfigModel;
        }