Exemplo n.º 1
0
 public static IQueryable<BAOCAONGAYKHACHHANG> GetBaoCaoNgayKhachHang(KaraokeEntities kara,DateTime dtFrom, DateTime dtTo)
 {
     return from x in kara.BAOCAONGAYKHACHHANGs
            where dtFrom.CompareTo(x.NgayBan.Value) <= 0 && dtTo.CompareTo(x.NgayBan.Value) >= 0
            orderby x.TenKhachHang
            select x;
 }
 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();
 }
Exemplo n.º 3
0
 public static IQueryable<BAOCAONGAYTHE> GetBaoCaoThe(KaraokeEntities kara,DateTime dtFrom, DateTime dtTo)
 {
     return from x in kara.BAOCAONGAYTHEs
            where dtFrom.CompareTo(x.NgayBan.Value) <= 0 && dtTo.CompareTo(x.NgayBan.Value) >= 0
            orderby x.TenThe
            select x;
 }
Exemplo n.º 4
0
 public static void NhapKho(KaraokeEntities kara, BOChiTietNhapKho chitiet,BONhapKho nhapKho)
 {
     LICHSUTONKHO lichSuDauKy = (from a in kara.LICHSUTONKHOes
                                 where a.MonID == chitiet.MenuKichThuocMon.MenuKichThuocMon.MonID && a.KhoID==nhapKho.NhapKho.KhoID
                                 orderby a.ID descending
                                 select a).FirstOrDefault();
     LICHSUTONKHO lichSu = new LICHSUTONKHO();
     if (lichSuDauKy == null)
     {
         lichSu.DauKySoLuong = 0;
         lichSu.DauKyDonGia = 0;
     }
     else
     {
         lichSu.DauKySoLuong = lichSuDauKy.CuoiKySoLuong;
         lichSu.DauKyDonGia = lichSuDauKy.CuoiKyDonGia;
     }
     int soluong = chitiet.ChiTietNhapKho.SoLuongNhap * chitiet.MenuKichThuocMon.MenuKichThuocMon.KichThuocLoaiBan;
     lichSu.NhapSoLuong = soluong;
     lichSu.NhapDonGia = chitiet.ChiTietNhapKho.GiaNhap / chitiet.MenuKichThuocMon.MenuKichThuocMon.KichThuocLoaiBan;
     lichSu.CuoiKySoLuong = lichSu.DauKySoLuong + lichSu.NhapSoLuong;
     lichSu.CuoiKyDonGia = lichSu.CuoiKyDonGia;
     lichSu.NgayGhiNhan = DateTime.Now;
     lichSu.MonID = chitiet.MenuKichThuocMon.MenuKichThuocMon.MonID;
     lichSu.KhoID = nhapKho.NhapKho.KhoID;
     lichSu.LoaiPhatSinhID = 1;
     kara.LICHSUTONKHOes.AddObject(lichSu);
 }
Exemplo n.º 5
0
        public static IQueryable<BAOCAOTONKHO> GetBaoCaoTonKho(KaraokeEntities kara,DateTime dtFrom)
        {
            return from x in kara.BAOCAOTONKHOes
                   where (x.NgayBan.Value.Year == dtFrom.Year && x.NgayBan.Value.Month == dtFrom.Month && x.NgayBan.Value.Day == dtFrom.Day) || x.NgayBan == null
                   select x;

        }
Exemplo n.º 6
0
 public static IQueryable<MENULOAINHOM> GetAll(KaraokeEntities kara, int limit)
 {
     return (from x in kara.MENULOAINHOMs
             where x.Deleted == false && x.Visual == true
             orderby x.LoaiNhomID
             select x).Take(limit);
 }
Exemplo n.º 7
0
 public BOKhachHang(Data.Transit transit)
 {
     mTransit = transit;
     mKaraokeEntities = new KaraokeEntities();
     frmKhachHang = new FrameworkRepository<KHACHHANG>(transit.KaraokeEntities, transit.KaraokeEntities.KHACHHANGs);
     frmLoaiKhachHang = new FrameworkRepository<LOAIKHACHHANG>(transit.KaraokeEntities, transit.KaraokeEntities.LOAIKHACHHANGs);
 }
Exemplo n.º 8
0
 public static IQueryable<BOChiTietThuChi> GetAllByThuChiID(int thuChiID, KaraokeEntities kara)
 {
     return from a in kara.CHITIETTHUCHIs
            where a.ThuChiID == thuChiID
            select new BOChiTietThuChi
            {
                ChiTietThuChi=a
            };
 }
