/// <summary> /// 验证用户登入方法 /// </summary> /// <param name="user">用户输入信息</param> /// <returns>用户是否登入成功信息 1 = 成功 0 = 失败</returns> public static int UserLogin(Model.Login user) { string sql = "select count(*) from Login where UserName = @name and [PassWord] =@pwd"; SqlParameter[] parameter = { new SqlParameter("@name", user.UserName), new SqlParameter("@pwd", user.PassWord), }; return(SQLHelper.ExecuteScalar(sql, CommandType.Text, parameter)); }
public string CheckRoot(Model.Login login) { string sql = "select _root from t_login where _email=@email"; MySqlParameter[] par = { new MySqlParameter("@email", MySqlDbType.VarChar, 20), }; par[0].Value = login.Email; return(MysqlHelp.Run_Select(sql.ToString(), par)); }
public string GetUserName(Model.Login login) { string sql = "select _name from t_login where _id=@id"; MySqlParameter[] par = { new MySqlParameter("@id", MySqlDbType.Int32, 2), }; par[0].Value = login.Id; return(MysqlHelp.Run_Select(sql.ToString(), par)); }
/// <summary> /// 用户注册方法 /// </summary> /// <param name="user">用户输入信息</param> /// <returns>是否注册成功 1 = 成功 0 = 失败</returns> public static int UserResgist(Model.Login user) { string sql = "insert into Login values(@Name,@Pwd,@sex,@date)"; SqlParameter[] parameter = { new SqlParameter("@Name", user.UserName), new SqlParameter("@Pwd", user.PassWord), new SqlParameter("@date", user.Birthday), new SqlParameter("@sex", user.Sex), }; return(SQLHelper.ExecuteNonQurery(sql, CommandType.Text, parameter)); }
public int UpdateUserRoot(Model.Login login) { string sql = "update t_login set _root=@root where _email=@email"; MySqlParameter[] par = { new MySqlParameter("@root", MySqlDbType.Int32, 2), new MySqlParameter("@email", MySqlDbType.VarChar, 20), }; par[0].Value = login.Root; par[1].Value = login.Email; return(MysqlHelp.Run_Sql(sql.ToString(), par)); }
/// <summary> /// 用户登录 /// </summary> /// <param name="login"></param> /// <returns></returns> public string UserLogin(Model.Login login) { string sql = "select _id from t_login where _email=@email and _pwd=@pwd and _root=@root"; MySqlParameter[] par = { new MySqlParameter("@email", MySqlDbType.VarChar, 20), new MySqlParameter("@pwd", MySqlDbType.VarChar, 20), new MySqlParameter("@root", MySqlDbType.Int32, 2), }; par[0].Value = login.Email; par[1].Value = Common.DESEncrypt.Encrypt(login.Pwd); par[2].Value = login.Root; return(MysqlHelp.Run_Select(sql.ToString(), par)); }