private void btn_Tim_Click(object sender, EventArgs e) { if (txt_HD_MaHoaDon.Text == String.Empty) { MessageBox.Show("Vui lòng nhập mã số hóa đơn cần thanh toán.", "", MessageBoxButtons.OK); txt_HD_MaHoaDon.Focus(); return; } int MaHoaDon = int.Parse(txt_HD_MaHoaDon.Text.Trim()); HOADON_DTO hoadonDto = new HOADON_BUS().Select(MaHoaDon); if (hoadonDto != null) { btn_LapPhieu.Enabled = true; btn_HuyBo.Enabled = true; txt_HD_NgayLap.Text = hoadonDto.NgayLap.ToShortDateString(); txt_HD_TongTien.Text = hoadonDto.TongTien.ToString(); txt_HD_SoLanTra.Text = hoadonDto.SoLanTra.ToString(); List <BIENNHAN_DTO> biennhanDtoList = new BIENNHAN_BUS().SelectAllByMaHoaDon(MaHoaDon); if (biennhanDtoList.Count != 0) { lb_CacBienNhanTruoc.Visible = true; txt_HD_SoLanDaTra.Text = biennhanDtoList.Count.ToString(); grid_CacDotDaThanhToan.Visible = true; grid_CacDotDaThanhToan.DataSource = biennhanDtoList; if (biennhanDtoList.Count == hoadonDto.SoLanTra) { txt_BN_SoTienTra.ReadOnly = true; btn_LapPhieu.Enabled = false; btn_HuyBo.Enabled = false; MessageBox.Show("Hóa đơn " + MaHoaDon.ToString() + " đã được thanh toán đầy đủ", "", MessageBoxButtons.OK); } } txt_BN_NgayTra.Text = DateTime.Today.ToShortDateString(); //Customer's Info KHACHHANG_DTO khachhangDto = new KHACHHANG_BUS().SelectByMaHoaDon(MaHoaDon); txt_KH_MaKhachHang.Text = khachhangDto.Ma.ToString(); txt_KH_TenKhachHang.Text = khachhangDto.HoTen; txt_KH_DiaChi.Text = khachhangDto.DiaChi; txt_KH_DienThoai.Text = khachhangDto.DienThoai; txt_KH_CMND.Text = khachhangDto.Cmnd; //Staff's Info NHANVIEN_DTO nhanvienDto = new NHANVIEN_BUS().SelectByMaHoaDon(MaHoaDon); txt_NV_MaNV_LapHoaDon.Text = nhanvienDto.Ma.ToString(); txt_NV_TenNhanVien.Text = nhanvienDto.HoTen; LOAINHANVIEN_DTO loainvDto = new LOAINHANVIEN_BUS().Select(nhanvienDto.MaLoaiNhanVien); txt_NV_LoaiNhanVien.Text = loainvDto.TenLoaiNhanVien; //Thong tin bien nhan txt_BN_SoTienTra.Text = hoadonDto.TienTraMoiDot.ToString(); } }
private void bt_DangNhap_Click(object sender, EventArgs e) { if (chk_TenServer.Checked) { AbstractDAO.ConnectionString = "Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=QUAN_LY_CAR_SHOP;server=" + txt_ServerName.Text; } NhanVien = null; if (txt_UserName.Text == "") { MessageBox.Show("Xin Nhập Tên Đăng Nhập", "Lỗi Dữ Liệu", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_UserName.Focus(); return; } if (txt_Password.Text == "") { MessageBox.Show("Xin Nhập Mật Khẩu", "Lỗi Dữ Liệu", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_Password.Focus(); return; } NHANVIEN_BUS BUS_NhanVien = new NHANVIEN_BUS(); NhanVien = BUS_NhanVien.SelectByUserNamePassword(txt_UserName.Text, txt_Password.Text); if (NhanVien == null) { MessageBox.Show("Đăng nhập thất bại, xin xem lại Tên Đăng Nhập & Mật Khẩu", "Lỗi Đăng Nhập", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Close(); }
public void DuaDuLieuTudgv_Combobox(int Ma) { List <NHANVIEN> dsBs = NHANVIEN_BUS.LoadNHANVIENCanTim(Ma); comboBox_MaBS.DataSource = dsBs; comboBox_MaBS.DisplayMember = "TenNV1"; comboBox_MaBS.ValueMember = "MaNV1"; }
public void TaiDuLieuVaoCombobox() { List <NHANVIEN> dsBs = NHANVIEN_BUS.LoadNHANVIENThamGiaKhamBenh(); comboBox_MaBS.DataSource = dsBs; comboBox_MaBS.DisplayMember = "TenNV1"; //gia tri hien thi comboBox_MaBS.ValueMember = "MaNV1"; //luu gia tri // dgv_PhieuKham.DataSource = dsBN; }