Esempio n. 1
0
        private void bntTiepNhan_Click(object sender, EventArgs e)
        {
            if (txtTenNV.Text == "" || txtQueQuan.Text == "")
            {
                MessageBox.Show("Please, sigh enough.Thank you!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (dtpNgaySinhNV.Value > DateTime.Now)
            {
                MessageBox.Show("Please, Check your birthday again!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                string err  = "";
                string MSNV = db.TaoMa_NhanVien("NV", 5);
                //    string GT = cboGioiTinhNV.SelectedItem.ToString();
                string BP = cboBoPhan.SelectedItem.ToString();

                string MaBoPhan = db.getMaBoPhan(BP).Tables[0].Rows[0]["MaBoPhan"].ToString();
                if (!db.insertNhanVien(ref err, MSNV, txtTenNV.Text, dtpNgaySinhNV.Value, cboGioiTinhNV.SelectedItem.ToString(), txtQueQuan.Text, MaBoPhan, dtpNgayTiepNhanNV.Value))
                {
                    MessageBox.Show(err);
                }
                else
                {
                    MessageBox.Show("Added", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }