/// <summary> /// 判断用户是否存在 /// </summary> /// <param name="username">用户名</param> /// <returns></returns> public bool JudgePassword(Entity.Users user) { bool flag = false; string sql = "select UserName,Password from Login where UserName='******' AND Password='******'"; DataTable dt = sqlhelper.ExecuteQuery(sql); if (dt.Rows.Count > 0) { flag = true; } return(flag); }
/// <summary> /// 增加管理员的方法 /// </summary> /// <param name="users"></param> /// <returns></returns> public static bool ADAdd(Entity.Users users) { string sql = string.Format("insert into Users values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", users.uName, users.uMail, users.uPwd, users.sex, users.age, 1, users.state, System.DateTime.Now); int i = (int)DBHelper.GetLine(sql); if (i > 0) { return(true); } else { return(false); } }
/// <summary> /// 测试账号是否存在 /// </summary> /// <param name="users"></param> /// <returns></returns> public static bool IsHave(Entity.Users users) { string sql = string.Format("select count(*) from Users where UName='{0}'", users.uName); int i = (int)DBHelper.GetScalar(sql); if (i > 0) { return(true); } else { return(false); } }
/// <summary> /// 删除管理员的方法 /// </summary> /// <param name="users"></param> /// <returns></returns> public static bool ADelete(Entity.Users users) { string sql = string.Format("delete from Users where UserID='{0}'", users.uID); int i = (int)DBHelper.GetLine(sql); if (i > 0) { return(true); } else { return(false); } }
/// <summary> /// 修改管理员表的方法 /// </summary> /// <param name="users"></param> /// <returns></returns> public static bool APlus(Entity.Users users) { string sql = string.Format("update Users set UName='{0}',UPwd='{1}',Usex='{2}',Uage='{3}',Ustate='{4}',UMail='{6}' where UserID='{5}'", users.uName, users.uPwd, users.sex, users.age, users.state, users.uID, users.uMail); int i = (int)DBHelper.GetLine(sql); if (i > 0) { return(true); } else { return(false); } }
/// <summary> /// 修改密码 /// </summary> /// <param name="users"></param> /// <returns></returns> public static int PassChange(Entity.Users users) { string sql = "update Users set UPwd='" + users.uPwd + "' where UserID=" + users.uID + ""; return(DBHelper.GetLine(sql)); }
/// <summary> /// 验证账户名称 /// </summary> /// <param name="u"></param> /// <returns></returns> public static int CheckName(Entity.Users u) { string sql = " select count(*) from Users where UName='" + u.uName + "'"; return((int)DBHelper.GetScalar(sql)); }
/// <summary> /// 更新用户头像 /// </summary> /// <returns></returns> public static int UpLogo(Entity.Users u) { string sql = "update Users set ULogo='" + u.logo + "' where UserID=" + u.uID + ""; return(DBHelper.GetLine(sql)); }