Ejemplo n.º 1
0
        private void btnMember_Click(object sender, EventArgs e)
        {
            int borrowerNumber;

            try
            {
                borrowerNumber = int.Parse(txtBorrowerNumber.Text);
            }
            catch
            {
                MessageBox.Show("Borrower number must be a integer!");
                txtBorrowerNumber.Focus();
                return;
            }
            Borrower b = BorrowerDAO.GetBorrower(borrowerNumber);

            if (b == null)
            {
                MessageBox.Show(String.Format("Borrower number {0} does't exist!", borrowerNumber));
                txtBorrowerNumber.Focus();
                return;
            }
            txtName.Text = b.Name;


            View();

            displayButtons(2);
        }
Ejemplo n.º 2
0
        protected void btCheckMember_Click(object sender, EventArgs e)
        {
            txtName.Text = "";
            lbNumberOfBorrowedBooks.Text = "0";
            lbError.Visible = false;
            int borrowerNumber;

            try
            {
                borrowerNumber = int.Parse(txtMemberCode.Text);
            }
            catch
            {
                lbError.Visible = true;
                lbError.Text    = "Borrower number must be a integer!";
                txtMemberCode.Focus();
                return;
            }
            Borrower b = BorrowerDAO.GetBorrower(borrowerNumber);

            if (b == null)
            {
                lbError.Visible = true;
                lbError.Text    = String.Format("Borrower number {0} does't exist!", borrowerNumber);
                txtMemberCode.Focus();
                return;
            }

            txtName.Text = b.Name;
            lbNumberOfBorrowedBooks.Text = GridView1.Rows.Count.ToString();
            // View();
        }
Ejemplo n.º 3
0
        protected void btnCheckMember_Click(object sender, EventArgs e)
        {
            if (txtBorrowerNumber.Text.Trim().Equals(""))
            {
                showMessageError("Borrower number can't be empty");
                return;
            }

            if (!DAO.checkInt(txtBorrowerNumber.Text))
            {
                showMessageError("BorrowerNumber must be a integer number");
                return;
            }

            int      borrowerNumber = int.Parse(txtBorrowerNumber.Text);
            Borrower b = BorrowerDAO.GetBorrower(borrowerNumber);

            if (b == null)
            {
                showMessageError(String.Format("Borrower number {0} doesn't exist!", borrowerNumber));
                txtBorrowerNumber.Focus();
                return;
            }
            txtName.Text = b.Name;

            getData();
            displayButtons(2);
        }
Ejemplo n.º 4
0
        protected void btnMember_Click(object sender, EventArgs e)
        {
            int borrowerNumber;

            try
            {
                borrowerNumber = int.Parse(txtBorrowerNumber.Text);
            }
            catch
            {
                lblError.Text = "Borrower number must be a integer!";
                txtBorrowerNumber.Focus();
                return;
            }
            Borrower b = BorrowerDAO.GetBorrower(borrowerNumber);

            if (b == null)
            {
                txtBorrowerNumber.Focus();
                return;
            }
            txtName.Text = b.Name;
            View();
            displayButtons(2);
        }
Ejemplo n.º 5
0
        protected void btnMember_Click(object sender, EventArgs e)
        {
            int borrowerNumber;

            try
            {
                borrowerNumber = int.Parse(txtBorrowerNumber.Text);
            }
            catch
            {
                lblError.Text = "Borrower number must be a integer!";
                txtBorrowerNumber.Focus();
                return;
            }
            Borrower b = BorrowerDAO.GetBorrower(borrowerNumber);

            if (b == null)
            {
                lblError.Text = String.Format("Borrower number {0} does't exist!", borrowerNumber);
                txtBorrowerNumber.Focus();
                return;
            }
            txtName.Text = b.Name;


            View();
            if (lblNumberReservedBooks.Text == "0")
            {
                displayButtons(2);
            }
            else
            {
                displayButtons(1);
            }
        }
Ejemplo n.º 6
0
        protected void btnReserve_Click(object sender, EventArgs e)
        {
            int      borrowerNum = int.Parse(txtBorrowerNumber.Text);
            Borrower borrower    = BorrowerDAO.GetBorrower(borrowerNum);

            Reservation rv = new Reservation(int.Parse(txtBorrowerNumber.Text), int.Parse(txtBookNumber.Text), Calendar1.SelectedDate);

            if (ReserveDAO.Insert(rv))
            {
                View(borrower);
                btnReserve.Enabled = false;
            }
            else
            {
                lblError.Text = "Reserve queue failse! ";
            }
        }
Ejemplo n.º 7
0
        private void btnMember_Click(object sender, EventArgs e)
        {
            int borrowerNumber;

            try
            {
                borrowerNumber = int.Parse(txtBorrowerNumber.Text);
            }
            catch
            {
                MessageBox.Show("Borrower number must be a integer!");
                txtBorrowerNumber.Focus();
                return;
            }
            //create in DAO
            Borrower b = BorrowerDAO.GetBorrower(borrowerNumber);

            if (b == null)
            {
                MessageBox.Show(String.Format("Borrower number {0} does't exist!", borrowerNumber));
                txtBorrowerNumber.Focus();
                return;
            }
            txtName.Text = b.Name;

            View();

            int n = dataGridView1.Rows.Count;

            MessageBox.Show("Number = " + n);

            if (dataGridView1.Rows.Count >= 5)
            {
                MessageBox.Show("You borrowed 5 books, so you can't borrow any more!");
                txtBorrowerNumber.Focus();
                return;
            }

            displayButtons(2);

            r = null;
            c = null;
        }
