Esempio n. 1
0
        public void Update(User user)
        {
            if (string.IsNullOrWhiteSpace(user.UserName) || string.IsNullOrWhiteSpace(user.NickName))
            {
                throw new ArgumentException("either username or nickname is not provided.");
            }

            var sql = @"if exists select * from user where userid = @userid and username = @username and disabled = 0
                                update user set password=@password, nickname=@nickname, mobilephone=@mobilephone, qq=@qq, wechat=@wechat
                                    where userid = @userid and username = @username;";

            var parameters = new IDataParameter[]
            {
                new MySqlParameter("@userid", user.UserId),
                new MySqlParameter("@username", user.UserName),
                new MySqlParameter("@password", user.Password),
                new MySqlParameter("@nickname", user.NickName),
                new MySqlParameter("@mobilephone", user.MobilePhone),
                new MySqlParameter("@qq", user.QQ),
                new MySqlParameter("@wechat", user.WeChat),
                new MySqlParameter("@registerdate", user.RegisterDate),
            };

            this.DbRequest.ExecuteNonQuery(this.ConnectionString, sql, parameters, CommandType.Text);
        }
Esempio n. 2
0
        private void RedirectionPreviousUserPage(User userInfo)
        {
            this.Session[ResourceHelper.Session_Key_User_ID] = userInfo.UserId;
            this.Session[ResourceHelper.Session_Key_User_Name] = userInfo.UserName;
            this.Session[ResourceHelper.Session_Key_User_Nick_Name] = userInfo.NickName;
            this.Session[ResourceHelper.Session_Key_User_StockAgentIds] = userInfo.StockAgentIds;

            var sourceUrl = HttpUtility.UrlDecode(this.Request["input-source-url"]);

            if (!string.IsNullOrWhiteSpace(sourceUrl))
            {
                this.Response.Write(string.Format("<script type=\"text/javascript\">location.href=\"{0}\";</script>", sourceUrl));
            }
            else
            {
                this.Response.Write("<script type=\"text/javascript\">location.href=\"/pool/realtime\";</script>");
            }
        }
Esempio n. 3
0
        public void Create(User user)
        {
            if (string.IsNullOrWhiteSpace(user.UserName) || string.IsNullOrWhiteSpace(user.NickName))
            {
                throw new ArgumentException("either username or nickname is not provided.");
            }

            var sql = @"if not exists select * from user where username = @username
                                insert into user(username, password, nickname, mobilephone, qq, wechat, registerdate, disabled)
                                    values(@username, @password, @nickname, @mobilephone, @qq, @wechat, @registerdate, 0);";

            var parameters = new IDataParameter[]
            {
                new MySqlParameter("@username", user.UserName),
                new MySqlParameter("@password", user.Password),
                new MySqlParameter("@nickname", user.NickName),
                new MySqlParameter("@mobilephone", user.MobilePhone),
                new MySqlParameter("@qq", user.QQ),
                new MySqlParameter("@wechat", user.WeChat),
                new MySqlParameter("@registerdate", user.RegisterDate),
            };

            var returnCode = this.DbRequest.ExecuteNonQuery(this.ConnectionString, sql, parameters, CommandType.Text);
        }