void InitData() { var ser = new BookService2(new BookRepository()); var lst = ser.GetBooks(); BookList.Clear(); foreach (var article in lst) { BookList.Add(article); } }
private void ClearLibrary_Click(object sender, RoutedEventArgs e) { BookList.Clear(); AudiobookList.Clear(); MovieList.Clear(); totalToRead = 0; totalToListen = 0; totalToWatch = 0; int selectedCategory = CategoryComboBox.SelectedIndex; SetNewsTextBlocks(selectedCategory); }
private void sortByName() { List <BOOK> sortedList = BookList.OrderBy(x => x.NAME.ToUpper().Contains(SortByName.ToUpper())).ToList(); sortedList.Reverse(); BookList.Clear(); foreach (var sortedItem in sortedList) { BookList.Add(sortedItem); } SelectedBook = BookList.First(); OnPropertyChanged("BookList"); }
private void sortByBookId() { List <BOOK> sortedList = BookList.OrderBy(x => x.ID.ToString() == Convert.ToString(SearchByBookId)).ToList(); sortedList.Reverse(); BookList.Clear(); foreach (var sortedItem in sortedList) { BookList.Add(sortedItem); } SelectedBook = BookList.First(); OnPropertyChanged("BookList"); }
public void InitData(object obj = null) { CancleHttpRequest(); PageCount = 1; PageIndex = 1; if (this.BookList != null) { BookList.Clear(); } SetData(1); }
private void _refresh() { BookList.Clear(); SqlHelper.Conn.Open(); using (var reader = SqlHelper.Select <Book>("ORDER BY ReadTime DESC")) { while (reader.Read()) { if (reader.HasRows) { BookList.Add(new Book(reader)); } } } SqlHelper.Conn.Close(); }
void UpdateBookList(bool setActive = true) { lock (_updateBookLock) { BookList.Clear(); foreach (var book in _localBookList.Books) { _books[book] = null; BookList.Add(book); } if (setActive && BookList.Count > 0) { ActiveBook = BookList[0]; } } }
/// <summary> /// 上一页 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnpreviewpage_Click(object sender, RoutedEventArgs e) { PageIndex = (Convert.ToInt32(PageIndex) - 1).ToString(); int pagecount = Convert.ToInt32(PageCount); Books book = new Books() { BookCategory = BookCategoryId, BookName = BookName, BarCode = Barcode, PageIndex = Convert.ToInt32(PageIndex), PageSize = Convert.ToInt32(PageSize) }; List <Books> bookslist = new List <Books>(); bookmaintainb.SearchBookinfoList <Books>(DAL.SQLID.BookMaintain.BookMaintain.selelct_book_bycontation, book, bookslist); BookList.Clear(); if (bookslist.Count != 0) { foreach (var item in bookslist) { BookList.Add(item); } } if (Convert.ToInt32(PageIndex) == 1) { //上一页,首页不可用,其他可以用 ButtonFistpage = "0"; ButtonNexpage = "1"; ButtonPreviewpage = "0"; ButtonLastpage = "1"; ButtonRedirttopage = "1"; //btnfistpage.IsEnabled = false; //btnnextpage.IsEnabled = true; //btnpreviewpage.IsEnabled = false; //btnlastpage.IsEnabled = true; //btnredirettopage.IsEnabled = true; } }
public void ET_Repository_CDUQ_D_Clear() { var repo = RF.Concrete <BookRepository>(); using (RF.TransactionScope(repo)) { var bookList = new BookList { new Book(), new Book(), new Book() }; repo.Save(bookList); Assert.IsTrue(repo.CountAll() == 3); bookList.Clear(); repo.Save(bookList); Assert.IsTrue(repo.CountAll() == 0); } }
/// <summary> /// /// </summary> public static void loadBook() { DataTable booksDT = new DataTable(); DBHelper.UpdateBookTable(); booksDT = DBHelper.GetDT(); Itembook book = new Itembook(); BookList.Clear(); foreach (DataRow row in booksDT.Rows) { book.Title = row["Book_Title"].ToString(); book.Autor = row["Book_Autor"].ToString(); book.Genre = row["Book_Genre"].ToString(); book.Image = (byte[])row["Book_Image"]; book.EPC = row["Book_RFID_EPC"].ToString(); book.timeStamp = row["Book_RFID_TimeStamp"].ToString(); book.RSSI = row["Book_RFID_RSSI"].ToString(); BookListing.addBookItem(book.EPC, book.timeStamp, book.RSSI, book.Title, book.Autor, book.Genre, book.Image); } }
protected void btnCheckOut_Click(object sender, EventArgs e) { float totalFloat = 0.0F; DataView bookView = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); // Get the result set from the SQL Data Source bookView.AllowNew = true; DataRowView bookRowView = bookView.AddNew(); SqlConnection conn = new SqlConnection(); conn.ConnectionString = "Data Source = (LocalDB)\\MSSQLLocalDB;" + "AttachDbFilename = |DataDirectory|\\Dedalus.mdf;" + "Integrated Security = True;"; // conn.Open(); SqlCommand command = conn.CreateCommand(); // bookList.bList[i].title bookRowView["Date"] = DateTime.Now; // bookRowView["Date"] = DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"); bookRowView["InvoiceTotal"] = total; bookRowView["PaymentTotal"] = total; bookRowView["PaymentDate"] = DateTime.Now; // bookRowView["PaymentDate"] = DateTime.Now.ToString("dd/mm/yyyy hh:mm:ss tt"); /* * var bookRow = bookTable.NewRow(); * bookRow["Date"] = DateTime.Now.ToString(); * bookRow["InvoiceTotal"] = total; * bookRow["PaymentTotal"] = total; * bookRow["PaymentDate"] = DateTime.Now.ToString(); * bookTable.Rows.Add(bookRow); */ if (currentUser == null || currentUser.userId == 0 || currentUser.userId == 0) { bookRowView["UserID"] = 1; //bookRow["UserID"] = 1; } else { bookRowView["UserID"] = currentUser.userId; //bookRow["UserID"] = currentUser.userId; } for (int i = 0; i < bookList.bList.Count; i++) { totalFloat = totalFloat + float.Parse(bookList.bList[i].price); } totalFloat = totalFloat * 1.13F; // command.CommandType = System.Data.CommandType.Text; command.CommandText = "INSERT INTO Invoices (UserID, Date, InvoiceTotal, PaymentTotal, PaymentDate) VALUES ('" + bookRowView["UserID"] + "', '" + bookRowView["Date"] + "', '" + totalFloat + "', '" + totalFloat + "', '" + bookRowView["PaymentDate"] + "');"; // command.CommandText = "INSERT INTO Invoices (UserID, Date, InvoiceTotal, PaymentTotal, PaymentDate) VALUES ('" + bookRowView["UserID"] + "', '" + "20/04/2018 10:10:10 AM" + "', '" + totalFloat + "', '" + totalFloat + "', '" + "20/04/2018 10:10:10 AM" + "');"; // command.CommandText = "INSERT INTO Invoices (UserID, Date, InvoiceTotal, PaymentTotal, PaymentDate) VALUES ('" + bookRowView["UserID"] + "', 'CONVERT(datetime, " + bookRowView["Date"] + ", 131)', '" + totalFloat + "', '" + totalFloat + "', 'CONVERT(datetime, " + bookRowView["PaymentDate"] + ", 131)');"; // command.CommandText = "INSERT INTO Invoices (UserID, Date, InvoiceTotal, PaymentTotal, PaymentDate) VALUES ('" + bookRowView["UserID"] + "', '" + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt") + "', '" + totalFloat + "', '" + totalFloat + "', '" + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt") + "');"; command.Connection = conn; command.Connection.Open(); command.ExecuteNonQuery(); // conn.Close(); bookRowView.EndEdit(); // Server.Transfer("~/Moderator/TransactionsList.aspx"); bookList.Clear(); Response.Redirect("~/Moderator/PurchaseSuccessModerator.aspx"); /* * DataTable bookTable = bookView.ToTable(); // Get the result set into a Data Table with all rows present * * string request = "Title = '" + book.title + "'"; // Creation of a SELECT statement * * DataRow[] bookRow = bookTable.Select(request); // Filter rows via the SELECT statement and assign it to a Data Row object * * book.isbn = bookRow[0]["ISBN"].ToString(); // Assign missing values to the Book from the Data Row object * // book.title = bookRow[0]["Title"].ToString(); * // book.author = bookRow[0]["Author"].ToString(); * book.publisher = bookRow[0]["Publisher"].ToString(); * book.publicationYear = bookRow[0]["PublicationYear"].ToString(); * // book.price = bookRow[0]["Price"].ToString(); * book.format = bookRow[0]["Format"].ToString(); * book.genre = bookRow[0]["Genre"].ToString(); * book.location = bookRow[0]["Location"].ToString(); */ }
/// <summary> /// clear both of the booklist /// </summary> public void ClearLists() { ResultList.Clear(); BookList.Clear(); }