Ejemplo n.º 1
0
        private void loanBookToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.ActiveMdiChild is ViewBooksForm)
            {
                ViewBooksForm form = this.ActiveMdiChild as ViewBooksForm;

                if (form.LibraryMode == Constants.LibraryMode.LIBRARY)
                {
                    foreach (Book b in form.Grid.SelectedBooks)
                    {
                        LoanBookForm lForm = new LoanBookForm(b.Id, b.ShortTitle, this);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void loanBookToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.ActiveMdiChild is ViewBooksForm)
            {
                ViewBooksForm form = this.ActiveMdiChild as ViewBooksForm;

                if (form.LibraryMode == Constants.LibraryMode.LIBRARY)
                {
                    foreach (Book b in form.Grid.SelectedBooks)
                    {
                        LoanBookForm lForm = new LoanBookForm(b.Id, b.ShortTitle, this);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Called when right click ->loan book is called
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void loanBookToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MainForm parent = this.ParentForm.MdiParent as MainForm;
            BookDAO dao = new BookDAO(parent.CurrentDatabase.FullName);


            foreach (DataGridViewRow row in this.gridBooks.SelectedRows)
            {
                string id = (row.Cells["id"].Value.ToString());
                string title = (row.Cells["short_title"].Value.ToString());


                if (dao.IsBookLoaned(id))
                {
                    MessageBox.Show("'" + title + "' has already been loaned, please check it in to loan it to someone different.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                LoanBookForm form = new LoanBookForm(id, title, parent);
                form.ShowDialog(this.ParentForm);
            }

            this.Refresh();

        }