Exemplo n.º 9
0
 public BOXuliMayIn(Transit transit)
 {
     mTransit = transit;
     mKaraokeEntities = new KaraokeEntities();
     
     _CAIDATMAYINBEP = BOCaiDatMayInBep.GetQueryNoTracking(mKaraokeEntities);            
     _CAIDATMAYINHOADON = BOCaiDatMayInHoaDon.GetQueryNoTracking(mKaraokeEntities);
     _ImageLogo = Utilities.ImageHandler.BitmapImage2Bitmap(this._CAIDATMAYINHOADON.Logo);
 }
Exemplo n.º 10
0
 public static IQueryable<BOTableStatus> GetAll(KaraokeEntities kara)
 {
     return from a in BOBanHang.GetAllNotCompleted(kara)
            select new BOTableStatus
            {
                TableID=(int)a.BanID,
                Status=(int)a.TrangThaiID
            };
            
 }
Exemplo n.º 11
0
 public static System.Data.Objects.ObjectResult<BAOCAOLICHSUTONKHO> GetLichSuTonKho(KaraokeEntities kara, int KhoID, DateTime dtFrom, DateTime dtTo)
 {
     var Parameter_KhoID = new System.Data.SqlClient.SqlParameter("@KhoID", System.Data.SqlDbType.Int);
     Parameter_KhoID.Value = KhoID;
     var Parameter_DateFrom = new System.Data.SqlClient.SqlParameter("@DateFrom", System.Data.SqlDbType.DateTime);
     Parameter_DateFrom.Value = dtFrom;
     var Parameter_DateTo = new System.Data.SqlClient.SqlParameter("@DateTo", System.Data.SqlDbType.DateTime);
     Parameter_DateTo.Value = dtTo;
     return kara.ExecuteStoreQuery<BAOCAOLICHSUTONKHO>("SP_BAOCAOLICHSUTONKHO @KhoID, @DateFrom, @DateTo", Parameter_KhoID, Parameter_DateFrom, Parameter_DateTo);
 }
Exemplo n.º 12
0
 public static IQueryable<BOMenuGia> GetAllByKichThuocMonVaLoaiGia(KaraokeEntities kara,MENUKICHTHUOCMON ktm,IQueryable<MENULOAIGIA> loaiGia)
 {
     return from a in loaiGia
            join b in GetAll(kara) on a.LoaiGiaID equals b.LoaiGiaID
            where b.KichThuocMonID==ktm.KichThuocMonID
            select new BOMenuGia
            {
                LoaiGia = a,
                MenuGia = b
            };
 }
        public static CAIDATMAYINHOADON GetQueryNoTracking(KaraokeEntities kara)
        {
            CAIDATMAYINHOADON item = FrameworkRepository<CAIDATMAYINHOADON>.QueryNoTracking(kara.CAIDATMAYINHOADONs).FirstOrDefault();
            if (item == null)
            {
                item = new CAIDATMAYINHOADON();
                item.HeaderTextString1 = "";
                item.HeaderTextString2 = "";
                item.HeaderTextString3 = "";
                item.HeaderTextString4 = "";
                item.HeaderTextFontSize1 = 12;
                item.HeaderTextFontSize2 = 12;
                item.HeaderTextFontSize3 = 12;
                item.HeaderTextFontSize4 = 12;
                item.HeaderTextFontStyle1 = (int)System.Drawing.FontStyle.Regular;
                item.HeaderTextFontStyle2 = (int)System.Drawing.FontStyle.Regular;
                item.HeaderTextFontStyle3 = (int)System.Drawing.FontStyle.Regular;
                item.HeaderTextFontStyle4 = (int)System.Drawing.FontStyle.Regular;
                item.HeaderTextFontWeights1 = (int)SomeEnum.FontWeights.Normal;
                item.HeaderTextFontWeights2 = (int)SomeEnum.FontWeights.Normal;
                item.HeaderTextFontWeights3 = (int)SomeEnum.FontWeights.Normal;
                item.HeaderTextFontWeights4 = (int)SomeEnum.FontWeights.Normal;

                item.FooterTextString1 = "";
                item.FooterTextString2 = "";
                item.FooterTextString3 = "";
                item.FooterTextString4 = "";
                item.FooterTextFontSize1 = 12;
                item.FooterTextFontSize2 = 12;
                item.FooterTextFontSize3 = 12;
                item.FooterTextFontSize4 = 12;
                item.FooterTextFontStyle1 = (int)System.Drawing.FontStyle.Regular;
                item.FooterTextFontStyle2 = (int)System.Drawing.FontStyle.Regular;
                item.FooterTextFontStyle3 = (int)System.Drawing.FontStyle.Regular;
                item.FooterTextFontStyle4 = (int)System.Drawing.FontStyle.Regular;
                item.FooterTextFontWeights1 = (int)SomeEnum.FontWeights.Normal;
                item.FooterTextFontWeights2 = (int)SomeEnum.FontWeights.Normal;
                item.FooterTextFontWeights3 = (int)SomeEnum.FontWeights.Normal;
                item.FooterTextFontWeights4 = (int)SomeEnum.FontWeights.Normal;

                item.SumanyFontSize = 12;
                item.SumanyFontStyle = (int)System.Drawing.FontStyle.Regular;
                item.SumanyFontWeights = (int)SomeEnum.FontWeights.Normal;
                item.SumanyFontSizeBig = 12;
                item.SumanyFontStyleBig = (int)System.Drawing.FontStyle.Regular;
                item.SumanyFontWeightsBig = (int)SomeEnum.FontWeights.Normal;
                item.TitleTextFontSize = 12;
                item.TitleTextFontStyle = (int)System.Drawing.FontStyle.Regular;
                item.TitleTextFontWeights = (int)SomeEnum.FontWeights.Normal;

            }
            return item;
        }
