示例#1
0
        private void frmTrangQuanLy_Load(object sender, EventArgs e)
        {
            bdsLoaiNhanVien.DataSource = lnvBUS.LayDanhSach();
            bdsNhanVien.DataSource     = nvBUS.LayDanhSach();
            bdsCBOLoaiNV.DataSource    = lnvBUS.LayDanhSach();
            bdsTheLoai.DataSource      = tlBUS.LayDanhSach();
            bdsTacGia.DataSource       = tgBUS.LayDanhSach();
            bdsNhaXuatBan.DataSource   = nxbBUS.LayDanhSach();

            dvSachFilter             = sBUS.LayDanhSach().DefaultView;
            bdsSachFilter.DataSource = dvSachFilter;
            //bdsSach.DataSource = sBUS.LayDanhSach();

            dvSach             = sBUS.LayDanhSach().DefaultView;
            bdsSach.DataSource = dvSach;
            //bdsSach.DataSource = sBUS.LayDanhSach();

            bdsCBOTacGia.DataSource     = tgBUS.LayDanhSach();
            bdsCBOTheLoai.DataSource    = tlBUS.LayDanhSach();
            bdsCBONhaXuatBan.DataSource = nxbBUS.LayDanhSach();
            bdsKhachHang.DataSource     = khBUS.LayDanhSach();

            if (dgvDSLoaiNV.SelectedRows.Count > 0)
            {
                DataGridViewRow row = dgvDSLoaiNV.SelectedRows[0];
                txtMaLoaiNV.Text     = row.Cells["colMaLoaiNV_LNV"].Value.ToString();
                txtTenLoaiNV.Text    = row.Cells["colTen_LNV"].Value.ToString();
                txtGhiChuLoaiNV.Text = row.Cells["colGhiChu_LNV"].Value.ToString();
            }
            if (dgvDSNhanVien.SelectedRows.Count > 0)
            {
                DataGridViewRow row = dgvDSNhanVien.SelectedRows[0];
                txtMaNV.Text            = row.Cells["colMaNV_NV"].Value.ToString();
                cboLoaiNV.SelectedValue = row.Cells["colMaLoaiNV_NV"].Value;
                txtHoTenNV.Text         = row.Cells["colHoTen_NV"].Value.ToString();
                dtpNgaySinhNV.Value     = Convert.ToDateTime(row.Cells["colNgaySinh_NV"].Value);
                if ((bool)row.Cells["colGioiTinh_NV"].Value == true)
                {
                    radNamNV.Checked = true;
                }
                else
                {
                    radNuNV.Checked = true;
                }
                txtDiaChiNV.Text    = row.Cells["colDiaChi_NV"].Value.ToString();
                txtEmailNV.Text     = row.Cells["colEmail_NV"].Value.ToString();
                txtDienThoaiNV.Text = row.Cells["colDienThoai_NV"].Value.ToString();
                txtGhiChuNV.Text    = row.Cells["colGhiChu_NV"].Value.ToString();
            }
            if (dgvDSTheLoai.SelectedRows.Count > 0)
            {
                DataGridViewRow row = dgvDSTheLoai.SelectedRows[0];
                txtMaTheLoai.Text  = row.Cells["colMaTheLoai_TL"].Value.ToString();
                txtTenTheLoai.Text = row.Cells["colTen_TL"].Value.ToString();
                txtGhiChuTL.Text   = row.Cells["colGhiChu_TL"].Value.ToString();
            }
            if (dgvDSTacGia.SelectedRows.Count > 0)
            {
                DataGridViewRow row = dgvDSTacGia.SelectedRows[0];
                txtMaTacGia.Text    = row.Cells["colMaTacGia_TG"].Value.ToString();
                txtHoTenTG.Text     = row.Cells["colHoTen_TG"].Value.ToString();
                dtpNgaySinhTG.Value = Convert.ToDateTime(row.Cells["colNgaySinh_TG"].Value);
                if ((bool)row.Cells["colGioiTinh_TG"].Value == true)
                {
                    radNamTG.Checked = true;
                }
                else
                {
                    radNuTG.Checked = true;
                }
                txtGhiChuTG.Text = row.Cells["colGhiChu_TG"].Value.ToString();
            }
            if (dgvDSNhaXuatBan.SelectedRows.Count > 0)
            {
                DataGridViewRow row = dgvDSNhaXuatBan.SelectedRows[0];
                txtMaNXB.Text      = row.Cells["colMaNXB_NXB"].Value.ToString();
                txtTenNXB.Text     = row.Cells["colTen_NXB"].Value.ToString();
                txtWebsiteNXB.Text = row.Cells["colWebsite_NXB"].Value.ToString();
                txtEmailNXB.Text   = row.Cells["colEmail_NXB"].Value.ToString();
                txtGhiChuNXB.Text  = row.Cells["colGhiChu_NXB"].Value.ToString();
            }
            if (dgvDSSach.SelectedRows.Count > 0)
            {
                DataGridViewRow row = dgvDSSach.SelectedRows[0];
                txtMaSach.Text              = row.Cells["colMaSach_Sach"].Value.ToString();
                txtTenSach.Text             = row.Cells["colTen_Sach"].Value.ToString();
                cboTacGia.SelectedValue     = row.Cells["colMaTacGia_Sach"].Value;
                cboTheLoai.SelectedValue    = row.Cells["colMaTheLoai_Sach"].Value;
                cboNhaXuatBan.SelectedValue = row.Cells["colMaNXB_Sach"].Value;
                dtpNgayXuatBan.Value        = Convert.ToDateTime(row.Cells["colNgayXuatBan_Sach"].Value);
                txtSoLuongSach.Text         = row.Cells["colSoLuong_Sach"].Value.ToString();
                txtGiaBia.Text              = row.Cells["colGiaBia_Sach"].Value.ToString();
                txtGhiChuSach.Text          = row.Cells["colGhiChu_Sach"].Value.ToString();
            }
            if (dgvDSKhachHang.SelectedRows.Count > 0)
            {
                DataGridViewRow row = dgvDSKhachHang.SelectedRows[0];
                txtMaKH_KH.Text      = row.Cells["colMaKH_KH"].Value.ToString();
                txtHoTen_KH.Text     = row.Cells["colHoTen_KH"].Value.ToString();
                dtpNgaySInh_KH.Value = Convert.ToDateTime(row.Cells["colNgaySinh_KH"].Value);
                if ((bool)row.Cells["colGioiTinh_KH"].Value == true)
                {
                    radNam_KH.Checked = true;
                }
                else
                {
                    radNu_KH.Checked = true;
                }
                txtDiaChi_KH.Text    = row.Cells["colDiaChi_KH"].Value.ToString();
                txtEmail_KH.Text     = row.Cells["colEmail_KH"].Value.ToString();
                txtDienThoai_KH.Text = row.Cells["colDienThoai_KH"].Value.ToString();
                txtGhiChu_KH.Text    = row.Cells["colGhiChu_KH"].Value.ToString();
            }
        }
