//List borrowed by borrow Id public BorrowModel ListBorrowedByBID(int borrowId) { //empty list of media models to start us off List <BorrowModel> borrowedMedias = new List <BorrowModel>(); MediaDS.TabBorrowDataTable borrowedTable = mediaDAO.ListBorrowed(); foreach (MediaDS.TabBorrowRow row in borrowedTable.Rows) { if (row.BID == borrowId) { BorrowModel media = BorrowModel.Parse(row); borrowedMedias.Add(media);//add it to our list of media } } BorrowModel borrowed = null; if (borrowedMedias.Count == 0) { borrowedMedias = null; } else { borrowed = borrowedMedias[0]; } return(borrowed); }
//List Borrowed by actual return date public BorrowModel GetBorrowed(int mediaId) { List <BorrowModel> borrowedMedias = new List <BorrowModel>(); MediaDS.TabBorrowDataTable borrowedTable = mediaDAO.ListBorrowed(); foreach (MediaDS.TabBorrowRow row in borrowedTable.Rows) { if (row.MediaID == mediaId && row.ActualReturnDate < row.BorrowDate) { BorrowModel borrowedMedia = BorrowModel.Parse(row); borrowedMedias.Add(borrowedMedia); } } BorrowModel borrowed = null; if (borrowedMedias.Count == 0) { borrowedMedias = null; } else { borrowed = borrowedMedias[0]; } return(borrowed); }
public List <BorrowModel> ListBorrow() { List <BorrowModel> medias = new List <BorrowModel>(); MediaDS.TabBorrowDataTable borrowTable = mediaDAO.ListBorrow(); foreach (MediaDS.TabBorrowRow row in borrowTable.Rows) { BorrowModel media = BorrowModel.Parse(row); medias.Add(media); } return(medias); }
//Borrowed medias <<<<< //Lista all borrowed medias public List <BorrowModel> ListAllMediasBorrowed() { //empty list of media models to start us off List <BorrowModel> borrowedMedias = new List <BorrowModel>(); MediaDS.TabBorrowDataTable borrowedTable = mediaDAO.ListBorrowed(); foreach (MediaDS.TabBorrowRow row in borrowedTable.Rows) { //create a model representing that row BorrowModel media = BorrowModel.Parse(row); borrowedMedias.Add(media);//add it to our list of media } return(borrowedMedias); }
public static BorrowModel Parse(MediaDS.TabBorrowRow mediaRow) { if (mediaRow == null) { return(null); } BorrowModel media = new BorrowModel(); media.MediaId = mediaRow.MediaID; media.UID = mediaRow.UID; media.borrowDate = mediaRow.BorrowDate.ToString("MM/dd/yyyy"); media.returnDate = mediaRow.ReturnDate.ToString("MM/dd/yyyy"); return(media); }
public static BorrowModel Parse(MediaDS.TabBorrowRow borrowRow) { if (borrowRow == null) { return(null); } BorrowModel borrow = new BorrowModel(); borrow.borrowId = borrowRow.BID; borrow.userId = borrowRow.UID; borrow.mediaId = borrowRow.MediaID; borrow.borrowDate = borrowRow.BorrowDate; borrow.returnDate = borrowRow.ReturnDate; borrow.actualReturnDate = borrowRow.ActualReturnDate; borrow.lateFee = borrowRow.LateFee; return(borrow); }
//List borrowed by media Id public List <BorrowModel> GetBorrowedByMediaId(int mediaId) { List <BorrowModel> borrowedMedias = new List <BorrowModel>(); MediaDS.TabBorrowDataTable borrowedTable = mediaDAO.ListBorrowed(); foreach (MediaDS.TabBorrowRow row in borrowedTable.Rows) { if (row.MediaID == mediaId) { BorrowModel borrowedMedia = BorrowModel.Parse(row); borrowedMedias.Add(borrowedMedia); } } if (borrowedMedias.Count == 0) { borrowedMedias = null; } return(borrowedMedias); }