Exemplo n.º 1
0
        private void frmQuanLySach_Load(object sender, EventArgs e)
        {
            cmbTenTG.DataSource    = TacGiaBUS.GetList();
            cmbTenTG.DisplayMember = "TenTG";
            cmbTenTG.ValueMember   = "MaTG";

            comboBox4.DataSource    = NhaXuatBanBUS.GetList();
            comboBox4.DisplayMember = "TenNXB";
            comboBox4.ValueMember   = "MaNXB";

            cmbLoaiSach.DataSource    = TheLoaiBUS.GetList();
            cmbLoaiSach.DisplayMember = "TenTheLoai";
            cmbLoaiSach.ValueMember   = "MaLoai";

            cmbNgonNgu.DataSource    = NgonNguBUS.GetList();
            cmbNgonNgu.DisplayMember = "TenNgonNgu";
            cmbNgonNgu.ValueMember   = "MaNgonNgu";

            tbxTenSach.Text  = "";
            textBox2.Text    = "";
            cmbNgonNgu.Text  = "";
            cmbLoaiSach.Text = "";
            cmbTenTG.Text    = "";
            comboBox4.Text   = "";
        }
        void LoadData()
        {
            List <NhaXuatBan> nhaXuatBan    = new List <NhaXuatBan>();
            NhaXuatBanBUS     busNhaXuatBan = new NhaXuatBanBUS();

            nhaXuatBan = busNhaXuatBan.GetList();

            dataGrid.Items.Clear();

            id = 1;
            foreach (NhaXuatBan i in nhaXuatBan)
            {
                ThongTinNhaXuatBan thongTinNhaXuatBan = new ThongTinNhaXuatBan();
                thongTinNhaXuatBan.MaNhaXuatBan  = i.MaNXB;
                thongTinNhaXuatBan.TenNhaXuatBan = i.TenNXB;
                thongTinNhaXuatBan.DiaChi        = i.DiaChiNXB;
                thongTinNhaXuatBan.SoDienThoai   = i.SoDienThoai;

                dataGrid.IsReadOnly = true;
                dataGrid.Items.Add(thongTinNhaXuatBan);

                if (id < int.Parse(i.MaNXB))
                {
                    id = int.Parse(i.MaNXB);
                }
            }
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            List <Sach> _sach    = new List <Sach>();
            SachBUS     _busSach = new SachBUS();

            dataGrid.Items.Clear();

            _sach = _busSach.GetList();

            List <TacGia> _tacGia    = new List <TacGia>();
            TacGiaBUS     _busTacGia = new TacGiaBUS();

            _tacGia = _busTacGia.GetList();

            List <NhaXuatBan> _nhaXuatBan    = new List <NhaXuatBan>();
            NhaXuatBanBUS     _busNhaXuatBan = new NhaXuatBanBUS();

            _nhaXuatBan = _busNhaXuatBan.GetList();

            List <TheLoai> _theLoai    = new List <TheLoai>();
            TheLoaiBUS     _busTheLoai = new TheLoaiBUS();

            _theLoai = _busTheLoai.GetList();

            foreach (Sach i in _sach)
            {
                ThongTinSach _thongTinSach = new ThongTinSach();
                _thongTinSach.MaSach     = i.MaSach;
                _thongTinSach.TenSach    = i.TenSach;
                _thongTinSach.TheLoai    = LayTenTheLoai(_theLoai, i.TheLoai);
                _thongTinSach.TacGia     = LayTenTacGia(_tacGia, i.TacGia);
                _thongTinSach.NhaXuatBan = LayTenNhaXuatBan(_nhaXuatBan, i.NhaXuatBan);
                _thongTinSach.NamXuatBan = i.NamXuatBan;
                _thongTinSach.GiaBan     = i.GiaBan.ToString();
                _thongTinSach.SoLuong    = i.SoLuong;

                dataGrid.Items.Add(_thongTinSach);
            }
        }
