Пример #1
0
        public QuanLySach(DauSachViewModel dausach)
        {
            _context = new ThuVienDbContext();

            InitializeComponent();
            DauSachID              = dausach.ID;
            label_name.Text        = dausach.Ten;
            label_category.Text    = dausach.TheLoai;
            label_author.Text      = dausach.TacGia;
            label_producer.Text    = dausach.NhaSanXuat;
            label_republish.Text   = dausach.TaiBan.ToString();
            label_sumnumber.Text   = dausach.SoLuongTong.ToString();
            label_numberexist.Text = dausach.SoLuongTon.ToString();
            label_state.Text       = dausach.TinhTrang.ToString();

            label_dausach.Text = dausach.Ten;

            //combobox tinh trang
            List <ComboboxItem> list_states = new List <ComboboxItem> {
            };

            item       = new ComboboxItem();
            item.Text  = "Sách đã thanh lý";
            item.Value = (byte)ConstantHandler.TinhTrang_CuonSach.SachThanhLy;
            list_states.Add(item);

            item       = new ComboboxItem();
            item.Text  = "Sách đã được mượn";
            item.Value = (byte)ConstantHandler.TinhTrang_CuonSach.SachDaMuon;
            list_states.Add(item);

            item       = new ComboboxItem();
            item.Text  = "Sách còn trong kho";
            item.Value = (byte)ConstantHandler.TinhTrang_CuonSach.SachTrongKho;
            list_states.Add(item);

            item       = new ComboboxItem();
            item.Text  = "Sách đang chờ bảo dưỡng";
            item.Value = (byte)ConstantHandler.TinhTrang_CuonSach.SachBaoDuong;
            list_states.Add(item);

            cbb_state.DataSource    = list_states;
            cbb_state.DisplayMember = "Text";
            cbb_state.ValueMember   = "Value";
        }
Пример #2
0
        private void ThongkeDauSach_Load(object sender, EventArgs e)
        {
            _context = new ThuVienDbContext();
            InitializeDataGridView(_context.ThongKeDauSach.ToList().Select(i => new ThongKeDauSachViewModel(i)).ToList());



            var list_books = _context.DauSach.ToList().Select(i => new DauSachViewModel()
            {
                ID = i.ID, Ten = i.Ten
            }).ToList();

            //important
            cbb_dausachs.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            cbb_dausachs.AutoCompleteSource = AutoCompleteSource.ListItems;
            cbb_dausachs.DataSource         = list_books;
            cbb_dausachs.DisplayMember      = "Ten";
            cbb_dausachs.ValueMember        = "ID";
        }
Пример #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            _context = new ThuVienDbContext();
            InitializeDataGridView(_context.DauSach.ToList().Where(i => i.TT_Xoa.Equals(0)).Select(i => new DauSachViewModel(i)).ToList());

            List <ComboboxItem> list_cbb = new List <ComboboxItem> {
            };

            list_cbb = new List <ComboboxItem> {
            };
            for (int i = 1; i < dataGridView1.ColumnCount; i++)
            {
                item       = new ComboboxItem();
                item.Text  = dataGridView1.Columns[i].DataPropertyName;
                item.Value = (byte)i;
                list_cbb.Add(item);
            }

            cbb_column.DataSource    = list_cbb;
            cbb_column.DisplayMember = "Text";
            cbb_column.ValueMember   = "Value";
        }
Пример #4
0
        private void ThemDauSach_Load(object sender, EventArgs e)
        {
            _context = new ThuVienDbContext();

            var list_category = _context.TheLoai.ToList().Select(i => new TheLoai(i)).ToList();

            cbb_category.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            cbb_category.AutoCompleteSource = AutoCompleteSource.ListItems;
            cbb_category.DataSource         = list_category;
            cbb_category.DisplayMember      = "Ten";
            cbb_category.ValueMember        = "ID";


            var list_author = _context.TacGia.ToList().Select(i => new TacGia(i)).ToList();

            cbb_author.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            cbb_author.AutoCompleteSource = AutoCompleteSource.ListItems;
            cbb_author.DataSource         = list_author;
            cbb_author.DisplayMember      = "Ten";
            cbb_author.ValueMember        = "ID";

            var list_producer = _context.NhaSanXuat.ToList().Select(i => new NhaSanXuat(i)).ToList();

            cbb_producer.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            cbb_producer.AutoCompleteSource = AutoCompleteSource.ListItems;
            cbb_producer.DataSource         = list_producer;
            cbb_producer.DisplayMember      = "Ten";
            cbb_producer.ValueMember        = "ID";

            //must to fix
            cbb_state.DisplayMember = "Text";
            cbb_state.ValueMember   = "Value";
            cbb_state.Items.Add(new { Text = "Đăng kí Photo", Value = ConstantHandler.TinhTrang_DauSach.DangKiPhoto });
            cbb_state.Items.Add(new { Text = "Đọc tại chổ", Value = ConstantHandler.TinhTrang_DauSach.DocTaiCho });
            cbb_state.Items.Add(new { Text = "Mượn về nhà", Value = ConstantHandler.TinhTrang_DauSach.MuonVeNha });
            cbb_state.SelectedIndex = 0;
        }
