Example #1
0
 private void btnSubmit_Click(object sender, RoutedEventArgs e)
 {
     if (Valid())
     {
         CommonUtils.SetConfig("user", txtAccount.Text);
         CommonUtils.SetConfig("password", Cryptor.MD5Encrypt(txtPassword.Password));
         this.Close();
     }
 }
Example #2
0
        private 券商 GetPageEntity()
        {
            if (this.GroupEntity == null)
            {
                GroupEntity = new 券商()
                {
                    IsIMSAccount = true
                }
            }
            ;

            var o = GroupEntity;

            o.称   = this.txt名称.Text.Trim();
            o.启用  = this.ckIsEnable.IsChecked == true;
            o.版本号 = this.txt版本号.Text.Trim();
            //o.交易服务器 = this.txt交易服务器.Text.Trim();
            //var serverInfo = Regex.Match(o.交易服务器, "[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}").Value;
            //o.IP = serverInfo;

            o.交易帐号 = this.txt帐号.Text.Trim();
            if (ckIsEncrypt.IsChecked == true)
            {
                o.交易密码 = this.txt密码.Password;
                o.通讯密码 = Cryptor.MD5Encrypt(string.Empty);;
            }
            else
            {
                o.交易密码 = Cryptor.MD5Encrypt(this.txt密码.Password);
                o.通讯密码 = Cryptor.MD5Encrypt(string.Empty);
            }

            o.产品信息 = this.txt产品信息.Text.Trim();
            o.资产单元 = this.txt资产单元.Text.Trim();
            o.投资组合 = this.txt投资组合.Text.Trim();

            int time = 0;

            if (int.TryParse(this.txt查询时间间隔.Text.Trim(), out time))
            {
                o.查询间隔时间 = time;
            }

            //o.Multithreading = ckIsMultiThread.IsChecked == true;
            return(o);
        }
Example #3
0
        public static bool UpdateGroup(券商 o)
        {
            try
            {
                var groupJson = (new GroupInfo(o)).ToJson();
                CommonUtils.SetConfig(o.称, Cryptor.MD5Encrypt(groupJson));

                if (o.ClientID == -1 && o.启用)
                {
                    o.Start();
                }
            }
            catch (Exception ex)
            {
                CommonUtils.Log("新增或编辑组合号出错", ex);
                return(false);
            }
            return(true);
        }
Example #4
0
        private bool Valid()
        {
            var userName = CommonUtils.GetConfig("user");     //admin
            var psw      = CommonUtils.GetConfig("password"); //12345

            if (string.IsNullOrEmpty(userName))
            {
                userName = "******";
                CommonUtils.SetConfig("user", "admin");
            }
            if (string.IsNullOrEmpty(psw))
            {
                psw = Cryptor.MD5Decrypt("57DDBC28E53C7DEA");
                CommonUtils.SetConfig("password", "57DDBC28E53C7DEA");
            }
            if (txtUserName.Text == userName && Cryptor.MD5Encrypt(pb.Password) == psw)
            {
                return(true);
            }
            return(false);
        }
Example #5
0
        private 券商 GetPageEntity()
        {
            if (this.GroupEntity == null)
            {
                GroupEntity = new 券商();
            }

            var o = GroupEntity;

            o.IP    = this.txtIP.Text;
            o.Port  = short.Parse(this.txtPort.Text.Trim());
            o.版本号   = this.txt版本号.Text.Trim();
            o.登录帐号  = this.txt登录帐号.Text.Trim();
            o.交易服务器 = this.txt交易服务器.Text.Trim();
            o.交易帐号  = this.txt交易帐号.Text.Trim();
            o.称     = this.txt名称.Text.Trim();
            o.启用    = this.ckIsEnable.IsChecked == true;
            if (ckIsEncrypt.IsChecked == true)
            {
                o.交易密码 = this.txt交易密码.Password;
                o.通讯密码 = this.txt通讯密码.Password;
            }
            else
            {
                o.交易密码 = Cryptor.MD5Encrypt(this.txt交易密码.Password);
                o.通讯密码 = Cryptor.MD5Encrypt(this.txt通讯密码.Password);
            }

            int time = 0;

            if (int.TryParse(this.txt查询时间间隔.Text.Trim(), out time))
            {
                o.查询间隔时间 = time;
            }

            o.营业部代码          = short.Parse(this.txt营业部代码.Text);
            o.Multithreading = ckIsMultiThread.IsChecked == true;
            return(o);
        }