Esempio n. 1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.dgvPublisher.SelectedCells.Count > 0)
            {
                int             selectedrowindex = this.dgvPublisher.SelectedCells[0].RowIndex;
                DataGridViewRow selectedRow      = this.dgvPublisher.Rows[selectedrowindex];
                PublisherBLL    publisherBLL     = new PublisherBLL(Convert.ToInt32(selectedRow.Cells["clmnId"].Value), selectedRow.Cells["clmnName"].Value.ToString(), selectedRow.Cells["clmnPhone"].Value.ToString(), selectedRow.Cells["clmnAddress"].Value.ToString());
                DialogResult    result           = MessageBox.Show("Do you want to delete publisher: " + selectedRow.Cells["clmnName"].Value + "?", "Warning", MessageBoxButtons.OKCancel);
                switch (result)
                {
                case DialogResult.Cancel:
                    break;

                case DialogResult.OK:
                    if (PublisherDAL.getPublisherItem(publisherBLL) != null)
                    {
                        MessageBox.Show("Can't delete! Please delete all book title has publisher " + selectedRow.Cells["clmnName"].Value + " before delete this publisher!", "Error");
                        break;
                    }
                    else
                    {
                        PublisherDAL.deletePublisher(publisherBLL);
                        MessageBox.Show("Delete complete!", "Success");
                        this.LoadDataToGridView();
                        break;
                    }
                }
            }
        }
        public ActionResult OthersBookPublisher()
        {
            int bookPublisherID = PublisherDAL.GetBookPublisher();

            ViewBag.BookPublishers = BookDAL.GetBooksBelongToBookPublisher(bookPublisherID);
            var bookPublishers = PublisherDAL.GetPublishers();

            return(View(bookPublishers));
        }
Esempio n. 3
0
        public static string AddPublisher(PublisherModel publisher)
        {
            string msg = "插入出版社失败";

            if (PublisherDAL.InsertPublisher(publisher) == 1)
            {
                msg = "插入出版社成功";
            }
            return(msg);
        }
        public ActionResult BooksPublisher(int ID)
        {
            var books = BookDAL.GetBooksPublisherInOrder(ID);

            ViewBag.BookPublishers = PublisherDAL.GetPublishers();
            if (books == null)
            {
                ViewBag.Books = "Không có sách nào thuộc nhà xuất bản này";
            }
            return(View(books));
        }
        public ActionResult BookDetail(int ID)
        {
            var book = BookDAL.GetBook(ID);

            ViewBag.BookCategory = BookCategoryDAL.GetBookCategory(book.BookCategoryID.Value);
            ViewBag.Publisher    = PublisherDAL.GetBookPublisher(book.PublisherID.Value);
            if (book == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            return(View(book));
        }
Esempio n. 6
0
        private void LoadDataToGridView()
        {
            this.dgvPublisher.Rows.Clear();
            PublisherBLL        publiserBLL  = new PublisherBLL();
            List <PublisherBLL> publisherArr = new List <PublisherBLL>();

            publisherArr = PublisherDAL.getPublisherList();
            foreach (PublisherBLL row in publisherArr)
            {
                this.dgvPublisher.Rows.Add(row.PublisherId, row.Name, row.Phone, row.Address);
            }
            this.GetSelectedValue();
            this.dgvPublisher.CellClick += new DataGridViewCellEventHandler(dgvPublisher_CellClick);
        }
Esempio n. 7
0
        static public int GetPublisherIDByname(string name)
        {
            object id = PublisherDAL.SelectPublisherIDByName(name);

            if (id != null)
            {
                id = (int)id;
            }
            else
            {
                id = -1;
            }
            return((int)id);
        }
        public List <ComboboxItem> getComboboxItemPublisher()
        {
            List <PublisherBLL> publisherList = new List <PublisherBLL>();

            publisherList = PublisherDAL.getPublisherList();
            List <ComboboxItem> comboboxItemList = new List <ComboboxItem>();

            for (int i = 0; i < publisherList.Count; i++)
            {
                ComboboxItem item = new ComboboxItem();
                item.Value = publisherList[i].PublisherId;
                item.Text  = publisherList[i].Name;
                comboboxItemList.Add(item);
            }
            return(comboboxItemList);
        }
Esempio n. 9
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            PublisherBLL publisherBLL = new PublisherBLL();

            publisherBLL.Name    = this.txtPublisherName.Text;
            publisherBLL.Phone   = this.txtPhone.Text;
            publisherBLL.Address = this.txtAddress.Text;
            if (publisherBLL.Name == "")
            {
                MessageBox.Show("Author name is not null!", "Notice");
                return;
            }
            PublisherDAL.addPublisher(publisherBLL);
            MessageBox.Show("Add success!", "Success");
            this.LoadDataToGridView();
        }