Exemplo n.º 14
0
 public static IQueryable<BAOCAONGAYTONG> GetBaoCaoNgayTong(KaraokeEntities kara,DateTime dtFrom, DateTime dtTo)
 {
     //return from x in kara.BAOCAONGAYTONGs
     //       where dtFrom.CompareTo(x.NgayBan.Value) <= 0 && dtTo.CompareTo(x.NgayBan.Value) >= 0
     //       select x;
     
     var paraFrom = new System.Data.SqlClient.SqlParameter("@NgayBatDau", System.Data.SqlDbType.DateTime);
     paraFrom.Value = dtFrom;
     var paraTo = new System.Data.SqlClient.SqlParameter("@NgayKetThuc", System.Data.SqlDbType.DateTime);
     paraTo.Value = dtTo;
     var sql = kara.ExecuteStoreQuery<BAOCAONGAYTONG>("SP_REPORT_BAOCAONGAYTONG @NgayBatDau,@NgayKetThuc", paraFrom, paraTo);
     return sql.AsQueryable<BAOCAONGAYTONG>();
 }
Exemplo n.º 15
0
 public BOBanHang(Transit tran,KaraokeEntities kara)
 {                        
     mTransit = tran;
     mKaraokeEntities = kara;
     _CAIDATBANHANG = mKaraokeEntities.CAIDATBANHANGs.FirstOrDefault();
     if (_CAIDATBANHANG==null)
     {
         _CAIDATBANHANG = new CAIDATBANHANG();
     }
     _ListChiTietBanHang = new List<BOChiTietBanHang>();
     mListChiTietBanHangDeleted = new List<BOChiTietBanHang>();            
     //LoadBanHang();
 }
Exemplo n.º 16
0
 public static NHANVIEN CheckLogin(KaraokeEntities kara,string user, string pass)
 {
     if (!String.IsNullOrEmpty(user) && !String.IsNullOrEmpty(pass))
     {
         var Parameter_TenDangNhap = new System.Data.SqlClient.SqlParameter("@TenDangNhap", System.Data.SqlDbType.VarChar, 50);
         Parameter_TenDangNhap.Value = user;
         var Parameter_MatKhau = new System.Data.SqlClient.SqlParameter("@MatKhau", System.Data.SqlDbType.VarChar, 255);
         Parameter_MatKhau.Value = pass;
         NHANVIEN nv = kara.ExecuteStoreQuery<NHANVIEN>("SP_Login_NhanVien @TenDangNhap, @MatKhau", Parameter_TenDangNhap, Parameter_MatKhau).FirstOrDefault();
         return nv;
     }
     return null;
 }
 public static IQueryable<BOBaoCaoLichSuBanHang> GetLichSuBanHang(KaraokeEntities kara, DateTime dtFrom, DateTime dtTo)
 {
     return from a in kara.BANHANGs
            //join b in mKaraokeEntities.BANs on a.BanID equals b.BanID
            //join c in mKaraokeEntities.TRANGTHAIs on a.TrangThaiID equals c.TrangThaiID
            where dtFrom.CompareTo(a.NgayBan.Value) <= 0 && dtTo.CompareTo(a.NgayBan.Value) >= 0
            select new BOBaoCaoLichSuBanHang
            {
                TenBan = a.BAN.TenBan,
                NgayBan = a.NgayBan,
                SoTien = a.TongTien,
                TrangThai = a.TRANGTHAI.TenTrangThai
            };
 }
