Esempio n. 1
0
        private void btnAddBook_Click(object sender, EventArgs e)
        {
            if (txtMemberID.Text == "")
            {
                MessageBox.Show("Nhập mã độc giả trước khi thêm sách!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (txtBookID.Text == "")
            {
                MessageBox.Show("Mã sách rỗng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string temp     = txtBookID.Text;
            string madg     = txtMemberID.Text;
            int    money    = int.Parse(MuonSach_DAO.borrowmoney(temp));
            int    discount = MuonSach_DAO.discount(madg);
            int    state    = int.Parse(MuonSach_DAO.State(temp));

            if (!isNotText(temp) && MuonSach_DAO.CheckTheSameBookID(temp))
            {
                checkedListBox1.Items.Add(txtBookID.Text);
                totalcost        = totalcost + money;
                txtCost.Text     = totalcost.ToString();
                dtpBorrow.Value  = DateTime.Now;
                dtpReturn.Value  = dtpBorrow.Value.AddDays(int.Parse(CaiDat_DAO.LayNgayMuonToiDa()));
                txtState.Text    = state.ToString();
                txtDiscount.Text = ((float)totalcost * discount / 100).ToString();
                txtCost.Text     = (totalcost - int.Parse(txtDiscount.Text)).ToString();
            }
            else
            {
                MessageBox.Show("Sai mã sách");
            }
        }
Esempio n. 2
0
 private void btnDestroy_Click(object sender, EventArgs e)
 {
     txtBorrowID.Text = "";
     txtMemberID.Text = "";
     txtBookID.Text   = "";
     dtpBorrow.Value  = DateTime.Now;
     dtpReturn.Value  = dtpBorrow.Value.AddDays(int.Parse(CaiDat_DAO.LayNgayMuonToiDa()));
     txtDiscount.Text = "";
     txtCost.Text     = "";
     txtState.Text    = "";
     checkedListBox1.Items.Clear();
 }
Esempio n. 3
0
        void loadNgayMuonToiDa()
        {
            string ngayMuonToiDa = CaiDat_DAO.LayNgayMuonToiDa();

            NgayMuonToiDaText.Text = ngayMuonToiDa;
        }