示例#2
0
        private void btnXem_Click(object sender, EventArgs e)
        {
            SachBUS   sBUS = new SachBUS();
            DataTable dt   = new DataTable();

            if (radTatCa.Checked)
            {
                frmReport f = new frmReport();
                f.TopLevel = false;
                AddControlsToPanel(f);
                dt = sBUS.LayDanhSach();
                f.rpvReport.LocalReport.ReportEmbeddedResource = "QuanLyCuaHangSach.rptDSSach.rdlc";
                f.rpvReport.LocalReport.DataSources.Add(new ReportDataSource("dsSach", dt));
                f.rpvReport.RefreshReport();
            }
            if (radTheoTheLoai.Checked)
            {
                frmReport f = new frmReport();
                f.TopLevel = false;
                AddControlsToPanel(f);
                dt = sBUS.LayDSSachTheoTheLoai((int)cboTheLoai.SelectedValue);
                f.rpvReport.LocalReport.ReportEmbeddedResource = "QuanLyCuaHangSach.rptDSSachTheoTheLoai.rdlc";
                f.rpvReport.LocalReport.DataSources.Add(new ReportDataSource("dsSach", dt));
                f.rpvReport.LocalReport.SetParameters(new ReportParameter("paTheLoai", cboTheLoai.Text, false));
                f.rpvReport.RefreshReport();
            }
            if (radTheoNXB.Checked)
            {
                frmReport f = new frmReport();
                f.TopLevel = false;
                AddControlsToPanel(f);
                dt = sBUS.LayDSSachTheoNXB((int)cboNXB.SelectedValue);
                f.rpvReport.LocalReport.ReportEmbeddedResource = "QuanLyCuaHangSach.rptDSSachTheoNXB.rdlc";
                f.rpvReport.LocalReport.DataSources.Add(new ReportDataSource("dsSach", dt));
                f.rpvReport.LocalReport.SetParameters(new ReportParameter("paNXB", cboNXB.Text, false));
                f.rpvReport.RefreshReport();
            }
            if (radNhomTheLoai.Checked)
            {
                frmReport f = new frmReport();
                f.TopLevel = false;
                AddControlsToPanel(f);
                TheLoaiBUS tlBUS = new TheLoaiBUS();
                DataTable  dtTL  = tlBUS.LayDanhSach();
                f.rpvReport.LocalReport.ReportEmbeddedResource = "QuanLyCuaHangSach.rptDSSachTheLoaiGroup.rdlc";
                f.rpvReport.LocalReport.SubreportProcessing   += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
                f.rpvReport.LocalReport.DataSources.Add(new ReportDataSource("dsSach", dtTL));
                f.rpvReport.RefreshReport();
            }
            if (radNhomNXB.Checked)
            {
                frmReport f = new frmReport();
                f.TopLevel = false;
                AddControlsToPanel(f);
                NhaXuatBanBUS nxbBUS = new NhaXuatBanBUS();
                DataTable     dtNXB  = nxbBUS.LayDanhSach();
                f.rpvReport.LocalReport.ReportEmbeddedResource = "QuanLyCuaHangSach.rptDSSachNXBGroup.rdlc";
                f.rpvReport.LocalReport.SubreportProcessing   += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
                f.rpvReport.LocalReport.DataSources.Add(new ReportDataSource("dsSach", dtNXB));
                f.rpvReport.RefreshReport();
            }
        }
示例#3
0
 private void frmSach_Load(object sender, EventArgs e)
 {
     dvSachFilter             = sBUS.LayDanhSach().DefaultView;
     bdsSach.DataSource       = dvSachFilter;
     cboTimKiem.SelectedIndex = 0;
 }