Exemplo n.º 18
0
 public static BOThuChi GetThuChiByID(int thuchiID, KaraokeEntities kara)
 {
     return (from t in kara.THUCHIs
             join l in kara.LOAITHUCHIs on t.LoaiThuChiID equals l.LoaiThuChiID
             join n in kara.NHANVIENs on t.NhanVienID equals n.NhanVienID into listNV
             from a in listNV.DefaultIfEmpty()
             where t.ID == thuchiID
             select new BOThuChi
             {
                 ThuChi = t,
                 LoaiThuChi = l,
                 NhanVien = a
             }).FirstOrDefault();
 }
Exemplo n.º 19
0
 public static IQueryable<BOChiTietBanHang> QueryKhuyenMai(CHITIETBANHANG chitietbh, KaraokeEntities kara)
 {
     var iQuery =
         //from chitiet in banhang.CHITIETBANHANGs.Where(o=>o.ChiTietBanHangID_Ref==null)
         from chitiet in kara.CHITIETBANHANGs.Where(o => o.ChiTietBanHangID_Ref==chitietbh.ChiTietBanHangID)
         join kichthuoc in kara.MENUKICHTHUOCMONs on chitiet.KichThuocMonID equals kichthuoc.KichThuocMonID
         join menu in kara.MENUMONs on kichthuoc.MonID equals menu.MonID
         select new BOChiTietBanHang
         {
             MenuKichThuocMon = kichthuoc,
             ChiTietBanHang = chitiet,
             MenuMon = menu
         };
     return iQuery;
 }
Exemplo n.º 20
0
 public static IQueryable<BOBanHang> GetAllCompleted(KaraokeEntities kara,DateTime date)
 {
     return from a in FrameworkRepository<BANHANG>.QueryNoTracking(kara.BANHANGs).Where(
                b => 
                    b.TrangThaiID == 4 &&
                    b.NgayBan.Value.Day==date.Day &&
                    b.NgayBan.Value.Month==date.Month&&
                    b.NgayBan.Value.Year==date.Year
                )
            join b in kara.BANs on a.BanID equals b.BanID
            select new BOBanHang
            {
                BAN=b,
                BANHANG=a
            };
 }
Exemplo n.º 21
0
 public static IQueryable<BOMenuKhuyenMai> GetAllByKichThuocMon(KaraokeEntities kara, MENUKICHTHUOCMON ktm)
 {
     var query = from a in kara.MENUKHUYENMAIs.Where(o => o.KichThuocMonID == ktm.KichThuocMonID&&o.Visual==true && o.Deleted==false)
                 join b in kara.MENUKICHTHUOCMONs on a.KichThuocMonTang equals b.KichThuocMonID
                 join c in kara.MENUMONs on b.MonID equals c.MonID
                 select new BOMenuKhuyenMai
                 {
                     MenuKhuyenMai = a,
                     KichThuocMonTang = new BOMenuKichThuocMon 
                     {
                         MenuKichThuocMon=b,
                         MenuMon=c
                     }
                 };
     return query;
 }
Exemplo n.º 22
0
 public static IQueryable<BONhapKho> GetAllByDate(KaraokeEntities kara, DateTime dt)
 {            
     return 
             from nk in kara.NHAPKHOes
             join k in kara.KHOes on nk.KhoID equals k.KhoID
             join nv in kara.NHANVIENs on nk.NhanVienID equals nv.NhanVienID
             join ncc in kara.NHACUNGCAPs on nk.NhaCungCapID equals ncc.NhaCungCapID
             where 
                 nk.ThoiGian.Value.Day==dt.Day &&
                 nk.ThoiGian.Value.Month==dt.Month &&
                 nk.ThoiGian.Value.Year==dt.Year
             select new BONhapKho
             {
                 NhapKho = nk,
                 Kho = k,
                 NhanVien = nv,
                 NhaCungCap = ncc
             };                        
 }
