Exemple #1
0
        /************************************************************************************************************************/

        internal void Init(XConnection xConn)
        {
            //
            if (XConfig.ConnTypes.TryGetValue(xConn.Conn.GetType().FullName, out var db))
            {
                DB = db;
            }
            else
            {
                throw XConfig.EC.Exception(XConfig.EC._043, "MyDAL 只支持【MySQL】.");
            }

            //
            XConn      = xConn;
            Parameters = new List <DicParam>();
            AH         = new AttributeHelper(this);
            VH         = new CsValueHelper(this);
            GH         = new GenericHelper(this);
            XE         = new XExpression(this);
            CFH        = new CsFuncHelper(this);
            TSH        = new ToStringHelper(this);
            XC         = new XCache(this);
            PH         = new ParameterHelper(this);
            DPH        = new DicParamHelper(this);
            BDH        = new BatchDataHelper();
            TbMs       = new List <TableDic>();

            //
            SqlProvider = new MySqlProvider(this);
        }
Exemple #2
0
        /************************************************************************************************************************/

        internal void Init(XConnection xConn)
        {
            //
            if (XConfig.ConnTypes.TryGetValue(xConn.Conn.GetType().FullName, out var db))
            {
                DB = db;
            }
            else
            {
                throw XConfig.EC.Exception(XConfig.EC._043, "MyDAL 目前只支持【MySQL/SQLServer】,后续将会支持【Oracle/PostgreSQL/DB2/Access/SQLite/Teradata/MariaDB】.");
            }

            //
            XConn      = xConn;
            Parameters = new List <DicParam>();
            AH         = new AttributeHelper(this);
            VH         = new CsValueHelper(this);
            GH         = new GenericHelper(this);
            XE         = new XExpression(this);
            CFH        = new CsFuncHelper(this);
            TSH        = new ToStringHelper(this);
            XC         = new XCache(this);
            PH         = new ParameterHelper(this);
            DPH        = new DicParamHelper(this);
            BDH        = new BatchDataHelper();
            TbMs       = new List <TableDic>();

            //
            if (XConfig.DbProviders.TryGetValue(DB, out var func))
            {
                SqlProvider = func(this);
            }
        }
Exemple #3
0
        /************************************************************************************************************************/

        internal void Init(IDbConnection conn)
        {
            //
            if (XConfig.DB == DbEnum.None)
            {
                if (XConfig.MySQL.Equals(conn.GetType().FullName, StringComparison.OrdinalIgnoreCase))
                {
                    XConfig.DB = DbEnum.MySQL;
                }
                else
                {
                    throw new Exception("MyDAL 目前只支持 【MySQL】,后续将会支持【Oracle/SQLServer/PostgreSQL/DB2/Access/SQLite/Teradata/MariaDB】.");
                }
            }

            //
            Conn       = conn;
            Parameters = new List <DicParam>();
            AH         = new AttributeHelper(this);
            VH         = new CsValueHelper(this);
            GH         = new GenericHelper(this);
            EH         = new XExpression(this);
            SC         = new XCache(this);
            PH         = new ParameterHelper(this);
            DPH        = new DicParamHelper(this);
            BDH        = new BatchDataHelper();
            DS         = new DataSource(this);

            //
            if (XConfig.DB == DbEnum.MySQL)
            {
                SqlProvider = new MySqlProvider(this);
            }
        }
Exemple #4
0
        /// <summary>
        /// 窗体加载事件
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">e</param>
        private void MainForm_Load(object sender, EventArgs e)
        {
            ////检测是否配置路由,如果没有,则弹出提示框,如果配置了,直接启动
            List <MSysDicItemInfo> dicParams = DicParamHelper.GetParamById("ITZC_YW_VpnNetWorkSegmentRoute");

            if (dicParams == null || dicParams.Count == 0)
            {
                MessageBox.Show("没有获取到路由参数,请配置路由参数!", "517VPN客户端提示", MessageBoxButtons.OK);
                System.Environment.Exit(0);
            }
            else
            {
                ////添加路由
                bool addResult = this.AddNetWorkRoute(dicParams);
                if (addResult)
                {
                    this.workingLog.WindowState = FormWindowState.Minimized;
                    this.workingLog.Show();
                    MessagePipe.WriteMessageEvent     += this.workingLog.ShowMessage;
                    MessagePipe.BindVpnInfoEvent      += this.ShowVpnServer;
                    MessagePipe.DelVpnServerInfoEvent += this.DelVpnServer;
                    MessagePipe.ShowAccountInfoEvent  += this.ShowAccount;
                    MessagePipe.ShowIpInfoEvent       += this.ShowIP;
                    MessagePipe.ShowLinkInfoEvent     += this.ShowLinkStatu;
                    this.bulletMsg = this.BulletMessage;
                    if (this.vpnControlThread == null)
                    {
                        this.vpnControlThread = new VpnControlThread();
                    }

                    this.vpnControlThread.MaxThreadCount = 4;
                    this.vpnControlThread.ExcuteThreadInstance();
                }
                else
                {
                    MessageBox.Show("添加路由失败,程序不能启动?", "517VPN客户端提示", MessageBoxButtons.OK);
                    System.Environment.Exit(0);
                }
            }
        }