Example #1
0
        private void btnLapPhieu_Click_1(object sender, EventArgs e)
        {
            if (txtMaDGPhieu.TextLength == 0)
            {
                MessageBox.Show("Mã Độc Giả Trống.");
            }

            else if (cmbTenSachPhieu.SelectedIndex == -1)
            {
                MessageBox.Show("Vui lòng chọn sách");
            }

            else if (txtSLMuon.TextLength == 0)
            {
                MessageBox.Show("Vui lòng nhập số lượng.");
            }

            else
            {
                for (int i = 0; i < lstSachMuon.Items.Count; i++)
                {
                    PhieuMuon phieu = new PhieuMuon(txtmaPhieu.Text, txtMaDGPhieu.Text, lstSachMuon.Items[i].SubItems[0].Text, int.Parse(lstSachMuon.Items[i].SubItems[2].Text), dpkNgayMuon.Value);
                    PhieuMuonBUS.Instance.AddPhieuMuon(phieu);
                    SachBUS.Instance.UpdateSLBook(int.Parse(SachBUS.Instance.getSLuong(lstSachMuon.Items[i].SubItems[0].Text)) - int.Parse(lstSachMuon.Items[i].SubItems[2].Text), lstSachMuon.Items[i].SubItems[0].Text);
                }
                QuanLySach_Load(sender, e);
                MessageBox.Show("Lập Thành Công.");
            }
        }
Example #2
0
 private void butPhieuMuon_Click(object sender, EventArgs e)
 {
     PhieuMuon frm = new PhieuMuon();
     frm.ShowDialog();
     frm.Close();
     frm.Dispose();
 }
Example #3
0
        private void butPhieuMuon_Click(object sender, EventArgs e)
        {
            PhieuMuon frm = new PhieuMuon();

            frm.ShowDialog();
            frm.Close();
            frm.Dispose();
        }
Example #4
0
        private void btnMuon_Click(object sender, EventArgs e)
        {
            PhieuMuon tcs = new PhieuMuon();

            this.Hide();
            tcs.ShowDialog();
            this.Show();
        }
        private void btnThem_Click(object sender, EventArgs e)
        {
            lbThongbao2.Visible = false;
            if (BUS_PhieuMuon.CheckExist("DOCGIA", txtMaDocGia.Text) == true && BUS_PhieuMuon.CheckExist("SACH", txtMaSach.Text) == true)
            {
                PhieuMuon _pM = new PhieuMuon();

                Random rdm = new Random();
                _pM.MaPhieu = rdm.Next(0, 1000).ToString();

                _pM.MaDocGia = txtMaDocGia.Text;
                _pM.MaSach   = txtMaSach.Text;

                if (dateMuon.Text == "")
                {
                    _pM.NgayMuon = DateTime.Now;
                }
                else
                {
                    _pM.NgayMuon = dateMuon.Value.Date;
                }
                if (dateTra.Text == "")
                {
                    _pM.NgayPhaiTra = DateTime.Now;
                }
                else
                {
                    _pM.NgayPhaiTra = dateTra.Value.Date;
                }

                int check = BUS_PhieuMuon.Them(_pM);
                if (check == -1)
                {
                    lbThongbao3.Visible = true;
                }
                else
                {
                    US_PhieuMuon_Load(sender, e);
                }
            }
            else
            {
                lbThongbao2.Visible    = false;
                labelThongbao1.Visible = true;
                lbThongbao3.Visible    = false;
            }
        }
        private void btnThem_Click(object sender, EventArgs e)
        {
            lb_exist.Visible = false;
            if (pmBUS.CheckExist("DOCGIA", txt_MDG.Text) == true && pmBUS.CheckExist("SACH", txt_MS.Text) == true)
            {
                PhieuMuon _pM = new PhieuMuon();

                Random rdm = new Random();
                _pM.MaPhieu = rdm.Next(0, 1000).ToString();

                _pM.MaDocGia = txt_MDG.Text;
                _pM.MaSach   = txt_MS.Text;

                if (d_NM.Text == "")
                {
                    _pM.NgayMuon = DateTime.Now;
                }
                else
                {
                    _pM.NgayMuon = d_NM.DateTime;
                }
                if (d_NPT.Text == "")
                {
                    _pM.NgayPhaiTra = DateTime.Now;
                }
                else
                {
                    _pM.NgayPhaiTra = d_NM.DateTime;
                }

                int check = pmBUS.Them(_pM);
                if (check == -1)
                {
                    lb_Trung.Visible = true;
                }
                else
                {
                    ucFrmQLPhieuMuon_Load(sender, e);
                }
            }
            else
            {
                lb_ChuaNhap.Visible = false;
                lb_exist.Visible    = true;
                lb_Trung.Visible    = false;
            }
        }
        private void btnSua_Click(object sender, EventArgs e)
        {
            if (txtMa.Text != "")
            {
                if (BUS_PhieuMuon.CheckExist("DOCGIA", txtMaDocGia.Text) == true && BUS_PhieuMuon.CheckExist("SACH", txtMaSach.Text) == true)
                {
                    PhieuMuon _pM = new PhieuMuon();
                    _pM.MaDocGia = txtMaDocGia.Text;
                    _pM.MaSach   = txtMaSach.Text;
                    _pM.MaPhieu  = txtMa.Text;

                    if (dateMuon.Text == "")
                    {
                        _pM.NgayMuon = DateTime.Now;
                    }
                    else
                    {
                        _pM.NgayMuon = dateMuon.Value.Date;
                    }
                    if (dateTra.Text == "")
                    {
                        _pM.NgayPhaiTra = DateTime.Now;
                    }
                    else
                    {
                        _pM.NgayPhaiTra = dateTra.Value.Date;
                    }

                    BUS_PhieuMuon.Sua(_pM);
                    US_PhieuMuon_Load(sender, e);
                }
                else
                {
                    lbThongbao2.Visible = true;
                }
            }
        }
        private void btnSua_Click(object sender, EventArgs e)
        {
            if (txt_MP.Text != "")
            {
                if (pmBUS.CheckExist("DOCGIA", txt_MDG.Text) == true && pmBUS.CheckExist("SACH", txt_MS.Text) == true)
                {
                    PhieuMuon _pM = new PhieuMuon();
                    _pM.MaDocGia = txt_MDG.Text;
                    _pM.MaSach   = txt_MS.Text;
                    _pM.MaPhieu  = txt_MP.Text;

                    if (d_NM.Text == "")
                    {
                        _pM.NgayMuon = DateTime.Now;
                    }
                    else
                    {
                        _pM.NgayMuon = d_NM.DateTime;
                    }
                    if (d_NPT.Text == "")
                    {
                        _pM.NgayPhaiTra = DateTime.Now;
                    }
                    else
                    {
                        _pM.NgayPhaiTra = d_NM.DateTime;
                    }

                    pmBUS.Sua(_pM);
                    ucFrmQLPhieuMuon_Load(sender, e);
                }
                else
                {
                    lb_exist.Visible = true;
                }
            }
        }