Esempio n. 1
0
        public void HienThi_NXB()
        {
            var nxb = new NhaXuatBanController();

            l = nxb.Detail();
            listView_NXB.Items.Clear();
            int i = 1;

            foreach (nhaxuatban row in l)
            {
                ListViewItem item = new ListViewItem();
                item.Text = "" + i++;
                item.SubItems.Add(row.manxb.ToString());
                item.SubItems.Add(row.tennxb.ToString());
                item.SubItems.Add(row.diachi.ToString());
                item.SubItems.Add(row.sdt.ToString());
                listView_NXB.Items.Add(item);
            }
            if (PhanQuyen.quyen == 1)
            {
                btn_enable(false);
            }
            else
            {
                group_NXB.Enabled = false;
                Them_NXB.Enabled  = Xoa_NXB.Enabled = Sua_NXB.Enabled = Luu_NXB.Enabled = Boqua_NXB.Enabled = false;
                Thoat_NXB.Enabled = true;
            }
        }
Esempio n. 2
0
        void HienThiSach()
        {
            var s = new SachController();

            l = s.Detail();
            lvSach.Items.Clear();

            var i = 1;

            var nxb = new NhaXuatBanController();
            List <nhaxuatban> listNXB = nxb.Detail();

            cbbNXB.DataSource    = listNXB;
            cbbNXB.DisplayMember = "tennxb";
            cbbNXB.ValueMember   = "manxb".ToString();

            txtMaSach.Text  = l[0].masach.ToString();
            txtTenSach.Text = l[0].tensach.ToString();
            txtTacGia.Text  = l[0].tentacgia.ToString();
            if (l[0].nhaxuatban != null)
            {
                cbbNXB.Text = l[0].nhaxuatban.tennxb.ToString();
            }
            else
            {
                cbbNXB.Text = "";
            }
            txtNamXB.Text   = l[0].namxb.ToString();
            txtSoTrang.Text = l[0].sotrang.ToString();
            txtGiaTien.Text = l[0].giatien.ToString();
            txtSoLuong.Text = l[0].soluong.ToString();
            txtNgonNgu.Text = l[0].ngonngu.ToString();
            txtTheLoai.Text = l[0].theloai.ToString();
            foreach (sach row in l)
            {
                ListViewItem item = new ListViewItem();
                item.Text = "" + i++;

                item.SubItems.Add(row.masach.ToString());
                item.SubItems.Add(row.tensach.ToString());
                item.SubItems.Add(row.theloai.ToString());
                item.SubItems.Add(row.ngonngu.ToString());
                item.SubItems.Add(row.soluong.ToString());

                lvSach.Items.Add(item);
            }
            if (PhanQuyen.quyen == 1)
            {
                btn_edit(false);
            }
            else
            {
                grpEdit.Enabled     = false;
                btnThemSach.Enabled = btnSuaSach.Enabled = btnXoaSach.Enabled = btnLuuSach.Enabled = btnBoQua.Enabled = false;
                btnThoat.Enabled    = true;
            }
        }
Esempio n. 3
0
        private void Xoa_NXB_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Bạn có muốn xóa?", "delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

            if (result == DialogResult.Yes)
            {
                int id     = Convert.ToInt32(manxbtxt.Text);
                var entity = new NhaXuatBanController();
                if (entity.Delete(id))
                {
                    HienThi_NXB();
                }
                else
                {
                    MessageBox.Show("Không xóa được");
                }
            }
        }
Esempio n. 4
0
        private void Luu_NXB_Click(object sender, EventArgs e)
        {
            if (Them_bool == true && Sua_bool == false)
            {
                var nxb = new nhaxuatban();
                nxb.tennxb = tennxbtxt.Text;
                nxb.diachi = diachinxbtxt.Text;
                nxb.sdt    = sdtnxbtxt.Text;

                var entity = new NhaXuatBanController();
                if (entity.Add(nxb) > 0)
                {
                    HienThi_NXB();
                }
                else
                {
                    MessageBox.Show("Thêm không thành công");
                }
            }
            if (Them_bool == false && Sua_bool == true)
            {
                var nxb = new nhaxuatban();
                nxb.tennxb = tennxbtxt.Text;
                nxb.diachi = diachinxbtxt.Text;
                nxb.sdt    = sdtnxbtxt.Text;

                var entity = new NhaXuatBanController();
                if (entity.Edit(nxb))
                {
                    HienThi_NXB();
                }
                else
                {
                    MessageBox.Show("Sửa không thành công");
                }
            }
            btn_enable(false);
        }