Example #1
0
 public void Sua(BAN ban)
 {
     if (ban.BanID>0)
     {
         frBan.Update(ban);
     }
 }
 public static IQueryable<BOLichBieuKhongDinhKy> GetAllVisualRun(KaraokeEntities kara,BAN ban)
 {
     int? khuID = ban == null ? null : ban.KhuID;
     DateTime dtNow = DateTime.Now;
     DateTime dt = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day);
     TimeSpan ts = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
     var querya = BOMenuLoaiGia.GetAllVisual(kara);
     var queryb = from b in GetAllVisual(kara)
                  where
                      ts.CompareTo(b.GioBatDau.Value) >= 0 && ts.CompareTo(b.GioKetThuc.Value) <= 0 &&
                      dt.CompareTo(b.NgayBatDau.Value) >= 0 && dt.CompareTo(b.NgayKetThuc.Value) <= 0 &&
                      (
                         b.KhuID == null ||
                         b.KhuID == khuID
                      )
                  select b;
     var query = from a in querya
                 join b in queryb on a.LoaiGiaID equals b.LoaiGiaID
                 select new BOLichBieuKhongDinhKy
                 {
                     MenuLoaiGia = a,
                     LichBieuKhongDinhKy = b
                 };
     return query.Distinct();
 }
Example #3
0
 public void Them(BAN ban)
 {
     if (ban.BanID==0)
     {
         frBan.AddObject(ban);
     }
 }
 public void ChuyenBan(BAN ban)
 {
     int banHangID = _BanHang.BANHANG.BanHangID;                
     _BanHang.ChuyenBan(ban);
     CHUYENBAN chuyen = new CHUYENBAN();
     chuyen.TuBanHangID = banHangID;
     chuyen.DenBanHangID = _BanHang.BANHANG.BanHangID;
     chuyen.NhanVienID = mTransit.NhanVien.NhanVienID;
     chuyen.ThoiGian = DateTime.Now;
     mKaraokeEntities.CHUYENBANs.AddObject(chuyen);
     mKaraokeEntities.SaveChanges();
 }
Example #5
0
 public IQueryable<BOBanHang> GetAllBanHang(BAN ban)
 {
     return from a in GetAllNotCompleted()
            join b in mKaraokeEntities.KHACHHANGs on a.KhachHangID equals b.KhachHangID into b1
            from c in b1.DefaultIfEmpty()
            where a.BanID == ban.BanID
            select new BOBanHang
            {
                BANHANG=a,
                KHACHHANG=c
            };
 }
Example #6
0
 public void Xoa(BAN ban)
 {
     if (ban.BanID>0)
     {
         ban.Deleted = true;
         frBan.Update(ban);
     }
     else
     {
         frBan.DeleteObject(ban);
     }
 }
 public static IQueryable<MENULOAIGIA> GetAllLoaiGiaRun(KaraokeEntities kara,BAN ban)
 {
     var lichBieuDinhKy = Data.BOLichBieuDinhKy.GetAllVisualRun(kara,ban);
     var lichBieuKhongDinhKy = Data.BOLichBieuKhongDinhKy.GetAllVisualRun(kara,ban);
     return (from a in lichBieuDinhKy select a.MenuLoaiGia).Union(from b in lichBieuKhongDinhKy select b.MenuLoaiGia).Distinct();
 }
 public void LoadBanHang(BAN ban)
 {            
     _BanHang = new Data.BOBanHang(mTransit,mKaraokeEntities);
     _BanHang.LoadBanHang(ban);
 }
Example #9
0
        public void ChuyenBan(BAN ban)
        {            
            Nullable<int> trangThai = this.BANHANG.TrangThaiID;
            //chuyen ban
            this.BANHANG.TrangThaiID = 5;
            mKaraokeEntities.SaveChanges();

            //ban moi
            mKaraokeEntities.BANHANGs.Detach(this.BANHANG);
            this.BANHANG.TrangThaiID = trangThai;
            this.BANHANG.BanID = ban.BanID;            
            this.BANHANG.BanHangID = 0;            
            foreach (var item in _ListChiTietBanHang)
            {
                mKaraokeEntities.CHITIETBANHANGs.Detach(item.ChiTietBanHang);
                item.ChiTietBanHang.ChiTietBanHangID = 0;                
            }
            GuiNhaBep();

        }
