public void ShowTable() { con.Open(); for (int i = 0; i < dt_borrower.Rows.Count; i++) { BORROWERSLIST.Add(new BORROWER(dt_borrower.Rows[i]["LastName"].ToString(), dt_borrower.Rows[i]["FirstName"].ToString(), dt_borrower.Rows[i]["Gender"].ToString(), dt_borrower.Rows[i]["BorrowerType"].ToString(), Convert.ToInt16(dt_borrower.Rows[i]["BorrowerID"]), dt_borrower.Rows[i]["BorrowStatus"].ToString())); } for (int i = 0; i < dt_book.Rows.Count; i++) { BOOKSLIST.Add(new BOOK(dt_book.Rows[i]["Title"].ToString(), dt_book.Rows[i]["Category"].ToString(), int.Parse(dt_book.Rows[i]["AuthorID"].ToString()), Convert.ToInt16(dt_book.Rows[i]["BookID"]), dt_book.Rows[i]["Availability"].ToString())); } con.Close(); }
public void ShowTable() { SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\JulyEd\Downloads\4th year 2nd semester\OOP\LIBRARYMANAGEMENTPART2\LIBRARYMANAGEMENTPART2\LibraryManagementSysytem.mdf;Integrated Security=True;Connect Timeout=30;"); DataTable dt = new DataTable(); DataTable dt1 = new DataTable(); DataTable dt2 = new DataTable(); SqlDataAdapter node1 = new SqlDataAdapter("SELECT LastName,FirstName,Gender,BorrowerType,ID FROM [BORROWER]", con); SqlDataAdapter node2 = new SqlDataAdapter("SELECT ID,Title, Category, Availability FROM[BOOK]", con); SqlDataAdapter node3 = new SqlDataAdapter("SELECT LastName,FirstName FROM[Author]", con); node1.Fill(dt); node2.Fill(dt1); node3.Fill(dt2); for (int i = 0; i < 5; i++) { BORROWERSLIST.Add(new BORROWER(dt.Rows[i]["LastName"].ToString(), dt.Rows[i]["FirstName"].ToString(), dt.Rows[i]["Gender"].ToString(), dt.Rows[i]["BorrowerType"].ToString(), Convert.ToInt16(dt.Rows[i]["ID"]), CheckBorrowedBook.NONE.ToString())); BOOKSLIST.Add(new BOOK(dt1.Rows[i]["Title"].ToString(), dt1.Rows[i]["Category"].ToString(), dt2.Rows[i]["LastName"].ToString(), dt2.Rows[i]["FirstName"].ToString(), Convert.ToInt16(dt1.Rows[i]["ID"]), dt1.Rows[i]["Availability"].ToString())); } }
public MainViewModel() { viewborrowers = CollectionViewSource.GetDefaultView(BORROWERSLIST); viewbooks = CollectionViewSource.GetDefaultView(BOOKSLIST); viewviolators = CollectionViewSource.GetDefaultView(VIOLATORSLIST); BOOKCATEGORIES.Add("Math"); BOOKCATEGORIES.Add("Science"); BOOKCATEGORIES.Add("Religion"); BOOKCATEGORIES.Add("Arts"); BOOKCATEGORIES.Add("History"); BOOKCATEGORIES.Add("English"); BOOKCATEGORIES.Add("Business"); BORROWERSLIST.Add(new Borrower("Catubog", "July", "Male", "Student", 10293, CheckBorrowedBook.NONE.ToString())); BORROWERSLIST.Add(new Borrower("Libadisos", "Keiji", "Male", "Student", 62748, CheckBorrowedBook.NONE.ToString())); BORROWERSLIST.Add(new Borrower("Yamamoto", "Ryu", "Male", "Teacher", 81639, CheckBorrowedBook.NONE.ToString())); BORROWERSLIST.Add(new Borrower("Salazar", "Aprilyn", "Female", "Teacher", 72538, CheckBorrowedBook.NONE.ToString())); BORROWERSLIST.Add(new Borrower("Jaleco", "Rene", "Male", "Student", 13256, CheckBorrowedBook.NONE.ToString())); BORROWERSLIST.Add(new Borrower("Ottoman", "GG", "Male", "Teacher", 12345, CheckBorrowedBook.NONE.ToString())); BORROWERSLIST.Add(new Borrower("Ferraren", "Jiji", "Female", "Teacher", 37702, CheckBorrowedBook.NONE.ToString())); BORROWERSLIST.Add(new Borrower("Nursing", "Puti", "Female", "Student", 72635, CheckBorrowedBook.NONE.ToString())); BORROWERSLIST.Add(new Borrower("Saluage", "Angelito", "Male", "Teacher", 25363, CheckBorrowedBook.NONE.ToString())); }