protected void RadToolBar1_ButtonClick1(object sender, RadToolBarEventArgs e) { switch (e.Item.Value) { case "Save": var maNv = _entities.HoSoNhanVien_UngVien.Where(x => x.MaNV == txtMaNV.Text).FirstOrDefault(); var emailNv = _entities.HoSoNhanVien_UngVien.Where(x => x.Email == txtEmail.Text).FirstOrDefault(); if (maNv != null) { RadWindowManager1.RadAlert("Đã tồn tại mã nhân viên này", 250, 100, "Lỗi", ""); } else { if (emailNv != null) { RadWindowManager1.RadAlert("Đã tồn tại email này", 250, 100, "Lỗi", ""); } else { HoSoNhanVien_UngVien hs = new HoSoNhanVien_UngVien(); hs.MaNV = txtMaNV.Text; hs.TenNV = txtTenNV.Text; hs.GioiTinh = Convert.ToBoolean(cboGioiTinh.SelectedValue); hs.NgaySinh = txtNgaySinh.SelectedDate; hs.NoiSinh = txtNoiSinh.Text; hs.NguyenQuan = txtNguyenQuan.Text; hs.SoCNMD = txtSoCMND.Text; hs.NgayCapCMND = txtNgayCap.SelectedDate; hs.NoiCapCMND = txtNoiCap.Text; hs.IDTinhTrangHonNhan = Convert.ToInt32(cboTTHonNhan.SelectedValue); hs.IDDanToc = Convert.ToInt32(cboDanToc.SelectedValue); hs.IDTonGiao = Convert.ToInt32(cboTonGiao.SelectedValue); hs.IDQuocTich = Convert.ToInt32(cboQuocTich.SelectedValue); hs.HoKhauThuongTru = txtHoKhau.Text; hs.DiaChiLienHe = txtDCLienHe.Text; hs.SoDiDong = txtDiDong.Text; hs.SoMayBan = txtMayBan.Text; hs.Email = txtEmail.Text; hs.SoTK = txtTaiKhoan.Text; hs.NgayVaoHK = txtNgayVaoHK.SelectedDate; hs.NgayBienChe = txtNgayBienChe.SelectedDate; hs.AnhCaNhan = imgdata; hs.LaNhanVien = true; hs.DuocDangNhap = true; hs.NgayTao = hs.NgayCapNhat = DateTime.Now; hs.NguoiCapNhat = hs.NguoiTao = idUser; hs.isVisible = true; //hs.LaNhanVien = ; //hs.DuocDangNhap = ; _entities.AddToHoSoNhanVien_UngVien(hs); try { _entities.SaveChanges(); Session["idNV"] = hs.IDNhanVien; imgdata = null; Response.Redirect("ThemHopDong.aspx?mode=new"); } catch (Exception ex) { throw ex; } } } break; case "Reset": AnhNV.ImageUrl = "../Images/Staff.png"; break; } }