示例#1
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            int crrGioiTinh = 0;

            if (rdbNam.Checked == true && rdbNu.Checked == false)
            {
                crrGioiTinh = 1;
            }
            int ret = nvc.Edit(new NhanVien()
            {
                MaNV        = int.Parse(txtMaNV.Text),
                Ten         = txtTen.Text,
                Ngaysinh    = dtpNgaySinh.Value,
                Gioitinh    = crrGioiTinh,
                Anh         = pic,
                Diachi      = txtDiaChi.Text,
                Dantoc      = txtDanToc.Text,
                Tongiao     = txtTonGiao.Text,
                Sodienthoai = txtSDT.Text,
                Socmt       = txtCMND.Text,
                Tinhtrang   = "Tốt",
                MaPB        = checkData(cmbPhongBan.Text, lstNamePB),
                MaCV        = checkData(cmbChucVu.Text, lstNameCV),
                MaTDHV      = checkData(cmbTDHV.Text, lstNameTDHV),
                Ngoaingu    = txtNgoaiNgu.Text,
                MaHD        = int.Parse(txtMaHD.Text),
                MaSBH       = int.Parse(txtMaSBH.Text),
                MaKT        = int.Parse(txtMaKT.Text),
                MaKL        = int.Parse(txtMaKL.Text),
                MaL         = int.Parse(txtHSL.Text),
                Ghichu      = rtbGhiChu.Text
            });

            if (ret == 1)
            {
                MessageBox.Show("Sửa nhân viên thành công!", "Success!");
                this.Close();
            }
            else
            {
                MessageBox.Show("Sửa không thành công.Xin kiểm tra lại!", "Failed!");
            }
        }