Esempio n. 1
0
        void returnBook_Click(object sender, EventArgs e)
        {
            ReturnBookPanel returnBook = (ReturnBookPanel)sender;

            returnBook.IsReturend = !returnBook.IsReturend;
            MessageBox.Show("Clicked");
        }
Esempio n. 2
0
 private void addReturnBooksToTheFlowLayout(ref ReturnBookPanel returnBook)
 {
     returnBook                = new ReturnBookPanel();
     returnBook.Click         += returnBook_Click;
     returnBook.ParentTabPanel = this;
     returnFlowLayout.Controls.Add(returnBook);
     returnBorrowFlowLayout_Resize(returnFlowLayout, null);
 }
Esempio n. 3
0
        private void returnAllButton_Click(object sender, EventArgs e)
        {
            int count = returnFlowLayout.Controls.Count;

            for (int i = 0; i < count; i++)
            {
                ReturnBookPanel book = (ReturnBookPanel)returnFlowLayout.Controls[i];
                book.IsReturend = true;
            }
            returnNextButton.Enabled = true;
        }
Esempio n. 4
0
        private void updateAllBooksToReturnTrue()
        {
            int bookCount = returnFlowLayout.Controls.Count;

            for (int i = 0; i < bookCount; i++)
            {
                ReturnBookPanel  book  = (ReturnBookPanel)returnFlowLayout.Controls[i];
                TransactionModel trans = book.Transaction;
                trans.ReturnDate = DateTime.Today;

                TransactionController.SetReturnDate(trans.TransId, DateTime.Today);
            }
        }
Esempio n. 5
0
        public bool isAllReturned()
        {
            foreach (Control bookControl in returnFlowLayout.Controls)
            {
                ReturnBookPanel book = (ReturnBookPanel)bookControl;
                if (!book.IsReturend)
                {
                    returnNextButton.Enabled = false;
                    return(false);
                }
            }

            returnNextButton.Enabled = true;

            return(true);
        }
Esempio n. 6
0
        private void findButton_Click(object sender, EventArgs e)
        {
            string accessNo;
            string memberNo;

            //Get the member who doesn't return the book
            #region Get the member
            if (bookIDRadioButton.Checked)
            {
                accessNo = searchIDTextBox.Text;
                memberNo = TransactionController.GetMember_NotReturned(accessNo);
                if (memberNo == null)
                {
                    ValidationClass.ShowInvalidError(
                        highlighter,
                        searchIDTextBox,
                        "This Book is already available in the Library OR\nAccession Number is not valid!",
                        "Invalid Accession Number"
                        );

                    //No Execution further
                    return;
                }
            }
            else
            {
                memberNo = searchIDTextBox.Text;
                if (!MemberController.IsMemberExists(memberNo))
                {
                    ValidationClass.ShowInvalidError(
                        highlighter,
                        searchIDTextBox,
                        "Invalid Member Number",
                        "Member No"
                        );

                    //No Execution further
                    return;
                }
            }

            //Load Member
            MemberModel member = MemberController.GetMember(memberNo);

            //If the member is already opened by a tab in parent form
            SubItemsCollection openedTabs = ParentTransForm.GetOpenedTabs();//TODO : This in not good
            for (int i = 0; i < openedTabs.Count; i++)
            {
                if (openedTabs[i].Text == member.Name)
                {
                    MessageBox.Show("This Member has already opened in a Tab.");
                    return;
                }
            }

            Member = member;
            memberPanel.Visible = true;

            #endregion

            //Load Books
            #region Load Books
            List <TransactionModel> transList = TransactionController.GetTransactions(memberNo);
            int transCount = transList.Count;
            returnBooks = new ReturnBookPanel[transCount];
            returnFlowLayout.Controls.Clear();
            for (int i = 0; i < transCount; i++)
            {
                BookModel book = BookController.GetBook(transList[i].AccessNo);
                addReturnBooksToTheFlowLayout(ref returnBooks[i]);
                returnBooks[i].BookModel   = book;
                returnBooks[i].Transaction = transList[i];
            }
            isAllReturned();
            #endregion

            verifyNextButton.PerformClick();
        }