예제 #1
0
 public static void Delete_KH(KhachHangDTO kh)
 {
     try
     {
         HoaDonDTO       hd               = new HoaDonDTO();
         PhieuDatHangDTO pdh              = new PhieuDatHangDTO();
         List <string>   ds               = new List <string>();
         string          delete_kh        = string.Format("DELETE FROM db_khach_hang WHERE ma_kh='{0}'", kh.ma_kh);
         string          delete_hd_in_kh  = string.Format("SELECT ma_hd FROM db_hoa_don WHERE ma_kh = '{0}'", kh.ma_kh);
         string          delete_pdh_in_kh = string.Format("SELECT ma_pdh FROM db_phieu_dat_hang WHERE ma_kh = '{0}'", kh.ma_kh);
         ds = Xoa_thong_tin(delete_hd_in_kh);
         for (int i = 0; i < ds.Count; i++)
         {
             hd.ma_hd = ds[0];
             ChiTietHoaDonDAO.delete_SPHD(hd);
             HoaDonDAO.Delete_HD(hd);
         }
         ds = Xoa_thong_tin(delete_pdh_in_kh);
         for (int i = 0; i < ds.Count; i++)
         {
             pdh.ma_pdh = ds[0];
             ChiTietPhieuDatHangDAO.delete_SPPDH(pdh);
             PhieuDatHangDAO.Delete_PDH(pdh);
         }
         cnn = DataProvider.ConnectData();
         DataProvider.Execute(cnn, delete_kh);
         cnn.Close();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
        public List <HoaDonDTO> loadDoanhThu_FrmAmin(bool TraCuuTheoNgay, DateTime Start, DateTime End)
        {
            ChiTietHoaDonDAO cthd = new ChiTietHoaDonDAO();
            List <HoaDonDTO> kq   = db.HOA_DON.Where(u => u.TRANGTHAIXOA == false && u.TRANGTHAI == 1 && (TraCuuTheoNgay == true ? u.NGAYLAP >= Start && u.NGAYLAP <= End : true)).Select(v => new HoaDonDTO
            {
                Mahd     = v.MAHD,
                Ngaylap  = v.NGAYLAP,
                Tenban   = v.BAN.TENBAN,
                Tennvlap = v.NHAN_VIEN.TENNV,
                Tongtien = v.TONGTIEN
            }).ToList();

            return(kq);
        }
예제 #3
0
        public List <HoaDonDTO> loadDoanhThu_FrmAmin(bool TraCuuTheoNgay, DateTime Start, DateTime End)
        {
            ChiTietHoaDonDAO cthd = new ChiTietHoaDonDAO();
            List <HoaDonDTO> kq   = db.HOA_DON.Where(p => p.TRANGTHAI == 1 && (TraCuuTheoNgay == true ?
                                                                               (((p.NGAYLAP.Year == Start.Year && p.NGAYLAP.Month == Start.Month && p.NGAYLAP.Day >= Start.Day) ||
                                                                                 (p.NGAYLAP.Year == Start.Year && p.NGAYLAP.Month > Start.Month) ||
                                                                                 (p.NGAYLAP.Year > Start.Year))
                                                                                &&
                                                                                ((p.NGAYLAP.Year == End.Year && p.NGAYLAP.Month == End.Month && p.NGAYLAP.Day <= End.Day) ||
                                                                                 (p.NGAYLAP.Year == End.Year && p.NGAYLAP.Month < End.Month) ||
                                                                                 (p.NGAYLAP.Year < End.Year)))
                : true)).Select(p => new HoaDonDTO
            {
                Mahd     = p.MAHD,
                Ngaylap  = p.NGAYLAP,
                Tenban   = p.BAN.TENBAN,
                Tennvlap = p.NHAN_VIEN.TENNV,
                Tongtien = p.TONGTIEN
            }).ToList();

            return(kq);
        }