Example #1
0
        private void button8_Click(object sender, EventArgs e)
        {
            //hien thi len textbox
            try
            {
                //Mang gia tri
                string[] param = obj_phieu.layThongTinPhieu2(txtMaPhieu.Text);

                if (txtMaPhieu.Text == "")
                {
                    MessageBox.Show("Mã phiếu không được để trống");
                    return;
                }

                Regex reg = new Regex(@"^[P]\d{2,4}$");
                if (!reg.IsMatch(txtMaPhieu.Text))
                {
                    MessageBox.Show("Mã phiếu bắt đầu từ P theo sau là 2-4 số, ví dụ: P01");
                    return;
                }

                if (param[0] == null)
                {
                    MessageBox.Show("Không tìm thấy mã phiếu :" + txtMaPhieu.Text);
                    clearText();
                    return;
                }

                //dua len textbox
                txtMaDocGia.Text    = param[0];
                txtTenDocGia.Text   = param[1];
                dtpNgayMuon.Text    = param[2];
                txtMaNhanVien.Text  = param[3];
                txtTenNhanVien.Text = param[4];
            }
            catch {
                MessageBox.Show("Có lỗi, kiểm tra lại!");
            }

            //neu nhu chua co gi thi thong bao nhap
            DataTable dtb = obj_phieu.chiTietMuonSach(txtMaPhieu.Text);

            if (dtb.Rows.Count == 0)
            {
                MessageBox.Show("Phiếu hiện tại chưa có tài liệu mượn, hãy nhập thông tin");
                return;
            }

            //hien thi tren bang chi tiet
            try {
                loadDgv();
            }
            catch
            {
                MessageBox.Show("Có lỗi!");
            }
        }
        protected void btnTimKiemMaPhieu_Click(object sender, ImageClickEventArgs e)
        {
            PhieuMuonSachBUS obj_phieu = new PhieuMuonSachBUS();

            //hien thi len textbox
            try
            {
                //Mang gia tri
                string[] param = obj_phieu.layThongTinPhieu2(txtMaPhieu.Text);

                if (txtMaPhieu.Text == "")
                {
                    alertz("Mã phiếu không được để trống");
                    return;
                }

                Regex reg = new Regex(@"^[P]\d{2,4}$");
                if (!reg.IsMatch(txtMaPhieu.Text))
                {
                    alertz("Mã phiếu bắt đầu từ P theo sau là 2-4 số, ví dụ: P01");
                    return;
                }

                if (param[0] == null)
                {
                    alertz("Không tìm thấy mã phiếu :" + txtMaPhieu.Text);
                    clearText();
                    return;
                }

                //dua len textbox
                //drDocGia.se  = param[1];
                drDocGia.SelectedValue = param[0];
                //txtTenDocGia.Text = param[1];
                txtNgayMuon.Text         = param[2];
                drNhanVien.SelectedValue = param[3];
                //drNhanVien.Text = param[4];
                //txtTenNhanVien.Text = param[4];
            }
            catch
            {
                alertz("Có lỗi, kiểm tra lại!");
            }

            //neu nhu chua co gi thi thong bao nhap
            DataTable dtb = obj_phieu.chiTietMuonSach(txtMaPhieu.Text);

            if (dtb.Rows.Count == 0)
            {
                alertz("Phiếu hiện tại chưa có tài liệu mượn, hãy nhập thông tin");
                return;
            }

            //hien thi tren bang chi tiet
            try
            {
                loadDgv();
            }
            catch
            {
                alertz("Có lỗi!");
            }
        }