public bool Add(User item) { var pwd = SysConstant.GetMD5(item.PassWord);//密码加密 string sqlstr = "INSERT INTO [tbl_User] ([Id] ,[UserName] ,[PassWord],[States]) VALUES (null ,'" + item.UserName + "','" + pwd + "','" + item.States + "')"; int res = DbHelperSQLite.ExecuteSql(sqlstr); return(res > 0); }
public bool EditPassWord(User item) { var pwd = SysConstant.GetMD5(item.PassWord);//密码加密 string sqlstr = "UPDATE [tbl_User] SET [PassWord] = '" + pwd + "' WHERE id=" + item.ID; int res = DbHelperSQLite.ExecuteSql(sqlstr); return(res > 0); }
public User Login(string UserName, string PassWord) { var pwd = SysConstant.GetMD5(PassWord);//密码加密 string sqlstr = "SELECT [Id],[UserName],[PassWord],[States] FROM [tbl_User] where [UserName]=" + UserName + " and [PassWord]=" + pwd; DataSet ds = DbHelperSQLite.Query(sqlstr); if (ds.Tables[0].Rows.Count > 0) { var res = ModelHelper.DataRowToModel <User>(ds.Tables[0].Rows[0]); return(res); } else { return(null); } }