private void dangXuat_Click(object sender, RoutedEventArgs e) { if (CCa_BUS.CaLamViec == null) // chưa tạo ca thì có thể đăng xuất { CCa_BUS.isDaKetCa = false; CCa_BUS.CaLamViec = null; new frmDangNhap().Show(); this.Close(); } else { hoaDons = CHoaDon_BUS.DsHoaDon(CCa_BUS.CaLamViec.GioBatDau, DateTime.Now); if (hoaDons.Count > 0) { if (CCa_BUS.isDaKetCa) // đã kết ca rồi thì mới có thể đăng xuất { CCa_BUS.isDaKetCa = false; CCa_BUS.CaLamViec = null; frmDangNhap f = new frmDangNhap(); f.Show(); this.Close(); } else { MessageBox.Show("Phải kết ca mới có thể đăng xuất"); return; } } else { CCa_BUS.isDaKetCa = false; CCa_BUS.CaLamViec = null; new frmDangNhap().Show(); this.Close(); } } }