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(dt.Rows[0]["LastName"].ToString(), dt.Rows[0]["FirstName"].ToString(), dt.Rows[0]["Gender"].ToString(), dt.Rows[0]["BorrowerType"].ToString(),Convert.ToInt16(dt.Rows[0]["ID"]), CheckBorrowedBook.NONE.ToString())); //BORROWERSLIST.Add(new Borrower(dt.Rows[1]["LastName"].ToString(), dt.Rows[1]["FirstName"].ToString(), dt.Rows[1]["Gender"].ToString(), dt.Rows[1]["BorrowerType"].ToString(), Convert.ToInt16(dt.Rows[1]["ID"]), CheckBorrowedBook.NONE.ToString())); //BORROWERSLIST.Add(new Borrower(dt.Rows[2]["LastName"].ToString(), dt.Rows[2]["FirstName"].ToString(), dt.Rows[2]["Gender"].ToString(), dt.Rows[2]["BorrowerType"].ToString(), Convert.ToInt16(dt.Rows[2]["ID"]), CheckBorrowedBook.NONE.ToString())); //BORROWERSLIST.Add(new Borrower(dt.Rows[3]["LastName"].ToString(), dt.Rows[3]["FirstName"].ToString(), dt.Rows[3]["Gender"].ToString(), dt.Rows[3]["BorrowerType"].ToString(), Convert.ToInt16(dt.Rows[3]["ID"]), CheckBorrowedBook.NONE.ToString())); //BORROWERSLIST.Add(new Borrower(dt.Rows[4]["LastName"].ToString(), dt.Rows[4]["FirstName"].ToString(), dt.Rows[4]["Gender"].ToString(), dt.Rows[4]["BorrowerType"].ToString(), Convert.ToInt16(dt.Rows[4]["ID"]), 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())); ShowTable(); //BOOKSLIST.Add(new Book(dt1.Rows[0]["Title"].ToString(), dt1.Rows[0]["Category"].ToString(),dt2.Rows[0]["LastName"].ToString(), dt2.Rows[0]["FirstName"].ToString(), Convert.ToInt16(dt1.Rows[0]["ID"]), dt1.Rows[0]["Availability"].ToString())); //BOOKSLIST.Add(new Book(dt1.Rows[1]["Title"].ToString(), dt1.Rows[1]["Category"].ToString(),dt2.Rows[1]["LastName"].ToString(), dt2.Rows[1]["FirstName"].ToString(), Convert.ToInt16(dt1.Rows[1]["ID"]), dt1.Rows[1]["Availability"].ToString())); //BOOKSLIST.Add(new Book(dt1.Rows[2]["Title"].ToString(), dt1.Rows[2]["Category"].ToString(),dt2.Rows[2]["LastName"].ToString(), dt2.Rows[2]["FirstName"].ToString(), Convert.ToInt16(dt1.Rows[2]["ID"]), dt1.Rows[2]["Availability"].ToString())); //BOOKSLIST.Add(new Book(dt1.Rows[3]["Title"].ToString(), dt1.Rows[3]["Category"].ToString(),dt2.Rows[3]["LastName"].ToString(), dt2.Rows[3]["FirstName"].ToString(), Convert.ToInt16(dt1.Rows[3]["ID"]), dt1.Rows[3]["Availability"].ToString())); //BOOKSLIST.Add(new Book(dt1.Rows[4]["Title"].ToString(), dt1.Rows[4]["Category"].ToString(),dt2.Rows[4]["LastName"].ToString(), dt2.Rows[4]["FirstName"].ToString(), Convert.ToInt16(dt1.Rows[4]["ID"]), dt1.Rows[4]["Availability"].ToString())); }
public void AddCategory() { var addcategorywindow = new AddCategoryWindow(); addcategorywindow.DataContext = this; var result = addcategorywindow.ShowDialog(); if (result == true) { BOOKCATEGORIES.Add(addcategory); } }
public MainViewModel() { SqlDataAdapter node_borrower = new SqlDataAdapter("SELECT LastName,FirstName,Gender,BorrowerType,BorrowerID,BorrowStatus FROM [BORROWER]", con); SqlDataAdapter node_book = new SqlDataAdapter("SELECT BookID,Title, Category, Availability,AuthorID FROM[BOOK]", con); SqlDataAdapter node_author = new SqlDataAdapter("SELECT AuthorID,LastName,FirstName FROM[Author]", con); node_borrower.Fill(dt_borrower); node_book.Fill(dt_book); node_author.Fill(dt_author); 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(dt.Rows[0]["LastName"].ToString(), dt.Rows[0]["FirstName"].ToString(), dt.Rows[0]["Gender"].ToString(), dt.Rows[0]["BorrowerType"].ToString(),Convert.ToInt16(dt.Rows[0]["ID"]), CheckBorrowedBook.NONE.ToString())); //BORROWERSLIST.Add(new Borrower(dt.Rows[1]["LastName"].ToString(), dt.Rows[1]["FirstName"].ToString(), dt.Rows[1]["Gender"].ToString(), dt.Rows[1]["BorrowerType"].ToString(), Convert.ToInt16(dt.Rows[1]["ID"]), CheckBorrowedBook.NONE.ToString())); //BORROWERSLIST.Add(new Borrower(dt.Rows[2]["LastName"].ToString(), dt.Rows[2]["FirstName"].ToString(), dt.Rows[2]["Gender"].ToString(), dt.Rows[2]["BorrowerType"].ToString(), Convert.ToInt16(dt.Rows[2]["ID"]), CheckBorrowedBook.NONE.ToString())); //BORROWERSLIST.Add(new Borrower(dt.Rows[3]["LastName"].ToString(), dt.Rows[3]["FirstName"].ToString(), dt.Rows[3]["Gender"].ToString(), dt.Rows[3]["BorrowerType"].ToString(), Convert.ToInt16(dt.Rows[3]["ID"]), CheckBorrowedBook.NONE.ToString())); //BORROWERSLIST.Add(new Borrower(dt.Rows[4]["LastName"].ToString(), dt.Rows[4]["FirstName"].ToString(), dt.Rows[4]["Gender"].ToString(), dt.Rows[4]["BorrowerType"].ToString(), Convert.ToInt16(dt.Rows[4]["ID"]), 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())); ShowTable(); //BOOKSLIST.Add(new Book(dt1.Rows[0]["Title"].ToString(), dt1.Rows[0]["Category"].ToString(),dt2.Rows[0]["LastName"].ToString(), dt2.Rows[0]["FirstName"].ToString(), Convert.ToInt16(dt1.Rows[0]["ID"]), dt1.Rows[0]["Availability"].ToString())); //BOOKSLIST.Add(new Book(dt1.Rows[1]["Title"].ToString(), dt1.Rows[1]["Category"].ToString(),dt2.Rows[1]["LastName"].ToString(), dt2.Rows[1]["FirstName"].ToString(), Convert.ToInt16(dt1.Rows[1]["ID"]), dt1.Rows[1]["Availability"].ToString())); //BOOKSLIST.Add(new Book(dt1.Rows[2]["Title"].ToString(), dt1.Rows[2]["Category"].ToString(),dt2.Rows[2]["LastName"].ToString(), dt2.Rows[2]["FirstName"].ToString(), Convert.ToInt16(dt1.Rows[2]["ID"]), dt1.Rows[2]["Availability"].ToString())); //BOOKSLIST.Add(new Book(dt1.Rows[3]["Title"].ToString(), dt1.Rows[3]["Category"].ToString(),dt2.Rows[3]["LastName"].ToString(), dt2.Rows[3]["FirstName"].ToString(), Convert.ToInt16(dt1.Rows[3]["ID"]), dt1.Rows[3]["Availability"].ToString())); //BOOKSLIST.Add(new Book(dt1.Rows[4]["Title"].ToString(), dt1.Rows[4]["Category"].ToString(),dt2.Rows[4]["LastName"].ToString(), dt2.Rows[4]["FirstName"].ToString(), Convert.ToInt16(dt1.Rows[4]["ID"]), dt1.Rows[4]["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())); }