示例#1
0
        private void ButtonXoa_Click(object sender, EventArgs e)
        {
            BoPhan   bophan   = new BoPhan();
            PhongBan phongban = new PhongBan();
            Nhom     nhom     = new Nhom();

            try
            {
                string ma = Convert.ToString(txtMa.Text);
                if ((MessageBox.Show("Are You Sure You Want To Delete This BoPhan", "Delete BoPhan", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
                {
                    if (bophan.deleteBoPhan(ma))
                    {
                        MessageBox.Show("BoPhan Deleted", "Delete BoPhan", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        txtMa.Text  = null;
                        txtTen.Text = null;
                    }
                    else
                    {
                        MessageBox.Show("BoPhan Enter A Valid ID", "Delete BoPhan", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch
            {
                MessageBox.Show("Please Enter A Valid ID", "Delete BoPhan", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            getdata();
        }
示例#2
0
        private void ButtonSua_Click(object sender, EventArgs e)
        {
            BoPhan bophan = new BoPhan();
            string ma     = txtMa.Text;
            string ten    = txtTen.Text;

            if (verif())
            {
                try
                {
                    if (bophan.UpdateBoPhan(ma, ten))
                    {
                        MessageBox.Show("BoPhan Information Update", "Edit BoPhan", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Error", "Edit BoPhan", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Edit BoPhan", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("Empty Fields", "Edit BoPhan", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            getdata();
        }
示例#3
0
        private void ButtonThem_Click(object sender, EventArgs e)
        {
            BoPhan bophan = new BoPhan();
            string ma     = txtMa.Text;
            string ten    = txtTen.Text;

            if (verif() && kiemtraBoPhan(ma) && kiemtraBoPhan1(ten))
            {
                if (bophan.insertBoPhan(ma, ten))
                {
                    MessageBox.Show("New Bộ Phận Added", "Add Bộ Phận", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Error", "Add Bộ Phận", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Empty Fields", "Add Bộ Phận", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            getdata();
        }