Ejemplo n.º 8
0
        protected void btnCheckMember_Click(object sender, EventArgs e)
        {
            int borrowerNum;

            if (DAO.checkInt(txtBorrowerNumber.Text) == false)
            {
                lblError.Text = "Borrower number must be a integer!";

                /*MessageBox.Show("");
                 * txtMemberCode.Focus();*/
                return;
            }
            borrowerNum = int.Parse(txtBorrowerNumber.Text);
            Borrower borrower = BorrowerDAO.GetBorrower(borrowerNum);

            if (borrower != null)
            {
                txtName.Text = borrower.Name; //display name
                View(borrower);
                //MessageBox.Show("R".Equals("R") + "");
                if (ReserveDAO.GetLastReserveOfBorrower(int.Parse(txtBorrowerNumber.Text)) != null &&
                    ReserveDAO.GetLastReserveOfBorrower(int.Parse(txtBorrowerNumber.Text)).Status.ToString().Equals("R"))    //mean the last record still R
                {
                    //have a book in reserve
                    /* MessageBox.Show("Oops! you have book in reserve queue! You can't reserve book until it's over");*/
                    lblError.Text           = "Oops! you have book in reserve queue! You can't reserve book until it's over";
                    btnChkCondition.Enabled = false;
                    txtBookNumber.Enabled   = false;
                    btnReserve.Enabled      = false;
                }
                else
                {
                    lblError.Text           = " ";
                    btnChkCondition.Enabled = true;
                    txtBookNumber.Enabled   = true;
                }
            }
            else
            {
                lblError.Text = "Oops, ID is not exist! Check again!";
            }
        }
Ejemplo n.º 9
0
        protected void btnCheckButton_Click(object sender, EventArgs e)//check member
        {
            lblError.Visible = false;
            int borrowerNumber;

            try
            {
                borrowerNumber = int.Parse(txtBorrowerNumber.Text);
            }
            catch
            {
                lblError.Visible = true;
                lblError.Text    = "Borrower number must be a integer!";
                txtBorrowerNumber.Focus();
                return;
            }
            Borrower b = BorrowerDAO.GetBorrower(borrowerNumber);

            if (b == null)
            {
                lblError.Visible = true;
                lblError.Text    = String.Format("Borrower number {0} does't exist!", borrowerNumber);
                txtBorrowerNumber.Focus();
                return;
            }
            txtName.Text = b.Name;
            showData();

            int n = GridView1.Rows.Count;

            lblNoOfBorrowedCopy.Text = n.ToString();
            if (GridView1.Rows.Count >= 5)
            {
                lblError.Visible = true;
                lblError.Text    = "You borrowed 5 books, so you can't borrow any more!";
                return;
            }
            displayButtons(2);
            c = null;
            r = null;
        }
Ejemplo n.º 10
0
        protected void btnCheck_Click(object sender, EventArgs e)
        {
            if (txtBorrowerNumber.Text != null)
            {
                int borrowNumber;
                if (DAO.checkInt(txtBorrowerNumber.Text) == false)
                {
                    lblError.Text = "Borrower number must be a integer!";
                    txtBorrowerNumber.Focus();
                    return;
                }
                borrowNumber = int.Parse(txtBorrowerNumber.Text);
                Borrower b = BorrowerDAO.GetBorrower(borrowNumber);
                if (b == null)
                {
                    lblError.Text = String.Format("Borrower number {0} does't exist!", txtBorrowerNumber.Text);
                    txtBorrowerNumber.Focus();
                    return;
                }


                txtName.Text = b.Name;
                //check borrowed >= 5 books
                if (BorrowDAO.GetBorrowedCopies(int.Parse(txtBorrowerNumber.Text)).Rows.Count >= 5)
                {
                    lblError.Text = "You borrowed 5 books, so you can't borrow any more!";
                    return;
                }

                ObjectDataSource1.FilterExpression = "borrowerNumber = " + txtBorrowerNumber.Text;
                GridView1.DataBind();
                displayButtons(2);
                /*ObjectDataSource1.DataBind();*/
            }
            else
            {
                lblError.Text = "Borrower number required!";
            }
        }
Ejemplo n.º 11
0
        protected void btCheckMember_Click(object sender, EventArgs e)
        {
            lbError.Visible = false;
            int borrowerNumber;

            try
            {
                borrowerNumber = int.Parse(txtMemberCode.Text);
            }
            catch
            {
                lbError.Visible = true;
                lbError.Text    = "Borrower number must be a integer!";
                txtMemberCode.Focus();
                return;
            }
            Borrower b = BorrowerDAO.GetBorrower(borrowerNumber);

            if (b == null)
            {
                lbError.Visible = true;
                lbError.Text    = String.Format("Borrower number {0} does't exist!", borrowerNumber);
                txtMemberCode.Focus();
                return;
            }
            txtName.Text = b.Name;

            View();
            if (GridView1.Rows.Count >= 1)
            {
                lbError.Visible = true;
                lbError.Text    = "You has already reserved !!!";
                txtMemberCode.Focus();
                return;
            }
            displayButtons(2);
        }