Exemplo n.º 4
0
        private void frmCapNhatSach_Load(object sender, EventArgs e)
        {
            try
            {
                cmbTenTG.DataSource    = TacGiaBUS.GetList();
                cmbTenTG.DisplayMember = "TenTG";
                cmbTenTG.ValueMember   = "MaTG";

                cmbNhaXuatBan.DataSource    = NhaXuatBanBUS.GetList();
                cmbNhaXuatBan.DisplayMember = "TenNXB";
                cmbNhaXuatBan.ValueMember   = "MaNXB";

                cmbLoaiSach.DataSource    = TheLoaiBUS.GetList();
                cmbLoaiSach.DisplayMember = "TenTheLoai";
                cmbLoaiSach.ValueMember   = "MaLoai";

                cmbNgonNgu.DataSource    = NgonNguBUS.GetList();
                cmbNgonNgu.DisplayMember = "TenNgonNgu";
                cmbNgonNgu.ValueMember   = "MaNgonNgu";

                int     maSach  = TimKiemSach.MaSach;
                SachBUS sachBUS = new SachBUS();
                SachDTO sachDTO = null;
                sachDTO         = sachBUS.Search_MaSach(maSach);
                tbxTenSach.Text = sachDTO.TenSach;
                txtSoTrang.Text = sachDTO.SoTrang.ToString();

                TacGiaBUS tacgiaBUS = new TacGiaBUS();
                TacGiaDTO tacgiaDTO = null;
                tacgiaDTO     = tacgiaBUS.LayTenTacGia(sachDTO.MaTacGia);
                cmbTenTG.Text = tacgiaDTO.TenTG;

                NhaXuatBanBUS nxbBUS = new NhaXuatBanBUS();
                NhaXuatBanDTO nxbDTO = null;
                nxbDTO             = nxbBUS.LayTenNhaXuatBan(sachDTO.MaNXB);
                cmbNhaXuatBan.Text = nxbDTO.TenNXB;

                NgonNguBUS nnBUS = new NgonNguBUS();
                NgonNguDTO nnDTO = null;
                nnDTO           = nnBUS.LayTenNgonNgu(sachDTO.MaNgonNgu);
                cmbNgonNgu.Text = nnDTO.TenNgonNgu;

                TheLoaiBUS tlBUS = new TheLoaiBUS();
                TheLoaiDTO tlDTO = null;
                tlDTO            = tlBUS.LayTenTheLoai(sachDTO.MaTheLoai);
                cmbLoaiSach.Text = tlDTO.TenTheLoai;


                if (sachDTO.TrangThai == 0)
                {
                    cmbTinhTrang.Text = "Chưa mượn";
                }
                else
                {
                    cmbTinhTrang.Text = "Đã mượn";
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void btTim_Click(object sender, RoutedEventArgs e)
        {
            List <Sach> _sach    = new List <Sach>();
            SachBUS     _busSach = new SachBUS();

            dataGrid.Items.Clear();

            _sach = _busSach.GetList();

            string _maTheLoai = "";

            foreach (TheLoai i in _theLoai)
            {
                if (i.TenTheLoai == cbbTheLoai.Text)
                {
                    _maTheLoai = i.MaTheLoai;
                    break;
                }
            }

            List <TacGia> _tacGia    = new List <TacGia>();
            TacGiaBUS     _busTacGia = new TacGiaBUS();

            _tacGia = _busTacGia.GetList();

            List <NhaXuatBan> _nhaXuatBan    = new List <NhaXuatBan>();
            NhaXuatBanBUS     _busNhaXuatBan = new NhaXuatBanBUS();

            _nhaXuatBan = _busNhaXuatBan.GetList();

            int stt = 1;

            if (tbTenSach.Text == "")
            {
                foreach (Sach i in _sach)
                {
                    if (i.TheLoai == _maTheLoai)
                    {
                        ThongTinSach _thongTinSach = new ThongTinSach();
                        _thongTinSach.Stt        = stt++;
                        _thongTinSach.TenSach    = i.TenSach;
                        _thongTinSach.TheLoai    = cbbTheLoai.Text;
                        _thongTinSach.TacGia     = LayTenTacGia(_tacGia, i.TacGia);
                        _thongTinSach.NhaXuatBan = LayTenNhaXuatBan(_nhaXuatBan, i.NhaXuatBan);
                        _thongTinSach.NamXuatBan = i.NamXuatBan;
                        _thongTinSach.GiaBan     = i.GiaBan.ToString();
                        _thongTinSach.SoLuong    = i.SoLuong;

                        dataGrid.Items.Add(_thongTinSach);
                    }
                }
            }
            else if (tbTenSach.Text != "" && cbbTheLoai.Text != "")
            {
                foreach (Sach i in _sach)
                {
                    if (String.Compare(i.TenSach, tbTenSach.Text, true) == 0 && i.TheLoai == _maTheLoai)
                    {
                        ThongTinSach _thongTinSach = new ThongTinSach();
                        _thongTinSach.Stt        = stt++;
                        _thongTinSach.TenSach    = i.TenSach;
                        _thongTinSach.TheLoai    = cbbTheLoai.Text;
                        _thongTinSach.TacGia     = LayTenTacGia(_tacGia, i.TacGia);
                        _thongTinSach.NhaXuatBan = LayTenNhaXuatBan(_nhaXuatBan, i.NhaXuatBan);
                        _thongTinSach.NamXuatBan = i.NamXuatBan;
                        _thongTinSach.GiaBan     = i.GiaBan.ToString();
                        _thongTinSach.SoLuong    = i.SoLuong;

                        dataGrid.Items.Add(_thongTinSach);
                    }
                }
            }
            else if (tbTenSach.Text != "")
            {
                foreach (Sach i in _sach)
                {
                    if (String.Compare(i.TenSach, tbTenSach.Text, true) == 0)
                    {
                        ThongTinSach _thongTinSach = new ThongTinSach();
                        _thongTinSach.Stt        = stt++;
                        _thongTinSach.TenSach    = i.TenSach;
                        _thongTinSach.TheLoai    = LayTenTheLoai(_theLoai, i.TheLoai);
                        _thongTinSach.TacGia     = LayTenTacGia(_tacGia, i.TacGia);
                        _thongTinSach.NhaXuatBan = LayTenNhaXuatBan(_nhaXuatBan, i.NhaXuatBan);
                        _thongTinSach.NamXuatBan = i.NamXuatBan;
                        _thongTinSach.GiaBan     = i.GiaBan.ToString();
                        _thongTinSach.SoLuong    = i.SoLuong;

                        dataGrid.Items.Add(_thongTinSach);
                    }
                }
            }
        }
Exemplo n.º 6
0
 private void QuanLyNXB_Load(object sender, EventArgs e)
 {
     cmbNXB.DataSource    = NhaXuatBanBUS.GetList();
     cmbNXB.ValueMember   = "MaNXB";
     cmbNXB.DisplayMember = "TenNXB";
 }