Пример #5
0
        public SuaDauSach(DauSachViewModel dausach)
        {
            InitializeComponent();
            _context = new ThuVienDbContext();

            // TODO: Complete member initialization
            //textbox
            id                   = dausach.ID;
            txt_name.Text        = dausach.Ten;
            txt_republish.Text   = dausach.TaiBan.ToString();
            txt_summary.Text     = dausach.TomTat;
            label_sumnumber.Text = dausach.SoLuongTong.ToString();


            //combobox
            var list_category = _context.TheLoai.ToList().Select(i => new TheLoai(i)).ToList();

            cbb_category.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            cbb_category.AutoCompleteSource = AutoCompleteSource.ListItems;
            cbb_category.DataSource         = list_category;
            cbb_category.DisplayMember      = "Ten";
            cbb_category.ValueMember        = "ID";
            cbb_category.SelectedValue      = dausach.TheLoaiID;


            var list_author = _context.TacGia.ToList().Select(i => new TacGia(i)).ToList();

            cbb_author.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            cbb_author.AutoCompleteSource = AutoCompleteSource.ListItems;
            cbb_author.DataSource         = list_author;
            cbb_author.DisplayMember      = "Ten";
            cbb_author.ValueMember        = "ID";
            cbb_author.SelectedValue      = dausach.TacGiaID;

            var list_producer = _context.NhaSanXuat.ToList().Select(i => new NhaSanXuat(i)).ToList();

            cbb_producer.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            cbb_producer.AutoCompleteSource = AutoCompleteSource.ListItems;
            cbb_producer.DataSource         = list_producer;
            cbb_producer.DisplayMember      = "Ten";
            cbb_producer.ValueMember        = "ID";
            cbb_producer.SelectedValue      = dausach.NhaSanXuatID;

            //combobox tinh trang
            List <ComboboxItem> list_states = new List <ComboboxItem> {
            };

            item       = new ComboboxItem();
            item.Text  = "Đăng kí Photo";
            item.Value = (byte)ConstantHandler.TinhTrang_DauSach.DangKiPhoto;
            list_states.Add(item);

            item       = new ComboboxItem();
            item.Text  = "Đọc tại chổ";
            item.Value = (byte)ConstantHandler.TinhTrang_DauSach.DocTaiCho;
            list_states.Add(item);

            item       = new ComboboxItem();
            item.Text  = "Mượn về nhà";
            item.Value = (byte)ConstantHandler.TinhTrang_DauSach.MuonVeNha;
            list_states.Add(item);

            cbb_state.DataSource    = list_states;
            cbb_state.DisplayMember = "Text";
            cbb_state.ValueMember   = "Value";
            cbb_state.SelectedValue = dausach.TinhTrangID;
        }
Пример #6
0
 private void QuanLySach_Load(object sender, EventArgs e)
 {
     // TODO: Complete member initialization
     _context = new ThuVienDbContext();
     InitializeDataGridView(_context.CuonSach.Where(i => i.DauSachID.Equals(DauSachID)).ToList().Select(i => new CuonSachViewModel(i)).ToList());
 }
Пример #7
0
        private void QuanLyDocGia_Load(object sender, EventArgs e)
        {
            dateTimePickerfrom.Visible = false;
            dateTimePickerto.Visible   = false;

            _context = new ThuVienDbContext();
            InitializeDataGridView(_context.DocGia.Where(i => i.TinhTrang == 0 || i.TinhTrang == 1).ToList().Select(i => new DocGiaViewModel(i)).ToList());

            //combobox category
            List <ComboboxItem> list_cbb = new List <ComboboxItem> {
            };

            item       = new ComboboxItem();
            item.Text  = "Sinh Viên";
            item.Value = (byte)ConstantHandler.Loai_DocGia.SinhVien;
            list_cbb.Add(item);

            item       = new ComboboxItem();
            item.Text  = "Giáo Viên";
            item.Value = (byte)ConstantHandler.Loai_DocGia.GiaoVien;
            list_cbb.Add(item);

            cbb_category.DataSource    = list_cbb;
            cbb_category.DisplayMember = "Text";
            cbb_category.ValueMember   = "Value";


            //combobox category
            list_cbb   = new List <ComboboxItem> {
            };
            item       = new ComboboxItem();
            item.Text  = "Khóa";
            item.Value = (byte)ConstantHandler.TinhTrang_DocGia.Khoa;
            list_cbb.Add(item);

            item       = new ComboboxItem();
            item.Text  = "Đang sử dụng";
            item.Value = (byte)ConstantHandler.TinhTrang_DocGia.Dangsudung;
            list_cbb.Add(item);

            cbb_state.DataSource    = list_cbb;
            cbb_state.DisplayMember = "Text";
            cbb_state.ValueMember   = "Value";


            var path = Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()));
            int d    = path.LastIndexOf("\\");

            path = path.Substring(0, d);

            pictureBox.Image    = new Bitmap(path + @"\\Thu_Vien_MVC\\Content\\Image\\no-avatar.png");
            pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;

            list_cbb = new List <ComboboxItem> {
            };
            for (int i = 1; i < dataGridView1.ColumnCount; i++)
            {
                item       = new ComboboxItem();
                item.Text  = dataGridView1.Columns[i].DataPropertyName;
                item.Value = (byte)i;
                list_cbb.Add(item);
            }

            cbb_column.DataSource    = list_cbb;
            cbb_column.DisplayMember = "Text";
            cbb_column.ValueMember   = "Value";
        }