private void link_GoBack_Click(object sender, EventArgs e)
        {
            IndexForm index = new IndexForm();

            index.Show();
            this.Hide();
        }
Exemplo n.º 2
0
        private void lOGOUTToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IndexForm index = new IndexForm();

            index.Show();
            this.Hide();
        }
        private void link_Back_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            IndexForm index = new IndexForm();

            index.Show();
            this.Close();
        }
Exemplo n.º 4
0
        private void btnBorrow_Click(object sender, EventArgs e)
        {
            DateTime     dt       = DateTime.Now;
            int          x        = db.sp_BorrowIDnumber() + 1;
            string       borrowID = "BRW-" + x + "-" + dt.Day + dt.Month + dt.Year;
            DialogResult res      = MessageBox.Show("CONFIRM:\nDo you want to borrow all the books in the table?", "Borrow Book", MessageBoxButtons.YesNo);

            if (res == DialogResult.Yes)
            {
                for (int i = 0; i < dgvBorrow.RowCount; i++)
                {
                    db.sp_BorrowBook(borrowID, txt_BorrowerID.Text, dgvBorrow.Rows[i].Cells[0].Value.ToString(), dt, DateTime.Parse(dgvBorrow.Rows[i].Cells[2].Value.ToString()));
                }

                MessageBox.Show("Successully Borrowed!");
                for (int i = 0; i < dgvBorrow.RowCount; i++)
                {
                    db.sp_DeleteSelectedBooks(dgvBorrow.Rows[i].Cells[0].Value.ToString());
                }
                txt_BookIDNum.Text  = null;
                txt_BorrowerID.Text = null;
                IndexForm index = new IndexForm();
                index.Show();
                this.Close();
            }
            else
            {
                IndexForm index = new IndexForm();
                index.Show();
                this.Close();
            }
        }
        private void btnBorrows_Click(object sender, EventArgs e)
        {
            DateTime dt        = DateTime.Now;
            string   currentSY = (from s in db.tblLibraryUsers select s.lib_SchoolYear).Max();

            if (brw.DoesBorrowerHaveCard(txt_BorrowerID.Text) == false)
            {
                MessageBox.Show("You are using an invalid library card. Please print a new one.");
            }
            else
            {
                if (brw.DidBorrowerLoggedInForAttendance(txt_BorrowerID.Text) == false)
                {
                    MessageBox.Show("Your library attendance should be taken first before you can borrow a book from the library.\n Please proceed to the library entrance to scan your card.");
                }
                else
                {
                    if (brw.checkNumberofBorrowedBooksIsValid(txt_BorrowerID.Text, dgvBorrow.RowCount) == true)
                    {
                        DialogResult res = MessageBox.Show("CONFIRM:\nDo you want to borrow all the books in the table?", "Borrow Book", MessageBoxButtons.YesNo);
                        if (res == DialogResult.Yes)
                        {
                            for (int i = 0; i < dgvBorrow.RowCount; i++)
                            {
                                db.sp_BorrowBook(brw.GenerateIDNumber(), txt_BorrowerID.Text, dgvBorrow.Rows[i].Cells[1].Value.ToString(), dt, dt.AddDays(3), currentSY);
                                db.sp_UpdateBookStatus(dgvBorrow.Rows[i].Cells[1].Value.ToString(), "Borrowed");
                            }

                            MessageBox.Show("Successully Borrowed!");
                            txtAccNumber.Text   = "";
                            txt_BorrowerID.Text = "";
                            if (origin == "index")
                            {
                                IndexForm index = new IndexForm();
                                index.Show();
                                this.Hide();
                            }
                            else
                            {
                                if (FinalFrame.IsRunning == true)
                                {
                                    FinalFrame.Stop();
                                }
                                this.Close();
                                //MainForm main = new MainForm(usertype);
                                //main.Show();
                                //this.Hide();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("You can only borrow 3 books at a time. You already have " + db.sp_BorrowedBooks(txt_BorrowerID.Text).Count() + " borrowed books.\nIf you wish to borrow more books, please return some of the borrowed books to the librarian.");
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult res = MessageBox.Show("Do you want to cancel? ", "Borrow Book", MessageBoxButtons.YesNo);

            if (res == DialogResult.Yes)
            {
                if (origin == "inquiry")
                {
                    IndexForm index = new IndexForm();
                    index.Show();
                    this.Hide();
                }
            }
        }
Exemplo n.º 7
0
        private void link_Back_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            DialogResult res = MessageBox.Show("Do you want to cancel?", "Cancel Returning of Book", MessageBoxButtons.YesNo);

            if (res == DialogResult.Yes)
            {
                for (int i = 0; i < dgvBorrow.RowCount; i++)
                {
                    db.sp_DeleteSelectedBooks(dgvBorrow.Rows[i].Cells[0].Value.ToString());
                }
                IndexForm index = new IndexForm();
                index.Show();
                this.Close();
            }
        }