public Role LogIn(User user) { string query = string.Format("SELECT Role FROM Users WHERE JMBGUser='******' AND Password='******'", user.JmbgUser, user.Password); string role = (string)BaseConnection.ExecuteScalarSqlCommand(query); return(role == null ? Role.NONE : (Role)Enum.Parse(typeof(Role), role)); }
private int Quantity(Book book) { string q = string.Format("SELECT Quantity FROM Books WHERE Title='{0}' AND NameAuthor='{1}'", book.Title, book.NameAuthor); int quantity = (int)BaseConnection.ExecuteScalarSqlCommand(q); if (quantity == 0) { return(0); } return(quantity); }
public string GetNameUser(string jmbg) { string query = "SELECT Name FROM Users WHERE JMBGUser='******'"; return((string)BaseConnection.ExecuteScalarSqlCommand(query)); }