public static List <Book> getBookByTitle(string Title) { List <BookDTO> dtoList = null;; if (string.IsNullOrEmpty(Title)) { dtoList = LibraryDataAccess.getAllBooksDAL(); } else { // This method retrieves a list of all books in the library system LibraryDataAccess.title = Title; //Fetch the correct AuthorDTO object and connect an Author object for it Book Bookobject = new Book(); dtoList = LibraryDataAccess.getBookTitle(Bookobject.TitleList); } List <Book> results = new List <Book>(); foreach (BookDTO dto in dtoList) { Book item = new Book(dto); results.Add(item); } return(results); }
public static List <Author> getAuthorByName(string Name) { List <AuthorDTO> dtoList = null;; if (string.IsNullOrEmpty(Name)) { dtoList = LibraryDataAccess.getAllAuthorsDAL(); } else { // This method retrieves a list of all books in the library system LibraryDataAccess.name = Name; //Fetch the correct AuthorDTO object and connect an Author object for it Author AuthorObject = new Author(); dtoList = LibraryDataAccess.getAuthorName(AuthorObject.NameList); } List <Author> results = new List <Author>(); foreach (AuthorDTO dto in dtoList) { Author item = new Author(dto); results.Add(item); } return(results); }
public static List <Book> getAllAid(string aId) { List <BookDTO> dtoList = null;; // This method retrieves a list of all books in the library system if (string.IsNullOrEmpty(aId)) { dtoList = LibraryDataAccess.getAllBooksDAL(); //BookDTO is the interface common for BL and DAL } else { //Fetch the correct AuthorDTO object and connect an Author object for it AuthorDTO dto = LibraryDataAccess.loadAuthorDAL(Convert.ToInt32(aId)); dto.loadStatus = LoadStatus.Ghost; //Force it to load all data Author AuthorObject = new Author(dto); // Use the author objects IsbnList property dtoList = LibraryDataAccess.getAllAuthorBookDAL(AuthorObject.IsbnList); } // Convert to Book objects since UI only references BL (not DAL or DTO) List <Book> results = new List <Book>(); foreach (BookDTO dto in dtoList) { Book item = new Book(dto); results.Add(item); } return(results); }
// TODO få ut en output public static List <Borrower> getBorrowerId(string PersonId) { List <BorrowerDTO> dtoList = null;; // This method retrieves a list of all books in the library system if (string.IsNullOrEmpty(PersonId)) { dtoList = LibraryDataAccess.getAllBorrowerDAL(); //BookDTO is the interface common for BL and DAL } else { LibraryDataAccess.Person = PersonId; Borrower BorrowerObject = new Borrower(); dtoList = LibraryDataAccess.getBorrowerPersonId(BorrowerObject.personList); } // Convert to Book objects since UI only references BL (not DAL or DTO) List <Borrower> results = new List <Borrower>(); foreach (BorrowerDTO dto in dtoList) { Borrower item = new Borrower(dto); results.Add(item); } return(results); }
// TODO få ut en output public static string getUserId(string username) { // This method retrieves a list of all books in the library system if (string.IsNullOrEmpty(username)) { // do somre error handling } else { username = LibraryDataAccess.getUserId(username); } return(username); }
public static List <Borrower> getAll() { // This method retrieves a list of all authors in the library system List <BorrowerDTO> dtoList = LibraryDataAccess.getAllBorrowerDAL(); // Convert to Author objects List <Borrower> results = new List <Borrower>(); foreach (BorrowerDTO dto in dtoList) { Borrower item = new Borrower(dto); results.Add(item); } return(results); }
public static List <Author> getAll() { // This method retrieves a list of all authors in the library system List <AuthorDTO> dtoList = LibraryDataAccess.getAllAuthorsDAL(); //AuthorDTO is the interface common for BL and DAL // Convert to Author objects List <Author> results = new List <Author>(); foreach (AuthorDTO dto in dtoList) { Author item = new Author(dto); results.Add(item); } return(results); }
private void Load() { // Initiates a read from the database of the DTO-object for a specific author, if loadstatus is set to "Ghost" try { if (_BorrowerDTO.loadStatus == LoadStatus.Ghost) { _BorrowerDTO = LibraryDataAccess.LoadallBorrower(_BorrowerDTO.PersonId); } } catch (Exception ex) { //Do some error-log functionality with ex.Data } }
public static List <Book> getBookByISBN(string ISBN) { List <BookDTO> dtolist = null; Book BookObject = new Book(); dtolist = LibraryDataAccess.getBookByISBN(ISBN); List <Book> results = new List <Book>(); foreach (BookDTO dto in dtolist) { Book item = new Book(dto); results.Add(item); } return(results); }
//If the load of data to the database is partial (Ghost) do a full load private void Load() { try { if (_bookDTO.loadStatus == LoadStatus.Ghost) { _bookDTO = LibraryDataAccess.loadBookDAL(_bookDTO.isbnNo); _bookDTO.loadStatus = LoadStatus.Loaded; } } catch (Exception ex) { //Do some error-log functionality with ex.Data } }
public static List <Author> getAuthorByAid(string Aid) { List <AuthorDTO> dtolist = null; LibraryDataAccess.Aid = Aid; Author AuthorObject = new Author(); dtolist = LibraryDataAccess.getAuthorByAid(AuthorObject.IsbnList); List <Author> results = new List <Author>(); foreach (AuthorDTO dto in dtolist) { Author item = new Author(dto); results.Add(item); } return(results); }
/// <summary> /// Constructor that takes a Member argument. /// </summary> /// <param name="m">Member</param> public frmMemberInfo(Member m) { InitializeComponent(); LibraryDataAccess myAccess = new LibraryDataAccess(); Member myMember = myAccess.GetMember(m.MemberID); LoadGenericFields(myMember); if (myMember is JuvenileMember) { LoadJuvenileFields(myMember); } else { FormatAdultWindow(); } this.Text = myMember.FirstName + " " + myMember.MiddleInitial + " " + myMember.LastName + "(" + myMember.MemberID + ")"; GridRefresh(m.MemberID); tsslLabel.Text = "Member created."; }
public static List <Book> getBorrowerBooks(string personId) { List <BookDTO> dtolist = null; if (string.IsNullOrEmpty(personId)) { // something } else { LibraryDataAccess.Person = personId; dtolist = LibraryDataAccess.getBorrowerBook(personId); } List <Book> results = new List <Book>(); foreach (BookDTO dto in dtolist) { Book item = new Book(dto); results.Add(item); } return(results); }
public static List <Borrow> getBorrowStatus(string personId) { List <BorrowDTO> dtolist = null; if (string.IsNullOrEmpty(personId)) { //print that the borrower got 0 books } else { LibraryDataAccess.Person = personId; Borrow BorrowObject = new Borrow(); dtolist = LibraryDataAccess.getBorrowbyPersonId(BorrowObject.PersonList); } List <Borrow> results = new List <Borrow>(); foreach (BorrowDTO dto in dtolist) { Borrow item = new Borrow(dto); results.Add(item); } return(results); }
public static string PasswordMatch(string Username, string Password) { String UsrName = LibraryDataAccess.PasswordMatch(Username, Password); return(UsrName); }
public static string UsernameExists(string Username) { String UsrName = LibraryDataAccess.UserExists(Username); return(UsrName); }
public static string PersonIdExist(string PersonId) { String Person = LibraryDataAccess.PersonIdExists(PersonId); return(Person); }
public static void CreateUser(string PersonId, string Username, string password, string email, int isAdmin) { LibraryDataAccess.createUser(PersonId, Username, password, email, isAdmin); }
public static void CreateBorrower(string PersonId, string Firstname, string Lastname, string address, string Telno, int catergoryId) { LibraryDataAccess.createBorrower(PersonId, Firstname, Lastname, address, Telno, catergoryId); }
public static void RenewLoan(string BPersonId) { LibraryDataAccess.RenewLoan(BPersonId); }
public static void UpdateAuthor(string FirstName, string Lastname, int BirthYear, int Aid) { LibraryDataAccess.UpdateAuthor(FirstName, Lastname, BirthYear, Aid); }
public static void CreateAuthor(string FirstName, string Lastname, int BirthYear) { LibraryDataAccess.createAuthor(FirstName, Lastname, BirthYear); }
private void InitializeData() { _libraryDataAccess = new LibraryDataAccess(); libraryDS = _libraryDataAccess.ReadLibraryData(); gridBooks.DataSource = libraryDS.Book; }