Ejemplo n.º 1
0
 private void UpdateGroup(券商 Group)
 {
     try
     {
         var matchItem = Regex.Match(txtServerInfo.Text, "([0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}):([0-9]+)");
         if (matchItem.Success && string.IsNullOrEmpty(txtIP.Text) || string.IsNullOrEmpty(txtPort.Text))
         {
             txtIP.Text   = matchItem.Groups[1].Value;
             txtPort.Text = matchItem.Groups[2].Value;
         }
         Group.IP    = txtIP.Text.Trim();
         Group.Port  = short.Parse(txtPort.Text.Trim());
         Group.版本号   = txtVersion.Text.Trim();
         Group.登录帐号  = txtLogAccount.Text.Trim();
         Group.交易服务器 = txtServerInfo.Text;
         Group.交易密码  = Cryptor.MD5Encrypt(txtTradePsw.Text);
         Group.交易帐号  = txtTradeAccount.Text.Trim();
         Group.称     = txtName.Text.Trim();
         Group.启用    = cbIsUse.Checked;
         Group.通讯密码  = Cryptor.MD5Encrypt(txtCommunicatePsw.Text);
         Group.营业部代码 = short.Parse(txtDepartment.Text.Trim());
         CommonUtils.SetConfig(Group.称, Cryptor.MD5Encrypt(Group.ToJson()));
     }
     catch (Exception ex)
     {
         ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", string.Format("<script>alert('修改异常,{0}!');</script>", ex.Message));
     }
 }
Ejemplo n.º 2
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);
     }
 }
Ejemplo n.º 3
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();
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
0
        protected void btnLogon_Click(object sender, EventArgs e)
        {
            bool isLogon = CommonUtils.GetConfig("user") == Cryptor.MD5Encrypt(txtUserName.Value) && CommonUtils.GetConfig("psw") == Cryptor.MD5Encrypt(txtPsw.Value);

            if (isLogon)
            {
                Session["username"] = txtUserName.Value;
                Response.Redirect("Manage.aspx");
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('用户名或密码错误!');</script>");
            }
        }
Ejemplo n.º 6
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;
        }