Example #10
0
        public void LoadBanHang(BAN ban)
        {
            BAN = ban;
            BOBanHang bh=null;
            if (ban!=null)
            {
                 bh= GetAllBanHang(ban).FirstOrDefault();
            }
            if (bh!=null)
            {                
                BANHANG = bh.BANHANG;
                KHACHHANG = bh.KHACHHANG;
                LoadChiTiet();
                ReloadGioKaraoke();
            }
            else
            {
                BANHANG = new BANHANG();
                BANHANG.NhanVienID = mTransit.NhanVien.NhanVienID;
                if (BANHANG.NhanVienID == 0)
                {
                    BANHANG.NhanVienID = null;
                }
                if (ban!=null)
                {
                    BANHANG.BanID = ban.BanID;
                }
                BANHANG.NgayBan=BANHANG.NgayKetThuc = DateTime.Now;
                BANHANG.MaHoaDon = String.Format("HD-{0:00}-{1:000000}", mTransit.ThamSo.SoMay, mTransit.ThamSo.ThuTuMaHoaDon);                
                BANHANG.TrangThaiID = 1;
                if (_CAIDATBANHANG.ChoPhepPhiDichVu)
                {
                    BANHANG.PhiDichVu = _CAIDATBANHANG.PhiDichVu;
                }
                if (_CAIDATBANHANG.ChoPhepThueVAT)
                {
                    BANHANG.ThueVAT = _CAIDATBANHANG.ThueVAT;
                }
            }

        }
 /// <summary>
 /// Create a new BAN object.
 /// </summary>
 /// <param name="banID">Initial value of the BanID property.</param>
 /// <param name="locationX">Initial value of the LocationX property.</param>
 /// <param name="locationY">Initial value of the LocationY property.</param>
 /// <param name="height">Initial value of the Height property.</param>
 /// <param name="width">Initial value of the Width property.</param>
 /// <param name="visual">Initial value of the Visual property.</param>
 /// <param name="deleted">Initial value of the Deleted property.</param>
 /// <param name="edit">Initial value of the Edit property.</param>
 public static BAN CreateBAN(global::System.Int32 banID, global::System.Decimal locationX, global::System.Decimal locationY, global::System.Decimal height, global::System.Decimal width, global::System.Boolean visual, global::System.Boolean deleted, global::System.Boolean edit)
 {
     BAN bAN = new BAN();
     bAN.BanID = banID;
     bAN.LocationX = locationX;
     bAN.LocationY = locationY;
     bAN.Height = height;
     bAN.Width = width;
     bAN.Visual = visual;
     bAN.Deleted = deleted;
     bAN.Edit = edit;
     return bAN;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the BANs EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToBANs(BAN bAN)
 {
     base.AddObject("BANs", bAN);
 }
        public static IQueryable<BOLichBieuDinhKy> GetAllVisualRun(KaraokeEntities kara,BAN ban)
        {
            int? khuID = ban == null ? null : ban.KhuID;
            DateTime dt = DateTime.Now;
            int dayOfWeek = (int)dt.DayOfWeek;
            TimeSpan ts = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
            var querya = BOMenuLoaiGia.GetAllVisual(kara);
            var queryb = from b in GetAllVisual(kara)
                         where
                             ts.CompareTo(b.GioBatDau.Value) >= 0 &&
                             ts.CompareTo(b.GioKetThuc.Value) <= 0 &&
                             (
                                b.KhuID == null ||
                                b.KhuID == khuID
                             )
                         select b;

            //tim theo ngay trong tuan
            var query1 = from a in querya
                         join b in queryb on a.LoaiGiaID equals b.LoaiGiaID
                         where
                            b.TheLoaiID == 1 &&
                            (
                                (dayOfWeek >= b.GiaTriBatDau && dayOfWeek <= b.GiaTriKetThuc && b.GiaTriBatDau < b.GiaTriKetThuc) ||
                                (
                                    (dayOfWeek >= b.GiaTriBatDau && dayOfWeek <= 6) || (dayOfWeek <= b.GiaTriKetThuc && dayOfWeek >= 0) && b.GiaTriBatDau > b.GiaTriKetThuc
                                )
                            )
                         select new BOLichBieuDinhKy
                         {
                             MenuLoaiGia = a,
                             LichBieuDinhKy = b
                         };
            //select a;
            //tim theo ngay trong thang
            var query2 = from a in querya
                         join b in queryb on a.LoaiGiaID equals b.LoaiGiaID
                         where
                             b.TheLoaiID == 2 &&
                             dt.Day >= b.GiaTriBatDau && dt.Day <= b.GiaTriKetThuc
                         select new BOLichBieuDinhKy
                          {
                              MenuLoaiGia = a,
                              LichBieuDinhKy = b
                          };
            //select a;
            //tim theo ngay trong nam
            var query3 = from a in querya
                         join b in queryb on a.LoaiGiaID equals b.LoaiGiaID
                         where
                             b.TheLoaiID == 3 &&
                             b.GiaTriBatDau == dt.Day && b.GiaTriKetThuc == dt.Month
                         select new BOLichBieuDinhKy
                         {
                             MenuLoaiGia = a,
                             LichBieuDinhKy = b
                         };
            //select a;
            return
                    from a in query1.Union(query2).Union(query3).Distinct() select a;
        }
 public Data.BOBanHang GetTachBan(BAN ban)
 {
     foreach (var item in _ListBan)
     {
         if (item.BANHANG.BanID==ban.BanID)
         {
             _CurrentBanHang = item;
             return _CurrentBanHang;
         }
     }
     return _CurrentBanHang= null;
 }
        /// <summary>
        /// neu ko co item thi tra ve false
        /// </summary>
        /// <param name="chitiet"></param>
        /// <param name="ban"></param>
        /// <returns></returns>
        public bool ThemTachBan(BOChiTietBanHang chitiet,BAN ban)
        {
            if(_CurrentBanHang==null)
	        {
		        BOBanHang banhang=GetBanHang(ban);
                banhang.AddChiTietBanHang(chitiet);
                this.AddBanHang(banhang);
                _CurrentBanHang = banhang;
                return false;
	        }
            _CurrentBanHang.AddChiTietBanHang(chitiet);
                return true;
        }
 public Data.BOBanHang GetBanHang(BAN ban)
 {
     Data.BOBanHang banhang = new Data.BOBanHang(mTransit,mKaraokeEntities);            
     banhang.LoadBanHang(ban);
     return banhang;
 }