예제 #1
0
        //ok
        private void bt_save_Click(object sender, EventArgs e)
        {
            NHANVIEN    nv    = new NHANVIEN();
            NhanVienBus nvBus = new NhanVienBus();

            nv.MANV     = Int32.Parse(txt_manv.Text);
            nv.NGAYSINH = txt_ngaysinh.Value;
            if (rd_nam.Checked == true)
            {
                nv.PHAI = "Nam";
            }
            else
            {
                nv.PHAI = "Nu";
            }
            if (!string.IsNullOrEmpty(txt_DiaChi.Text))
            {
                nv.QUEQUAN = txt_DiaChi.Text;
            }

            if (!string.IsNullOrEmpty(txt_Sdt.Text))
            {
                nv.SDT = txt_Sdt.Text;
            }
            nv.TENNV = txt_hoten.Text;
            if (!String.IsNullOrEmpty(txt_CMND.Text))
            {
                nv.CMT = txt_CMND.Text;
            }
            nv.NGAYVAOLAM = txt_ngayLam.Value;
            ChucVuBus cvbus = new ChucVuBus();

            nv.MACV = cvbus.GetCVbyName(cb_loaiNV.Text).MACV;
            try
            {
                if (!string.IsNullOrEmpty(nv.CMT) && !string.IsNullOrEmpty(nv.QUEQUAN) && !string.IsNullOrEmpty(nv.SDT) && !string.IsNullOrEmpty(nv.TENNV))
                {
                    if (nvBus.editNV(nv))
                    {
                        MessageBox.Show("Edit successted !");
                        loadDSNhanVien();
                    }

                    else
                    {
                        MessageBox.Show("Edit not successted !");
                    }
                    resettext();
                }
                else
                {
                    MessageBox.Show("Điền đầy đủ thông tin trước khi cập nhật nhân viên !");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Edit not successted !");
            }
        }