Exemplo n.º 23
0
 public static BOThongTinCongTy GetQueryNoTracking(KaraokeEntities kara)
 {
     BOThongTinCongTy item = (from x in FrameworkRepository<CAIDATTHONGTINCONGTY>.QueryNoTracking(kara.CAIDATTHONGTINCONGTies)
                             select new BOThongTinCongTy
                             {
                                 TenCongTy=x.TenCongTy,
                                 DiaChi=x.DiaChi,
                                 DienThoai=x.DienThoaiBan,
                                 Hinh = x.Logo
                             }).FirstOrDefault();
     if (item == null)
     {
         item = new BOThongTinCongTy();
         item.TenCongTy = "";
         item.DienThoai = "";
         item.DiaChi = "";
     }
     return item;
 }
Exemplo n.º 24
0
        public Transit()
        {
            StringButton = new ClassStringButton();
            MenuGiaoDien = new Data.MenuGiaoDien();
            HashMD5 = "KTr";
            DuongDanHinh = "c:\\";
            Admin = new NHANVIEN();
            Admin.NhanVienID = 0;
            Admin.LoaiNhanVienID = (int)Data.EnumLoaiNhanVien.Admin;
            Admin.CapDo = -1;
            Admin.TenNhanVien = "Admin";
            Admin.TenDangNhap = "0000";
            Admin.MatKhau = Utilities.SecurityKaraoke.GetMd5Hash("0000", HashMD5);
            KhoID = 1;
            MayID = 1;

            KaraokeEntities = new KaraokeEntities();
            KaraokeEntities.ContextOptions.LazyLoadingEnabled = false;
            ThamSo = KaraokeEntities.THAMSOes.Where(o => o.SoMay == 1).FirstOrDefault();
            ListDonVi = BODonVi.GetAll(this).ToList();
            BOChiTietQuyen = new BOChiTietQuyen(this);
            CaiDatBanHang = KaraokeEntities.CAIDATBANHANGs.FirstOrDefault();
            if (CaiDatBanHang == null)
            {
                CaiDatBanHang = new CAIDATBANHANG();
            }
            //==================
            //var nhom = KaraokeEntities.CHUCNANGs.ToList();
            //foreach (var item in nhom)
            //{
            //    KaraokeEntities.Attach(item);
            //    KaraokeEntities.DeleteObject(item);
            //}
            //var list = KaraokeEntities.NHOMCHUCNANGs.ToList();
            //foreach (var item in list)
            //{
            //    KaraokeEntities.Attach(item);
            //    KaraokeEntities.DeleteObject(item);
            //}
            //KaraokeEntities.SaveChanges();
            //new BONhomChucNang(this);            
        }
Exemplo n.º 25
0
 public static CAIDATMAYINBEP GetQueryNoTracking(KaraokeEntities kara)
 {
     CAIDATMAYINBEP item = FrameworkRepository<CAIDATMAYINBEP>.QueryNoTracking(kara.CAIDATMAYINBEPs).FirstOrDefault();
     if (item == null)
     {
         item = new CAIDATMAYINBEP();
         item.TitleTextFontSize = 12;
         item.TitleTextFontStyle = (int)System.Drawing.FontStyle.Regular;
         item.TitleTextFontWeights = (int)SomeEnum.FontWeights.Normal;
         item.InfoTextFontSize = 12;
         item.InfoTextFontStyle = (int)System.Drawing.FontStyle.Regular;
         item.InfoTextFontWeights = (int)SomeEnum.FontWeights.Normal;
         item.ItemTextFontSize = 12;
         item.ItemTextFontStyle = (int)System.Drawing.FontStyle.Regular;
         item.ItemTextFontWeights = (int)SomeEnum.FontWeights.Normal;
         item.SumTextFontSize = 12;
         item.SumTextFontStyle = (int)System.Drawing.FontStyle.Regular;
         item.SumTextFontWeights = (int)SomeEnum.FontWeights.Normal;
     }
     return item;
 }
Exemplo n.º 26
0
 public static IQueryable<MENULOAIGIA> GetQueryNoTracking(KaraokeEntities karaokeEntities)
 {
     return karaokeEntities.MENULOAIGIAs.Where(s => s.Deleted == false);
 }
Exemplo n.º 27
0
 public static IQueryable<MENULOAIGIA> GetAllVisual(KaraokeEntities kara)
 {
     return kara.MENULOAIGIAs.Where(o => o.Deleted == false && o.Visual == true);
 }
Exemplo n.º 28
0
 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();
 }
Exemplo n.º 29
0
 public BOMenuLoaiGia(Data.Transit transit)
 {
     mTransit = transit;
     mKaraokeEntities = new KaraokeEntities();
 }
Exemplo n.º 30
0
 public BOChuyenBan(Transit transit)
 {
     mKaraokeEntities = new KaraokeEntities();
     mTransit = transit;            
 }