Esempio n. 10
0
        public ActionResult Edit(int ID)
        {
            var book      = BookDAL.GetBook(ID);
            var bookModel = new BookModel
            {
                ID          = ID,
                Name        = book.Name,
                ImagePath   = book.Image,
                Price       = book.Price.Value,
                Description = book.Description,
                Quantity    = book.Quantity.Value,
                Status      = book.Status
            };

            ViewBag.BookCategories = new SelectList(BookCategoryDAL.GetBookCategories(), "ID", "Name", book.BookCategoryID.Value);
            ViewBag.Publishers     = new SelectList(PublisherDAL.GetPublishers(), "ID", "Name", book.PublisherID.Value);
            return(View(bookModel));
        }
Esempio n. 11
0
        private void LoadDataToDataGridViewBookTitle()
        {
            this.dgvBookTitle.Rows.Clear();
            List <BookTitleBLL> bookTitleList = new List <BookTitleBLL>();

            bookTitleList = BookTitleDAL.getBookTitleList();
            TypeOfBookBLL typeOfBookBLL = new TypeOfBookBLL();

            foreach (BookTitleBLL row in bookTitleList)
            {
                typeOfBookBLL = TypeOfBookDAL.getTypeOfBookItem(row.TypeOfBookId);
                PublisherBLL publisherBLL = new PublisherBLL();
                publisherBLL = PublisherDAL.getPublisherItem(row.PublisherId);
                BookTitleStatusBLL status = new BookTitleStatusBLL();
                status = BookTitleStatusDAL.getBookTitleStatusItem(row.BookTitleStatusId);
                this.dgvBookTitle.Rows.Add(row.BookTitleId, row.Name, row.TypeOfBookId, typeOfBookBLL.Name, row.PublisherId, publisherBLL.Name, row.BookTitleStatusId, status.Name, row.Summary);
            }
            GetSelectedValueDataGridViewBookTitle();
            this.dgvBookTitle.SelectionChanged += new EventHandler(dgvBookTitle_SelectionChanged);
        }
Esempio n. 12
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.dgvPublisher.SelectedCells.Count > 0)
            {
                int selectedrowindex = this.dgvPublisher.SelectedCells[0].RowIndex;

                DataGridViewRow selectedRow = this.dgvPublisher.Rows[selectedrowindex];

                PublisherBLL publisherBLL = new PublisherBLL(Convert.ToInt32(selectedRow.Cells["clmnId"].Value), this.txtPublisherName.Text, this.txtPhone.Text, this.txtAddress.Text);

                if (publisherBLL.Name == "")
                {
                    MessageBox.Show("Author name is not null!", "Notice");
                    return;
                }
                PublisherDAL.updatePublisher(publisherBLL);
                MessageBox.Show("Update success!", "Success");
                this.LoadDataToGridView();
            }
        }
Esempio n. 13
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            string catalog = this.cboSearch.Text;
            string key     = this.txtSearch.Text;

            if (key == "")
            {
                MessageBox.Show("Please enter keyword!", "Notice");
                return;
            }
            PublisherBLL        publisherBLL = new PublisherBLL();
            List <PublisherBLL> publisherArr = new List <PublisherBLL>();

            publisherArr = PublisherDAL.search(catalog, key);
            this.dgvPublisher.Rows.Clear();
            foreach (PublisherBLL row in publisherArr)
            {
                this.dgvPublisher.Rows.Add(row.PublisherId, row.Name, row.Phone, row.Address);
            }
            this.GetSelectedValue();

            this.dgvPublisher.CellClick += new DataGridViewCellEventHandler(dgvPublisher_CellClick);
        }
