private void BindBook() { bool isGroup = PrjPub.CurrentStudent.IsGroupLearder; int tech = PrjPub.CurrentStudent.TechnicianTypeID; int orgID = PrjPub.CurrentStudent.OrgID; int postID = PrjPub.CurrentStudent.PostID; string strIDPath = Request.QueryString.Get("Book"); BookBLL objBll = new BookBLL(); IList <RailExam.Model.Book> objBook = objBll.GetBookByKnowledgeOnline(orgID, postID, strIDPath, isGroup, tech); if (objBook.Count > 0) { foreach (RailExam.Model.Book book in objBook) { if (book.bookName.Length <= 15) { book.bookName = "<a onclick=OpenIndex('" + book.bookId + "') href=# title=" + book.bookName + " > " + book.bookName + " </a>"; } else { book.bookName = "<a onclick=OpenIndex('" + book.bookId + "') href=# title=" + book.bookName + " > " + book.bookName.Substring(0, 15) + " </a>"; } } } gvBook.DataSource = objBook; gvBook.DataBind(); gvBook.Visible = true; gvCourse.Visible = false; }
public FormInventoryReport() { InitializeComponent(); ReportInventoryController = new ReportInventoryBLL(); Reports = new List <ReportInventory>(); BookController = new BookBLL(); }
private void BindGrid1() { bool isGroup = PrjPub.CurrentStudent.IsGroupLearder; int tech = PrjPub.CurrentStudent.TechnicianTypeID; BookBLL bookBLL = new BookBLL(); IList <RailExam.Model.Book> bookList = bookBLL.GetEmployeeStudyBookInfo(Convert.ToInt32(ViewState["TrainTypeID"].ToString()), PrjPub.CurrentStudent.OrgID, PrjPub.CurrentStudent.PostID, isGroup, tech, 5); if (bookList.Count > 0) { foreach (RailExam.Model.Book book in bookList) { if (book.bookName.Length <= 13) { book.bookName = "<a onclick=OpenIndex('" + book.bookId + "') href=# title=" + book.bookName + " > " + book.bookName + " </a>"; } else { book.bookName = "<a onclick=OpenIndex('" + book.bookId + "') href=# title=" + book.bookName + " > " + book.bookName.Substring(0, 13) + " </a>"; } } } gvBook.DataSource = bookList; gvBook.DataBind(); }
private void BindGridByKnowledgeID() { int postID; if (!Int32.TryParse(ViewState["PostID"].ToString(), out postID)) { return; } int knowledgeID = Convert.ToInt32(ViewState["KnowledgeID"]); int orgID = PrjPub.CurrentStudent.OrgID; int techID = PrjPub.CurrentStudent.TechnicianTypeID; int leader = PrjPub.CurrentStudent.IsGroupLearder ? 1 : 0; BookBLL bookBLL = new BookBLL(); IList <RailExam.Model.Book> bookList = bookBLL.GetEmployeeStudyBookInfoByKnowledgeID(knowledgeID, orgID, postID, leader, techID, 0); if (bookList.Count > 0) { foreach (RailExam.Model.Book book in bookList) { book.bookName = "<a onclick=OpenIndex('" + book.bookId + "') href=# title=" + book.bookName + " > " + book.bookName + " </a>"; } Grid1.DataSource = bookList; Grid1.DataBind(); } }
//REMOVE BOOK FROM BOOK TABLE private void RemoveBook() { try { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("Enter book details.."); Console.ForegroundColor = ConsoleColor.White; Console.Write("Book Id: "); book.BookId = int.Parse(Console.ReadLine()); BookBLL removeBook = new BookBLL(); removeBook.RemoveBookBLL(book.BookId); } catch { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Enter a valid input"); Console.ForegroundColor = ConsoleColor.White; } /*catch (FormatException) * { * Console.ForegroundColor = ConsoleColor.Red; * Console.WriteLine("Enter a valid input"); * Console.ForegroundColor = ConsoleColor.White; * } * catch (Exception) * { * throw new LibraryMSException("Some unknown exception is occured.."); * }*/ }
protected void borrowButton_Click(object sender, EventArgs e) { string number = memberNoTextBox.Text; MemberBll aMemberBll = new MemberBll(); BookEnroll aBookEnroll = new BookEnroll(); BookBLL aBookBll = new BookBLL(); if (aMemberBll.CheckMemberExistance(number) == true) { messageLable.Text = ""; BorrowBookBll aBorrowBookBll = new BorrowBookBll(); aBookEnroll.BookID = (int)ViewState["bookId"]; aBookEnroll.MemberNumber = number; if (aBookBll.CheckBookDuplication(aBookEnroll) == true) { messageLabel.Text = "This book already you take"; } else { messageLabel.Text = ""; aBorrowBookBll.Save(aBookEnroll); } } else { messageLable.Text = "This Member Number doesn't exist"; } }
private void Button_Click_1(object sender, RoutedEventArgs e) { string bookname = TextSelected.Text.Trim(); BookBLL bookball = new BookBLL(); List <Book> books = new List <Book>(); books = bookball.SelectBooks(bookname); if (books.Count > 0) { DingdanWindow1 DingdanWindow = new DingdanWindow1(); DingdanWindow.WindowStartupLocation = WindowStartupLocation.Manual; DingdanWindow.Left = this.Left; DingdanWindow.Top = this.Top; DingdanWindow.Show(); this.Close(); string name = books[0].Name; string price = books[0].Price.ToString(); DingdanWindow.TextBookName.Text = name; DingdanWindow.TextPrice.Text = price; } else { MessageBox.Show("查无此书!"); } }
//UPDATE BOOK FROM BOOK TABLE private void UpdateBook() { try { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("Enter book details.."); Console.ForegroundColor = ConsoleColor.White; Console.Write("Book Id: "); book.BookId = int.Parse(Console.ReadLine()); Console.Write("Book Name: "); book.BookName = Console.ReadLine(); Console.Write("Book Author: "); book.BookAuthor = Console.ReadLine(); Console.Write("Book Copies: "); book.BookCopies = int.Parse(Console.ReadLine()); BookBLL updateBook = new BookBLL(); updateBook.UpdateBookBLL(book.BookId, book.BookName, book.BookAuthor, book.BookCopies); } catch (FormatException) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Enter a valid input"); Console.ForegroundColor = ConsoleColor.White; } catch (LibraryMSException) { throw new LibraryMSException("Some unknown exception is occured.."); } }
private void BindGrid() { string strKnowledgeID = Request.QueryString.Get("id"); IList <RailExam.Model.Book> bookList = new List <RailExam.Model.Book>(); if (strKnowledgeID != null & strKnowledgeID != "") { BookBLL bookBLL = new BookBLL(); bookList = bookBLL.GetBookByKnowledgeID(Convert.ToInt32(strKnowledgeID), 1); } string strtypeID = Request.QueryString.Get("id1"); if (strtypeID != null & strtypeID != "") { BookBLL bookBLL = new BookBLL(); bookList = bookBLL.GetBookByTrainTypeID(Convert.ToInt32(strtypeID), 1); } foreach (RailExam.Model.Book book in bookList) { book.bookName = "<a onclick=OpenIndex('" + book.bookId + "') href=# title=" + book.bookName + " > " + book.bookName + " </a>"; } Grid1.DataSource = bookList; Grid1.DataBind(); }
private void BindGrid1() { bool isGroup = PrjPub.CurrentStudent.IsGroupLearder; int tech = PrjPub.CurrentStudent.TechnicianTypeID; BookBLL bookBLL = new BookBLL(); IList <RailExam.Model.Book> bookList = bookBLL.GetEmployeeStudyBookInfo(Convert.ToInt32(ViewState["TrainTypeID"].ToString()), PrjPub.CurrentStudent.OrgID, PrjPub.CurrentStudent.PostID, isGroup, tech, 0); if (bookList.Count > 0) { foreach (RailExam.Model.Book book in bookList) { //obj.url = "~/BookHtml/" + obj.bookId + "/index.html"; if (book.bookName.Length <= 15) { book.bookName = "<a href=" + book.url + " target='_blank' title=" + book.bookName + ">" + book.bookName; } else { book.bookName = "<a href=" + book.url + " target='_blank' title=" + book.bookName + ">" + book.bookName.Substring(0, 15) + "..."; } } gvBook.DataSource = bookList; gvBook.DataBind(); } }
private void SaveBookCover(string bookid) { string strBookUrl = "../Book/" + bookid + "/cover.htm"; BookBLL objBill = new BookBLL(); objBill.UpdateBookUrl(Convert.ToInt32(bookid), strBookUrl); string srcPath = "../Online/Book/" + bookid + "/cover.htm"; RailExam.Model.Book obj = objBill.GetBook(Convert.ToInt32(bookid)); if (File.Exists(Server.MapPath(srcPath))) { File.Delete(Server.MapPath(srcPath)); } string str = "<link href='book.css' type='text/css' rel='stylesheet' />" + "<body oncontextmenu='return false' ondragstart='return false' onselectstart ='return false' oncopy='document.selection.empty()' onbeforecopy='return false'>" + "<br><br><br><br><br><br><br>" + "<div id='booktitle'>" + obj.bookName + "</div>" + "<br>" + "<br><br><br><br><br><br><br><br><br><br><br>" + "<div id='orgtitle'>" + obj.publishOrgName + "</div>" + "<br>" + "<div id='authortitle'></div>" + "</body>"; File.AppendAllText(Server.MapPath(srcPath), str, System.Text.Encoding.UTF8); BookChapterBLL objChapterBll = new BookChapterBLL(); objChapterBll.GetIndex(bookid); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["ID"] = Request.QueryString.Get("id"); ViewState["TypeID"] = Request.QueryString.Get("itemTypeID"); ViewState["BookChapterID"] = Request.QueryString.Get("BookChapterID"); ViewState["RangeType"] = Request.QueryString.Get("RangeType"); ViewState["ExamID"] = Request.QueryString.Get("examId"); ViewState["exculdeIDs"] = Request.QueryString.Get("exculdeIDs"); ViewState["subjectId"] = Request.QueryString.Get("subjectId"); HasExamId(); ViewState["ChooseId"] = ViewState["HasExamId"].ToString(); if (ViewState["RangeType"].ToString() == "4") { BookChapterBLL bookChapterBll = new BookChapterBLL(); BookChapter bookChapter = bookChapterBll.GetBookChapter(Convert.ToInt32(ViewState["BookChapterID"])); lblChapterName.Text = bookChapter.NamePath; } else { BookBLL bookBll = new BookBLL(); RailExam.Model.Book book = bookBll.GetBook(Convert.ToInt32(ViewState["BookChapterID"])); lblChapterName.Text = book.bookName; } ViewState["StartRow"] = 0; ViewState["EndRow"] = Grid1.PageSize; ViewState["EmploySortField"] = "nlssort(a.Item_ID,'NLS_SORT=SCHINESE_PINYIN_M')"; RecordCount = GetCount(); //计算总页数(加上OverPage()函数防止有余数造成显示数据不完整) PageCount = RecordCount / Grid1.PageSize + OverPage(); ViewState["RecordCount"] = RecordCount; //保存总页参数到ViewState(减去ModPage()函数防止SQL语句执行时溢出查询范围,可以用存储过程分页算法来理解这句) ViewState["PageCounts"] = RecordCount / Grid1.PageSize - ModPage(); //保存一个为0的页面索引值到ViewState ViewState["PageIndex"] = 0; //保存PageCount到ViewState,跳页时判断用户输入数是否超出页码范围 ViewState["JumpPages"] = PageCount; //显示LPageCount、LRecordCount的状态 this.lbPageCount.Text = PageCount.ToString(); this.lbRecordCount.Text = RecordCount.ToString(); //判断跳页文本框失效 if (RecordCount <= Grid1.PageSize) { btnJumpPage.Enabled = false; } else { btnJumpPage.Enabled = true; } BindGrid(ViewState["EmploySortField"].ToString()); } }
public FormRevenueReport() { InitializeComponent(); ReportRevenueController = new ReportRevenueBLL(); Reports = new List <ReportRevenue>(); BookController = new BookBLL(); }
private bool DownloadBook(string bookId) { BookBLL objBll = new BookBLL(); RailExam.Model.Book obj = objBll.GetBook(Convert.ToInt32(bookId)); string filename = Server.MapPath("/RailExamBao/Online/Book/" + bookId + "/"); if (!Directory.Exists(filename)) { return(false); } string ZipName = Server.MapPath("/RailExamBao/Online/Book/Book.zip"); GzipCompress(filename, ZipName); FileInfo file = new FileInfo(ZipName.ToString()); this.Response.Clear(); this.Response.Buffer = true; this.Response.Charset = "utf-7"; this.Response.ContentEncoding = Encoding.UTF7; // 添加头信息,为"文件下载/另存为"对话框指定默认文件名 this.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(obj.bookName) + ".zip"); // 添加头信息,指定文件大小,让浏览器能够显示下载进度 this.Response.AddHeader("Content-Length", file.Length.ToString()); // 指定返回的是一个不能被客户端读取的流,必须被下载 this.Response.ContentType = "application/ms-word"; // 把文件流发送到客户端 this.Response.WriteFile(file.FullName); return(true); }
public frmKitapEkle() { InitializeComponent(); _bookBLL = new BookBLL(); _publisherBLL = new PublisherBLL(); _authorBLL = new AuthorBLL(); }
/// <summary> /// Sets the listBox to show the checked out books. /// </summary> void SetListBox() { ResetFields(); borrowedBooks = GetCheckOutLogs(); if (borrowedBooks.Count > 0) { overDueLogs = GetOverDueLogs(); List <string> borrowedBooksStrings = new List <string>(); foreach (CheckOutLogBLL l in borrowedBooks) { BookBLL book = (from b in books where b.BookID == l.BookID select b).FirstOrDefault(); borrowedBooksStrings.Add($"{book.Title} {book.ISBN} " + l.ToString()); } listBox.DataContext = borrowedBooksStrings; } else { string[] isEmpty = { "The patron has not currently checked anything out." }; listBox.DataContext = isEmpty; } }
//数据加载(新增进入) private void DataLoadForInsert(string bookID, string chapterID) { this.hfBookID.Value = bookID; this.hfChapterID.Value = chapterID; string chapterName = String.Empty; BookBLL bookBLL = new BookBLL(); RailExam.Model.Book book = bookBLL.GetBook(Int32.Parse(bookID)); if (book != null) { chapterName += book.bookName; } BookChapterBLL chapterBLL = new BookChapterBLL(); BookChapter chapter = chapterBLL.GetBookChapter(Int32.Parse(chapterID)); if (chapter != null) { chapterName += " " + chapter.ChapterName; } this.lblchapter.Text = chapterName; this.txtCreater.Text = PrjPub.CurrentLoginUser.EmployeeName; this.dateCreate.DateValue = DateTime.Now.Date.ToShortDateString(); this.dateOut.DateValue = (new DateTime(2050, 1, 1)).Date.ToShortDateString(); }
protected void btnDel_Click(object sender, EventArgs e) { BookBLL objbll = new BookBLL(); IList <RailExam.Model.Book> objList = objbll.GetAllBookInfo(0); ArrayList objBookIDList = new ArrayList(); foreach (RailExam.Model.Book book in objList) { objBookIDList.Add(book.bookId.ToString()); } string[] fileList = Directory.GetFileSystemEntries(Server.MapPath("/RailExamBao/Online/Book/")); foreach (string file in fileList) { if (Directory.Exists(file)) { if (objBookIDList.IndexOf(Path.GetFileName(file)) == -1 && Path.GetFileName(file) != "template") { Directory.Delete(file, true); } } } SessionSet.PageMessage = "整理成功!"; }
public void Cleanup() { _unitOfWork = null; _bookRepo = null; _categoryRepo = null; _bookBLL = null; }
public ActionResult Index() { List <BookModel> bookList = BookBLL.ListAll(); List <BookListViewModel> bookViewModelList = bookList.Select(x => new BookListViewModel(x)).ToList(); return(View(bookViewModelList)); }
protected void btnInput_Click(object sender, EventArgs e) { BookBLL bookBLL = new BookBLL(); for (int i = 0; i < gvBook.Rows.Count; i++) { bool bChecked = ((CheckBox)gvBook.Rows[i].FindControl("chSelect")).Checked; if (bChecked) { ItemBLL objBll = new ItemBLL(); IList <RailExam.Model.Item> objItemList = objBll.GetItemsByBookBookId(Convert.ToInt32(gvBook.DataKeys[i].Value.ToString())); foreach (RailExam.Model.Item item in objItemList) { item.StatusId = 2; objBll.UpdateItem(item); } if (Directory.Exists(Server.MapPath("../Online/Book/" + gvBook.DataKeys[i].Value + "/"))) { DeleteFile(Server.MapPath("../Online/Book/" + gvBook.DataKeys[i].Value + "/")); } bookBLL.DeleteBook(Convert.ToInt32(gvBook.DataKeys[i].Value.ToString())); } } BindGrid(); }
private void BindBookTree() { string strId = Request.QueryString.Get("id"); RandomExamBLL objBll = new RandomExamBLL(); RailExam.Model.RandomExam objRandomExam = objBll.GetExam(Convert.ToInt32(strId)); BookBLL bookBLL = new BookBLL(); IList <RailExam.Model.Book> bookList = null; string strPostID = objRandomExam.PostID; string[] str = strPostID.Split(','); int orgID = PrjPub.CurrentLoginUser.OrgID; int leader = objRandomExam.IsGroupLeader; int techID = objRandomExam.TechnicianTypeID; PostBLL objPostBll = new PostBLL(); Hashtable htBook = new Hashtable(); for (int i = 0; i < str.Length; i++) { int postID = Convert.ToInt32(str[i]); IList <Post> objPostList = objPostBll.GetPostsByParentID(postID); if (objPostList.Count > 0) { continue; } bookList = bookBLL.GetEmployeeStudyBookInfoByKnowledgeID(-1, orgID, postID, leader, techID, 0); if (bookList.Count > 0) { TreeViewNode tvn = null; foreach (RailExam.Model.Book book in bookList) { if (!htBook.ContainsKey(book.bookId)) { tvn = new TreeViewNode(); tvn.ID = book.bookId.ToString(); tvn.Value = book.bookId.ToString(); //int n = objItemBll.GetItemsByBookID(book.bookId, Convert.ToInt32(strItemTypeID)); tvn.Text = book.bookName; tvn.ToolTip = book.bookName; tvn.Attributes.Add("isBook", "true"); tvn.ImageUrl = "/RailExamBao/App_Themes/" + StyleSheetTheme + "/Images/TreeView/Book.gif"; tvn.ContentCallbackUrl = "/RailExamBao/Common/GetBookChapter.aspx?itemTypeID=1&item=no&id=" + book.bookId; tvBookChapter.Nodes.Add(tvn); htBook.Add(book.bookId, book.bookName); } } } } }
public FormBookInfo() { InitializeComponent(); BookController = new BookBLL(); AuthorController = new AuthorBLL(); CategoryController = new CategoryBLL(); ImportBookCarllController = new ImportBookCardBLL(); }
public FormBookData() { InitializeComponent(); bookController = new BookBLL(); list = bookController.GetBooks(); ListShow = bookController.GetBooks(); ClearAndShow(); }
protected void Page_Load(object sender, EventArgs e) { string strItemTypeID = Request.QueryString.Get("itemTypeID"); if (strItemTypeID == null) { strItemTypeID = "1"; hfItemType.Value = "1"; } else { hfItemType.Value = strItemTypeID; } ItemBLL objItemBll = new ItemBLL(); BookBLL bookBLL = new BookBLL(); IList <RailExam.Model.Book> bookList = null; int postID = Convert.ToInt32(Request.QueryString.Get("PostID")); int orgID = Convert.ToInt32(Request.QueryString.Get("OrgID")); int leader = Convert.ToInt32(Request.QueryString.Get("Leader")); int techID = Convert.ToInt32(Request.QueryString.Get("Tech")); bookList = bookBLL.GetEmployeeStudyBookInfoByKnowledgeID(-1, orgID, postID, leader, techID, 0); if (bookList.Count > 0) { TreeViewNode tvn = null; foreach (RailExam.Model.Book book in bookList) { tvn = new TreeViewNode(); tvn.ID = book.bookId.ToString(); tvn.Value = book.bookId.ToString(); int n = objItemBll.GetItemsByBookID(book.bookId, Convert.ToInt32(strItemTypeID)); if (n > 0) { tvn.Text = book.bookName + "£¨" + n + "Ì⣩"; } else { tvn.Text = book.bookName; } tvn.ToolTip = book.bookName; tvn.Attributes.Add("isBook", "true"); tvn.ImageUrl = "/RailExamBao/App_Themes/" + StyleSheetTheme + "/Images/TreeView/Book.gif"; tvn.ShowCheckBox = true; tvn.ContentCallbackUrl = "/RailExamBao/Common/GetBookChapter.aspx?itemTypeID=" + strItemTypeID + "&flag=2&id=" + book.bookId; tvBookChapter.Nodes.Add(tvn); } } }
// DELETE: api/Book/5 public HttpResponseMessage Delete(int id) { if (!BookBLL.DeleteBook(id)) { return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } return(Request.CreateResponse(HttpStatusCode.OK)); }
private void BindTree() { //添加书名 BookBLL bookBLL = new BookBLL(); RailExam.Model.Book book = bookBLL.GetBook(Convert.ToInt32(ViewState["BookID"].ToString())); TreeViewNode tvn1 = new TreeViewNode(); tvn1.ID = "0"; tvn1.Value = ViewState["BookID"].ToString(); tvn1.Text = book.bookName; tvn1.ToolTip = book.bookName; tvBookChapter.Nodes.Add(tvn1); //添加章节 BookChapterBLL bookChapterBLL = new BookChapterBLL(); IList <RailExam.Model.BookChapter> bookChapterList = bookChapterBLL.GetBookChapterByBookID(Convert.ToInt32(ViewState["BookID"].ToString())); if (bookChapterList.Count > 0) { TreeViewNode tvn = null; foreach (RailExam.Model.BookChapter bookChapter in bookChapterList) { tvn = new TreeViewNode(); tvn.ID = bookChapter.ChapterId.ToString(); tvn.Value = bookChapter.BookId.ToString(); tvn.Text = bookChapter.ChapterName; tvn.ToolTip = bookChapter.ChapterName; if (bookChapter.ParentId == 0) { //tvBookChapter.Nodes.Add(tvn); tvBookChapter.FindNodeById(bookChapter.ParentId.ToString()).Nodes.Add(tvn); } else { try { tvBookChapter.FindNodeById(bookChapter.ParentId.ToString()).Nodes.Add(tvn); } catch { tvBookChapter.Nodes.Clear(); SessionSet.PageMessage = "数据错误!"; return; } } } } tvBookChapter.DataBind(); tvBookChapter.ExpandAll(); }
public CTHD() { InitializeComponent(); BookController = new BookBLL(); BooksBuy = new List <Book>(); BillDetails = new List <Bill>(); CusController = new CustomerBLL(); //this.StartPosition = CenterToScreen; }
public void LoadAllBooks() { BookBLL aBookBll = new BookBLL(); allBooksDropDownList.DataSource = aBookBll.GetAllBooks(); allBooksDropDownList.DataTextField = "Title"; allBooksDropDownList.DataValueField = "Id"; allBooksDropDownList.DataBind(); }
public ActionResult Index() { ListBooksDTO listBooks = new ListBooksDTO(); using (BookBLL oBoBLL = new BookBLL()) { listBooks = oBoBLL.GetBooks(); } return(View("Index", listBooks)); }