private void btnThem_Click(object sender, EventArgs e)
        {
            string ten       = txtTen.Text;
            string khoa      = txtKhoa.Text;
            int    hsl       = Convert.ToInt32(txtHSL.Text);
            int    sotietday = Convert.ToInt32(txtSoTietDay.Text);
            int    td;
            float  tl;
            int    loai;
            int    phucap = Convert.ToInt32(txtPhuCap.Text);

            if (cbLoai.SelectedIndex == 0)
            {
                loai = 1;
                string selectedComboBoxString = cbGV.SelectedItem.ToString();
                td = convertTrinhDo(selectedComboBoxString);
                tl = hsl * 730 + phucap + sotietday * 45;
            }
            else
            {
                loai = 0;
                string selectedComboBoxString = cbNV.SelectedItem.ToString();
                td = convertTrinhDo(selectedComboBoxString);
                tl = hsl * 730 + phucap + sotietday * 30;
            }


            NhanVienDTO aNV = new NhanVienDTO(ten, khoa, td, phucap, sotietday, hsl, tl, loai);

            myNhanVienBUL.ThemMotNhanVien(aNV);
            this.Hide();
            NhanVien nv = new NhanVien();

            nv.Show();
        }
Ejemplo n.º 2
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            if ("them" != act)
            {
                index = -1;
                HienThiDuLieu();
                grpThongTin.Enabled = true;
                pnInFor.Visible     = true;
                pnInFor.Enabled     = true;
                txtMaNV.Enabled     = false;
                txtChucVu.Clear();
                txtTaiKhoan.Clear();
                txtTenNV.Clear();
                cboQuyen.Text = "";
                txtMatKhau.Clear();
                txtMaNV.Text = MaTuTang();
                act          = "them";
                return;
            }


            NhanVienDTO  aNV    = new NhanVienDTO(txtMaNV.Text, txtTenNV.Text, txtChucVu.Text, txtTaiKhoan.Text, txtMatKhau.Text, cboQuyen.Text);
            DialogResult result = MessageBox.Show("Bạn chắc chắn muốn thêm ?", " ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                myNhanVienBUL.ThemMotNhanVien(aNV);
            }
            if (result == DialogResult.No)
            {
                XoaDuLieu();
            }
            HienThiDuLieu();
            XoaDuLieu();
            txtMaNV.Text = MaTuTang();
        }