private void gridControl2_Click(object sender, EventArgs e) { txtMaHD.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaHD").ToString(); cboMaGoiHD.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaGoiHD").ToString(); cboMaChuKy.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaChuKy").ToString(); txtMaNV.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaNV").ToString(); cboMaKH.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaKHChinh").ToString(); string ngayhieuluc = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NgayHieuLuc").ToString(); DateTime ngaysinhnhat = DateTime.Parse(ngayhieuluc); dtmNgayHieuLuc.DateTime = ngaysinhnhat; txtMucPhi.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GoiHopDong.MucPhi").ToString(); txtGiaTriBaoHiem.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GoiHopDong.GiaTriBaoHiem").ToString(); txtThoiHanBaoHiem.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GoiHopDong.ThoiHanBaoHiem").ToString(); //txtThoiHanDongPhi.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GoiHopDong.ThoiHanDongPhi").ToString(); NhanvienDao nvdao = new NhanvienDao(); if (nvdao.getchucvutunhanvien(manvhientai) == "QL" || nvdao.getchucvutunhanvien(manvhientai) == "TP") { btnSua.Visible = false; btnHuy.Visible = false; } else { btnSua.Visible = true; btnHuy.Visible = true; } }
private void dgvKhachHang_Click(object sender, EventArgs e) { try { NhanvienDao nvdao = new NhanvienDao(); if (nvdao.getchucvutunhanvien(manvhientai) == "QL" || nvdao.getchucvutunhanvien(manvhientai) == "TP") { btnLuu.Visible = false; btnHuy.Visible = false; } else { enabletextbox(); btnLuu.Visible = true; btnHuy.Visible = true; } if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GioiTinh").Equals(true)) { cboGioiTinh.Text = "Nam"; } else { cboGioiTinh.Text = "Nữ"; } txtDiaChi.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DiaChi").ToString(); txtMaKH.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaKH").ToString(); txtTenKH.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TenKH").ToString(); cboTenCD.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "CapDo.TenCD").ToString(); txtCMND.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "CMND").ToString(); txtSdt.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Sdt").ToString(); var ngaysinh = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NgaySinh").ToString(); DateTime dateTime = DateTime.Parse(ngaysinh); dtmNgaySinh.Text = dateTime.ToString("dd/MM/yyyy"); KhachHangDao kh = new KhachHangDao(); var result = kh.getKH(txtMaKH.Text); if (result.HinhAnh != null) { MemoryStream ms = new MemoryStream(result.HinhAnh); imagebox.Image = Image.FromStream(ms); ima = result.HinhAnh; } else { imagebox.Image = null; } } catch (Exception ex) { XtraMessageBox.Show("Đã Có Lỗi Xảy Ra", "Thông Báo"); } }
public void checkxemaidangsudung(string manvhientai2) { NhanvienDao nvdao = new NhanvienDao(); if (nvdao.getchucvutunhanvien(manvhientai) == "QL" || nvdao.getchucvutunhanvien(manvhientai) == "TP") { btnThemKH.Enabled = false; btnUpdate.Enabled = false; btnXoa.Enabled = false; btnExport.Enabled = true; settextboxchoadminvatruongphong(); } }
public void ImportNV(string tennv, string email, string sdt, string gioitinh, string diachi, DateTime ngaysinh) { NhanvienDao nvdao = new NhanvienDao(); NhanVien nv = new NhanVien(); nv.MaNV = nvdao.getlastnhanvien(); if (nvdao.getchucvutunhanvien(manvhientai) == "QL") { nv.MaCV = "TP"; } else { nv.MaCV = "NV"; } nv.TenNV = tennv; nv.Email = email; nv.Sdt = sdt; bool gioitinhbool = true; if (gioitinh == "Nữ") { gioitinhbool = false; } nv.GioiTinh = gioitinhbool; nv.DiaChi = diachi; nv.MaNVQuanLi = manvhientai; nv.MatKhau = MahoaMD5.getMd5Hash("123456"); nv.NgaySinh = ngaysinh; nv.Status = true; db.NhanViens.Add(nv); db.SaveChanges(); }
public void loaddatabase() { HopDongDao hd = new HopDongDao(); NhanvienDao nvd = new NhanvienDao(); hopDongsBindingSource.DataSource = hd.loadtheoyeucau(nvd.getchucvutunhanvien(manvhientai), manvhientai); }
private void btnXoa_Click(object sender, EventArgs e) { if (txtMaHD.Text == "") { XtraMessageBox.Show("Bạn chưa chọn dòng!!"); } else { DialogResult dialogResult = XtraMessageBox.Show("Xác nhận", "Bạn thực sự muốn xóa?", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { HopDongDao hd = new HopDongDao(); NhanvienDao nvd = new NhanvienDao(); hd.XoaHD(txtMaHD.Text); XtraMessageBox.Show("Đã xóa thành công!!"); hopDongsBindingSource.DataSource = hd.loadtheoyeucau(nvd.getchucvutunhanvien(manvhientai), manvhientai); reset(); } } }
public void thembangtuongung(string manv) { NhanvienDao nvdao = new NhanvienDao(); string macv = nvdao.getchucvutunhanvien(manv); if (macv == "QL") { cboTenBang.Properties.Items.Add("Nhân viên"); } else { if (macv == "TP") { cboTenBang.Properties.Items.Add("Nhân viên"); } else { cboTenBang.Properties.Items.Add("Khách hàng"); cboTenBang.Properties.Items.Add("Hợp đồng"); } } }
private void btnSua_Click(object sender, EventArgs e) { try { if (txtMaHD.Text == "" || cboMaGoiHD.Text == "" || cboMaChuKy.Text == "" || cboMaKH.Text == "" || txtMaNV.Text == "" || dtmNgayHieuLuc.Text == "") { XtraMessageBox.Show("Điền Đầy Đủ Thông Tin", "Thông báo"); } else { HopDongDao hd = new HopDongDao(); NhanvienDao nvd = new NhanvienDao(); hd.SuaHD(txtMaHD.Text, cboMaGoiHD.Text, cboMaChuKy.Text, txtMaNV.Text, cboMaKH.Text, dtmNgayHieuLuc.DateTime); XtraMessageBox.Show("Sửa thành công", "Thông báo"); hopDongsBindingSource.DataSource = hd.loadtheoyeucau(nvd.getchucvutunhanvien(manvhientai), manvhientai); txtGiaTriBaoHiem.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GoiHopDong.GiaTriBaoHiem").ToString(); } } catch (Exception ex) { XtraMessageBox.Show("Có lỗi xảy ra", "Thông báo"); } }
private void gridControl2_Click(object sender, EventArgs e) { if (gridView1.RowCount > 0) { if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaHD") == null) { txtMaHD.Text = ""; } else { txtMaHD.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaHD").ToString(); } if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaGoiHD") == null) { cboMaGoiHD.Text = ""; } else { cboMaGoiHD.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaGoiHD").ToString(); } if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaChuKy") == null) { cboMaChuKy.Text = ""; } else { cboMaChuKy.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaChuKy").ToString(); } if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaNV") == null) { txtMaNV.Text = ""; } else { txtMaNV.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaNV").ToString(); } if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaKHChinh") == null) { cboMaKH.Text = ""; } else { cboMaKH.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaKHChinh").ToString(); } if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NgayHieuLuc") == null) { dtmNgayHieuLuc.Text = ""; } else { string ngayhieuluc = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NgayHieuLuc").ToString(); DateTime ngaysinhnhat = DateTime.Parse(ngayhieuluc); dtmNgayHieuLuc.DateTime = ngaysinhnhat; } if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GoiHopDong.MucPhi") == null) { txtMucPhi.Text = ""; } else { txtMucPhi.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GoiHopDong.MucPhi").ToString(); } if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GoiHopDong.GiaTriBaoHiem") == null) { txtGiaTriBaoHiem.Text = ""; } else { txtGiaTriBaoHiem.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GoiHopDong.GiaTriBaoHiem").ToString(); } if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GoiHopDong.ThoiHanBaoHiem") == null) { txtThoiHanBaoHiem.Text = ""; } else { txtThoiHanBaoHiem.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GoiHopDong.ThoiHanBaoHiem").ToString(); } NhanvienDao nvdao = new NhanvienDao(); if (nvdao.getchucvutunhanvien(manvhientai) == "QL" || nvdao.getchucvutunhanvien(manvhientai) == "TP" || gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MaHD") == null) { btnSua.Visible = false; btnHuy.Visible = false; } else { dtmNgayHieuLuc.Enabled = true; cboMaChuKy.Enabled = true; cboMaGoiHD.Enabled = true; cboMaKH.Enabled = true; btnSua.Visible = true; btnHuy.Visible = true; } } else { XtraMessageBox.Show("Không có gì để hiện thị!!!"); } }