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); } }
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("登录成功"); } }