Esempio n. 1
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            string         maNhaXuatBan  = txtMaNhaXuatBan.Text;
            string         tenNhaXuatBan = txtTenNhaXuatBan.Text;
            string         email         = txtEmail.Text;
            string         trangThai     = "Tồn tại";
            BEL_NhaXuatBan nhaXuatBan    = new BEL_NhaXuatBan(maNhaXuatBan, tenNhaXuatBan, email, trangThai);

            //
            try
            {
                if (BAL_NhaXuatBan.Add(nhaXuatBan))
                {
                    MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //
                    txtMaNhaXuatBan.Text = "NXB" + (BAL_NhaXuatBan.Count() + 1);
                    txtTenNhaXuatBan.Focus();
                }
                else
                {
                    MessageBox.Show("Thêm thất bại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
 private void frmThemNhaXuatBan_Load(object sender, EventArgs e)
 {
     txtMaNhaXuatBan.Text = "NXB" + (BAL_NhaXuatBan.Count() + 1);
     txtTenNhaXuatBan.Focus();
 }
Esempio n. 3
0
        private void btnThemNhaXuatBan_Click(object sender, EventArgs e)
        {
            frmThemNhaXuatBan frmThemNhaXuatBan = new frmThemNhaXuatBan();

            frmThemNhaXuatBan.ShowDialog();
            //
            loadDanhSachNhaXuatBan(dgvDanhSachNhaXuatBan, BAL_NhaXuatBan.Load());
            for (int i = 0; i < dgvDanhSachNhaXuatBan.RowCount; i++)
            {
                if (dgvDanhSachNhaXuatBan["MaNhaXuatBan", i].Value.ToString() == ("NXB" + BAL_NhaXuatBan.Count()))
                {
                    dgvDanhSachNhaXuatBan["MaNhaXuatBan", i].Selected = true;
                }
            }
        }