Esempio n. 14
0
        public List <BookTitleBLL> search(string catalog, string key)
        {
            if (catalog == "matinhtrang")
            {
                List <BookTitleBLL>       bookTitleList       = new List <BookTitleBLL>();
                List <BookTitleStatusBLL> bookTitleStatusList = new List <BookTitleStatusBLL>();
                bookTitleStatusList = BookTitleStatusDAL.getBookTitleStatusItem(key);
                if (bookTitleStatusList != null)
                {
                    foreach (BookTitleStatusBLL bookTitleStatusBLL in bookTitleStatusList)
                    {
                        List <BookTitleBLL> results = new List <BookTitleBLL>();
                        results = BookTitleDAL.getBookTitleList(catalog, bookTitleStatusBLL.BookTitleStatusId);
                        if (results != null)
                        {
                            foreach (BookTitleBLL bookTitleBLL in results)
                            {
                                bookTitleList.Add(bookTitleBLL);
                            }
                        }
                    }

                    return(bookTitleList);
                }
                return(null);
            }
            else if (catalog == "manxb")
            {
                List <BookTitleBLL> bookTitleList = new List <BookTitleBLL>();
                List <PublisherBLL> publisherList = new List <PublisherBLL>();
                publisherList = PublisherDAL.getPublisherItem(key);
                if (publisherList != null)
                {
                    foreach (PublisherBLL publisherBLL in publisherList)
                    {
                        List <BookTitleBLL> results = new List <BookTitleBLL>();
                        results = BookTitleDAL.getBookTitleList(catalog, publisherBLL.PublisherId);
                        if (results != null)
                        {
                            foreach (BookTitleBLL bookTitleBLL in results)
                            {
                                bookTitleList.Add(bookTitleBLL);
                            }
                        }
                        return(bookTitleList);
                    }
                }
                return(null);
            }
            else if (catalog == "matheloai")
            {
                List <BookTitleBLL>  bookTitleList  = new List <BookTitleBLL>();
                List <TypeOfBookBLL> typeOfBookList = new List <TypeOfBookBLL>();
                typeOfBookList = TypeOfBookDAL.getTypeOfBookItem(key);
                if (typeOfBookList != null)
                {
                    foreach (TypeOfBookBLL typeOfBookBLL in typeOfBookList)
                    {
                        List <BookTitleBLL> results = new List <BookTitleBLL>();
                        results = BookTitleDAL.getBookTitleList(catalog, typeOfBookBLL.TypeOfBookId);
                        if (results != null)
                        {
                            foreach (BookTitleBLL bookTitleBLL in results)
                            {
                                bookTitleList.Add(bookTitleBLL);
                            }
                        }
                        return(bookTitleList);
                    }
                }
                return(null);
            }
            else if (catalog == "tensach" || catalog == "tomtat")
            {
                List <BookTitleBLL> bookTitleList = new List <BookTitleBLL>();
                bookTitleList = BookTitleDAL.search(catalog, key);
                return(bookTitleList);
            }
            return(null);
        }
Esempio n. 15
0
 public ActionResult Create()
 {
     ViewBag.BookCategories = new SelectList(BookCategoryDAL.GetBookCategories(), "ID", "Name");
     ViewBag.Publishers     = new SelectList(PublisherDAL.GetPublishers(), "ID", "Name");
     return(View());
 }
Esempio n. 16
0
 public PublisherBLL()
 {
     _publisherDAL = new PublisherDAL();
 }
Esempio n. 17
0
 static public string GetAllPublisher()
 {
     return(JsonConvert.SerializeObject(PublisherDAL.SelectAllPublisher()));
 }
Esempio n. 18
0
 static public int GetPublisherCount()
 {
     return(PublisherDAL.SelectPublisherCount());
 }
        public ActionResult MenuLeftFooter()
        {
            var publishers = PublisherDAL.GetTenPublisher();

            return(PartialView(publishers));
        }