public bool UpdataUser(User user) { string query = string.Format("UPDATE Users SET Name='{0}', Surname='{1}', Email='{2}', Password='******', Role='{4}' WHERE JMBGUser='******'", user.Name, user.Surname, user.Email, user.Password, user.Role, user.JmbgUser); return(BaseConnection.ExecuteNonQuerySqlCommand(query)); }
public bool AddUser(User user) { string query = string.Format("INSERT INTO Users values('{0}','{1}','{2}','{3}','{4}','{5}')", user.JmbgUser, user.Name, user.Surname, user.Email, user.Password, user.Role); return(BaseConnection.ExecuteNonQuerySqlCommand(query)); }
public bool AddBook(Book book) { string query = string.Format("INSERT INTO Books VALUES('{0}','{1}','{2}','{3}','{4}')", book.Title, book.ISBN, book.NameAuthor, book.YearOfIssue, book.Quantity); return(BaseConnection.ExecuteNonQuerySqlCommand(query)); }
public bool UpdataBook(Book book) { string query = string.Format("UPDATE Books SET Title='{0}', ISBN='{1}', NameAuthor='{2}'," + "YearOfIssue={3}, Quantity={4} where IdBook = {5}", book.Title, book.ISBN, book.NameAuthor, book.YearOfIssue, book.Quantity, book.IdBook); return(BaseConnection.ExecuteNonQuerySqlCommand(query)); }
public bool IncrementQuantity(Book book) { int quantity = Quantity(book) + 1; string query = string.Format("UPDATE Books SET Quantity = '{0}'" + " where Title = '{1}' AND NameAuthor='{2}'", quantity, book.Title, book.NameAuthor); return(BaseConnection.ExecuteNonQuerySqlCommand(query)); }
public bool RentedBook(string JmbgUser, Rented rented) { if (Quantity(rented) > 0) { string query = string.Format("INSERT INTO Rented VALUES('{0}',{1},'{2:u}','{3:u}')", JmbgUser, rented.IdBook, rented.DateOfIssue, rented.ReturnDate); return(BaseConnection.ExecuteNonQuerySqlCommand(query)); } return(false); }
public bool DecrementQuantity(Book book) { int quantity = Quantity(book); if (quantity > 0) { int temp = quantity - 1; string query = string.Format("UPDATE Books set Quantity = '{0}'" + " where Title = '{1}' AND NameAuthor='{2}'", temp, book.Title, book.NameAuthor); return(BaseConnection.ExecuteNonQuerySqlCommand(query)); } return(false); }
public bool DeleteUser(string jmbg) { string query = "DELETE FROM Users WHERE JMBGUser='******'"; return(BaseConnection.ExecuteNonQuerySqlCommand(query)); }
public bool ReturnBook(string JmbgUser, Book book) { string query = "DELETE from Rented where IdBook='" + book.IdBook + "'and JMBGUser='******'"; return(BaseConnection.ExecuteNonQuerySqlCommand(query)); }
public bool DeleteBook(int IdBook) { string query = string.Format("DELETE FROM Books WHERE IdBook='" + IdBook + "'"); return(BaseConnection.ExecuteNonQuerySqlCommand(query)); }