public User GetUserByUserName(string userName)
        {
            User user = new User();
            string sql = "select * from Tb_User where UserName=@UserName";
            SqlParameter[] parms = SqlHelperParameterCache.GetCachedParameterSet(sql);
            if (parms == null)
            {
                parms = new SqlParameter[] {
                    new SqlParameter("@UserName",SqlDbType.NVarChar,15)
                };
                SqlHelperParameterCache.CacheParameterSet(sql, parms);
            }

            parms[0].Value = userName;

            using (SqlDataReader dr = SqlHelper.ExecuteReader(connString, CommandType.Text, sql, parms))
            {
                RowHelper row = new RowHelper(dr);
                if (row.Read())
                {
                    user.UserID = row.GetInt32("UserID");
                    user.LastLoginIP = row.GetString("LastLoginIP");
                    user.LastLoginTime = row.GetDateTime("LastLoginTime");
                    user.RegTime = row.GetDateTime("RegTime");
                    user.Server = row.GetString("Server");
                    user.Status = row.GetUInt32("Status");
                    user.UserName = row.GetString("UserName");
                    user.UserPwd = row.GetString("UserPwd");
                }
                dr.Close();
            }
            return user;
        }
        public void InsertUser(User user)
        {
            bool isExist = IsExistsUserName(user.UserName);
            if (isExist)
                return;

            string sql = "Insert into Tb_User (UserName,UserPwd,LastLoginIP,LastLoginTime,RegTime) values (@UserName,@UserPwd,@LastLoginIP,getdate(),getdate())";
            SqlParameter[] parms = SqlHelperParameterCache.GetCachedParameterSet(sql);
            if (parms == null)
            {
                parms = new SqlParameter[] {
                    new SqlParameter("@UserName",SqlDbType.NVarChar,15),
                    new SqlParameter("@UserPwd",SqlDbType.NVarChar,32),
                    new SqlParameter("@LastLoginIP",SqlDbType.NVarChar,20)
                };
                SqlHelperParameterCache.CacheParameterSet(sql, parms);
            }

            SqlHelper.ExecuteNonQuery(connString, CommandType.Text, sql, parms);
        }
        public void UpdateUserLoginInfo(User user)
        {
            string sql = "Update Tb_User set LastLoginIP=@LastLoginIP,LastLoginTime=getdate(),Server=@Server where UserID=@UserID";
            SqlParameter[] parms = SqlHelperParameterCache.GetCachedParameterSet(sql);
            if (parms == null)
            {
                parms = new SqlParameter[] {
                    new SqlParameter("@LastLoginIP",SqlDbType.NVarChar,20),
                    new SqlParameter("@Server",SqlDbType.NVarChar,50),
                    new SqlParameter("@UserID",SqlDbType.BigInt)
                };
                SqlHelperParameterCache.CacheParameterSet(sql, parms);
            }

            parms[0].Value = user.LastLoginIP;
            parms[1].Value = user.Server;
            parms[2].Value = user.UserID;

            SqlHelper.ExecuteNonQuery(connString, CommandType.Text, sql, parms);
        }