Пример #1
0
 public bool Login(string userName, string password)
 {
     try
     {
         bool isLogon = "admin" == userName && CommonUtils.GetConfig("password") == Cryptor.MD5Encrypt(password);
         if (isLogon)
         {
             if (dictLogon.ContainsKey(userName))
             {
                 dictLogon[userName] = DateTime.Now;
             }
             else
             {
                 dictLogon.Add(userName, DateTime.Now);
                 CommonUtils.Log(string.Format("用户'{0}'登录成功 ", Cryptor.MD5Decrypt(userName)));
             }
         }
         return(isLogon);
     }
     catch (Exception ex)
     {
         CommonUtils.Log(ex.Message);
         return(false);
     }
 }
Пример #2
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);
        }
Пример #3
0
        public string Logon()
        {
            StringBuilder ErrInfo = new StringBuilder(256);

            try
            {
                this.ClientID = TdxApi.Logon(this.IP, this.Port, this.版本号, this.营业部代码, this.登录帐号, this.交易帐号, Cryptor.MD5Decrypt(this.交易密码), Cryptor.MD5Decrypt(this.通讯密码), ErrInfo);
            }
            catch (Exception ex)
            {
                this.ClientID = -1;
                ErrInfo.Append("登录异常,将自动禁用,请检查组合号信息!");
                this.启用 = false;
                CommonUtils.Log("组合号登录异常", ex);
            }

            if (ErrInfo.ToString() != string.Empty)
            {
                if (this.ClientID != -1)
                {
                    this.ClientID = -1;
                }
                return("登录失败:" + ErrInfo.ToString());
            }
            else
            {
                return("登录成功");
            }
        }