private void recommendButton_Click(object sender, EventArgs e)//推荐 { currentBook.Recommend = currentBook.Recommend + 1; BookShelfService.UpdateBook(currentBook); this.recommendButton.Enabled = false; this.recommendButton.Visible = false; }
private void finishButton_Click(object sender, EventArgs e)//完成 { switch (Flag) { case 1: formAccount.Show(); formAccount.resetAppointAndLend(); formAccount.Parent = null; this.Close(); break; case 2: formLibrary.Show(); formLibrary.resetBooks(); formLibrary.Parent = null; this.Close(); break; case 3: formManage.Show(); formManage.resetLibrary(); formManage.Parent = null; this.Close(); break; case 4: currentBook.Name = this.nameTextBox.Text; currentBook.Author = this.authorTextBox.Text; currentBook.Sort = this.sortTextBox.Text; currentBook.Description = this.introductionTextBox.Text; BookShelfService.UpdateBook(currentBook); if (path != null) { if (File.Exists(resPath + @"\" + currentBook.Name + ".jpg")) { File.Delete(resPath + @"\" + currentBook.Name + ".jpg"); } FileStream fr = File.Open(path, FileMode.Open); FileStream fw = File.Open(resPath + @"\" + currentBook.Name + ".jpg", FileMode.Create); Image newImage = Image.FromStream(fr); newImage.Save(fw, System.Drawing.Imaging.ImageFormat.Jpeg); currentBook.imagePath = resPath + @"\" + currentBook.Name + ".jpg"; fr.Close(); fw.Close(); } formManage.Show(); formManage.resetLibrary(); formManage.Parent = null; this.Close(); break; default: break; } }