Пример #1
0
        public void Hienthi_MS()
        {
            var ms = new MuonSachController();

            l = ms.Detail().ToList();
            listView_MS.Items.Clear();
            int i = 1;

            var           dg     = new DocGiaController();
            List <docgia> listdg = dg.Detail().ToList();

            sothecbx.DataSource    = listdg;
            sothecbx.DisplayMember = "hoten";
            sothecbx.ValueMember   = "sothe";

            var         s        = new SachController();
            List <sach> Listsach = s.Detail().ToList();

            masachcbx.DataSource    = Listsach;
            masachcbx.DisplayMember = "tensach";
            masachcbx.ValueMember   = "masach";

            var             nv     = new NhanVienController();
            List <nhanvien> Listnv = nv.Detail().ToList();

            manvcbx.DataSource    = Listnv;
            manvcbx.DisplayMember = "tennv";
            manvcbx.ValueMember   = "manv";

            foreach (MuonSach m in l)
            {
                ListViewItem item = new ListViewItem();
                item.Text = "" + i++;
                item.SubItems.Add(m.Mamuon.ToString());
                item.SubItems.Add(m.sothe.ToString());
                item.SubItems.Add(m.masach.ToString());
                item.SubItems.Add(m.soluong.ToString());
                item.SubItems.Add(m.ngaymuon.ToString());
                item.SubItems.Add(m.hantra.ToString());
                item.SubItems.Add(m.manv.ToString());

                listView_MS.Items.Add(item);
            }
            if (PhanQuyen.quyen == 1)
            {
                btn_enable(false);
            }
            else
            {
                group_MS.Enabled = false;
                Them_MS.Enabled  = Sua_MS.Enabled = Xoa_MS.Enabled = Luu_MS.Enabled = Boqua_MS.Enabled = false;
                Thoat_MS.Enabled = true;
            }
        }
Пример #2
0
        public void HienthiNV()
        {
            var nv = new NhanVienController();

            l = nv.Detail();
            listView_NV.Items.Clear();
            var i = 1;

            manvtxt.Text    = l[0].manv.ToString();
            tennvtxt.Text   = l[0].tennv.ToString();
            ngaysinhnv.Text = l[0].ngaysinh.ToString();
            if (l[0].gioitinh == null)
            {
                gioitinhtxt.Text = "";
            }
            else
            {
                gioitinhtxt.Text = l[0].gioitinh.ToString();
            }
            if (l[0].sdt == null)
            {
                sdttxt.Text = "";
            }
            else
            {
                sdttxt.Text = l[0].sdt.ToString();
            }
            if (l[0].diachi == null)
            {
                diachitxt.Text = "";
            }
            else
            {
                diachitxt.Text = l[0].diachi.ToString();
            }
            if (l[0].socmtnd == null)
            {
                socmtndtxt.Text = "";
            }
            else
            {
                socmtndtxt.Text = l[0].socmtnd.ToString();
            }
            if (l[0].quyenhan == null)
            {
                quyenhantxt.Text = "";
            }
            else
            {
                quyenhantxt.Text = l[0].quyenhan.ToString();
            }

            foreach (nhanvien row in l)
            {
                ListViewItem item = new ListViewItem();

                item.Text = "" + i++;
                item.SubItems.Add(row.manv.ToString());
                item.SubItems.Add(row.tennv.ToString());
                item.SubItems.Add(row.diachi.ToString());
                item.SubItems.Add(row.sdt.ToString());
                listView_NV.Items.Add(item);
            }
            if (PhanQuyen.quyen == 1)
            {
                btn_edit(false);
            }
            else
            {
                groupedit_NV.Enabled = false;
                ThemNV.Enabled       = SuaNV.Enabled = XoaNV.Enabled = LuuNV.Enabled = BoquaNV.Enabled = false;
                Thoat.Enabled        = true;
            }
        }