Пример #1
0
 public bool Login(string userName, string password)
 {
     try
     {
         bool isLogon = CommonUtils.GetConfig("user") == userName && CommonUtils.GetConfig("psw") == 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
        private void InitPage()
        {
            List <券商> lstGroups = new List <券商>();

            foreach (string item in WebConfigurationManager.AppSettings.AllKeys)
            {
                if (Regex.IsMatch(item, "^[A-Z][0-9]{2}$"))
                {
                    try
                    {
                        var o = Cryptor.MD5Decrypt(WebConfigurationManager.AppSettings[item]).FromJson <券商>();
                        if (o != null)
                        {
                            lstGroups.Add(o);
                        }
                    }
                    catch (Exception ex)
                    {
                        CommonUtils.Log(item + " decrypt error :" + ex.Message);
                    }
                }
            }
            rptMain.DataSource = lstGroups;
            rptMain.DataBind();
        }
Пример #3
0
        public bool CompareToolLogin(string userName, string password)
        {
            try
            {
                var configInfo = CommonUtils.GetConfig("compare_login");
                var upArr      = Cryptor.MD5Decrypt(configInfo).Split('|');
                foreach (var item in upArr)
                {
                    var up = item.Split('-');
                    if (up[0] == userName)
                    {
                        bool isLogon = password == up[1];
                        if (isLogon)
                        {
                            if (dictLogon.ContainsKey(userName))
                            {
                                dictLogon[userName] = DateTime.Now;
                            }
                            else
                            {
                                dictLogon.Add(userName, DateTime.Now);
                                //CommonUtils.Log(string.Format("对比工具用户'{0}'登录成功 ", userName));
                            }
                        }
                        return(isLogon);
                    }
                }
                return(false);

                //bool isLogon = CommonUtils.GetConfig("compare_user") == userName && CommonUtils.GetConfig("compare_psw") == 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("CompareToolLogin Exception" + ex.Message);
                return(false);
            }
        }
Пример #4
0
        private void InitPage(string groupName)
        {
            var config = CommonUtils.GetConfig(groupName);
            var o      = Cryptor.MD5Decrypt(config).FromJson <券商>();

            this.cbIsUse.Checked      = o.启用;
            this.txtDepartment.Text   = o.营业部代码.ToString();
            this.txtIP.Text           = o.IP;
            this.txtLogAccount.Text   = o.登录帐号;
            this.txtName.Text         = groupName;
            this.txtPort.Text         = o.Port.ToString();
            this.txtServerInfo.Text   = o.交易服务器;
            this.txtTradeAccount.Text = o.交易帐号;
            this.txtVersion.Text      = o.版本号;

            this.txtCommunicatePsw.Attributes.Add("value", o.CommunicatePsw);
            this.txtTradePsw.Attributes.Add("value", o.TradePsw);
            //this.txtTradePsw.Text = o.TradePsw;
            //this.txtCommunicatePsw.Text = o.CommunicatePsw;
        }