Esempio n. 1
0
        public static void CreateUser(ShortUserInfo newUserInfo)
        {
            DbParameter[] prams = 
		    {
			    DbHelper.MakeInParam("?username", (DbType)MySqlDbType.String, 15,newUserInfo.Username),
			    DbHelper.MakeInParam("?password", (DbType)MySqlDbType.String, 32,newUserInfo.Password),
			    DbHelper.MakeInParam("?email", (DbType)MySqlDbType.String, 32,newUserInfo.Email),
			    DbHelper.MakeInParam("?regip", (DbType)MySqlDbType.String, 30,newUserInfo.RegIp),
			    DbHelper.MakeInParam("?regdate", (DbType)MySqlDbType.DateTime, 8,newUserInfo.RegDate),
			    DbHelper.MakeInParam("?lastloginip", (DbType)MySqlDbType.String, 30,newUserInfo.LastLoginIp),
			    DbHelper.MakeInParam("?lastlogindate", (DbType)MySqlDbType.DateTime, 8,newUserInfo.LastLoginDate),
			    DbHelper.MakeInParam("?salt", (DbType)MySqlDbType.String,6,newUserInfo.Salt),
			    DbHelper.MakeInParam("?secques", (DbType)MySqlDbType.String, 8,newUserInfo.SecQues),
			    DbHelper.MakeInParam("?qqopenid", (DbType)MySqlDbType.String, 45,newUserInfo.QqOpenId)
		    };

            DbHelper.ExecuteNonQuery(CommandType.Text, "INSERT INTO members (`username`, `password`, `email`, `regip`, `regdate`, `lastloginip`, `lastlogindate`, `salt`, `secques`,`qqopenid`) VALUES(?username,?password,?email,?regip,?regdate,?lastloginip,?lastlogindate,?salt,?secques,?qqopenid)", prams);
        }
Esempio n. 2
0
 public static void SetLoginStatus(ShortUserInfo shortUserInfo)
 {
     HttpContext.Current.Session["login"] = shortUserInfo.Uid;
 }
Esempio n. 3
0
        static List<ShortUserInfo> BindUserInfoList(IDataReader dr)
        {
            List<ShortUserInfo> userList = new List<ShortUserInfo>();
            while (dr.Read())
            {
                ShortUserInfo shortUserInfo = new ShortUserInfo();
                shortUserInfo.Uid = Convert.ToInt32(dr["uid"]);
                shortUserInfo.Username = dr["username"].ToString();
                shortUserInfo.Password = dr["password"].ToString();
                shortUserInfo.Email = dr["email"].ToString();
                shortUserInfo.RegIp = dr["regip"].ToString();
                shortUserInfo.RegDate = Convert.ToDateTime(dr["regdate"]);
                shortUserInfo.LastLoginIp = dr["lastloginip"].ToString();
                shortUserInfo.LastLoginDate = Convert.ToDateTime(dr["lastlogindate"]);
                shortUserInfo.Salt = dr["salt"].ToString();
                shortUserInfo.SecQues = dr["secques"].ToString();

                userList.Add(shortUserInfo);
            }
            return userList;
        }
Esempio n. 4
0
 static ShortUserInfo BindUserInfo(IDataReader dr)
 {
     ShortUserInfo shortUserInfo = null;
     while (dr.Read())
     {
         shortUserInfo = new ShortUserInfo();
         shortUserInfo.Uid = Convert.ToInt32(dr["uid"]);
         shortUserInfo.Username = dr["username"].ToString();
         shortUserInfo.Password = dr["password"].ToString();
         shortUserInfo.Email = dr["email"].ToString();
         shortUserInfo.RegIp = dr["regip"].ToString();
         shortUserInfo.RegDate = Convert.ToDateTime(dr["regdate"]);
         shortUserInfo.LastLoginIp = dr["lastloginip"].ToString();
         shortUserInfo.LastLoginDate = Convert.ToDateTime(dr["lastlogindate"]);
         shortUserInfo.Salt = dr["salt"].ToString();
         shortUserInfo.SecQues = dr["secques"].ToString();
         shortUserInfo.QqOpenId = dr["qqopenid"] != DBNull.Value ? dr["qqopenid"].ToString() : "null";
     }
     return shortUserInfo;
 }