protected void Page_Load(object sender, EventArgs e)
        {
            _currentContext = EngineContext.Current.Resolve <IWorkContext>();
            _hmContext      = EngineContext.Current.Resolve <HotelManagementEntities>();

            var que = _hmContext.trn_PurchaseOrderDetails.AsQueryable().AsNoTracking();

            if (!Page.IsPostBack)
            {
                PopulateGrid(que);
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _currentContext = EngineContext.Current.Resolve <IWorkContext>();
            _hmContext      = EngineContext.Current.Resolve <HotelManagementEntities>();

            var que = _hmContext.trn_Good_Details.AsQueryable().AsNoTracking().Where(a => a.CompanyCD == _currentContext.GetCompany.CompanyCD);

            if (!Page.IsPostBack)
            {
                PopulateGrid(que);
            }
        }
예제 #3
0
        public bool GetRoomAvailability(int roomId, DateTime date)
        {
            bool status = false;

            using (HotelManagementEntities db = new HotelManagementEntities())
            {
                List <Booking> bookings = db.Bookings.Where(x => x.RoomID == roomId && x.Booking_Date.Equals(date) && (x.Status == "Optional" || x.Status == "Definitive")).ToList();
                if (bookings.Count == 0)
                {
                    status = true;
                }
            }
            return(status);
        }
예제 #4
0
        public bool UpdateBookingDate(int bookingId, DateTime date)
        {
            bool status = false;

            using (HotelManagementEntities db = new HotelManagementEntities())
            {
                Booking booking = db.Bookings.Where(x => x.ID == bookingId).FirstOrDefault();
                booking.Booking_Date = date;
                if (db.SaveChanges() > 0)
                {
                    status = true;
                }
            }
            return(status);
        }
예제 #5
0
        public bool UpdateBookingStatus(int bookingId, string status)
        {
            bool updated = false;

            using (HotelManagementEntities db = new HotelManagementEntities())
            {
                Booking booking = db.Bookings.Where(x => x.ID == bookingId).FirstOrDefault();
                booking.Status          = status;
                db.Entry(booking).State = EntityState.Modified;
                if (db.SaveChanges() > 0)
                {
                    updated = true;
                }
            }
            return(updated);
        }
예제 #6
0
        public bool DeleteBooking(int bookingId)
        {
            bool status = false;

            using (HotelManagementEntities db = new HotelManagementEntities())
            {
                Booking booking = db.Bookings.Where(x => x.ID == bookingId).AsNoTracking().FirstOrDefault();
                booking.Status          = "Deleted";
                db.Entry(booking).State = EntityState.Modified;
                if (db.SaveChanges() > 0)
                {
                    status = true;
                }
            }
            return(status);
        }
예제 #7
0
        public List <HotelViewModel> GetHotels()
        {
            List <Hotel> hotels = new List <Hotel>();

            using (HotelManagementEntities db = new HotelManagementEntities())
            {
                hotels = db.Hotels.OrderBy(x => x.Name).ToList();
            }
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <Hotel, HotelViewModel>();
            });
            IMapper mapper = config.CreateMapper();
            List <HotelViewModel> hotelViewModels = mapper.Map <List <Hotel>, List <HotelViewModel> >(hotels);

            return(hotelViewModels);
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _currentContext = EngineContext.Current.Resolve <IWorkContext>();
            _hmContext      = EngineContext.Current.Resolve <HotelManagementEntities>();

            var que = _hmContext.mst_Supplier.AsQueryable().AsNoTracking();

            var partNo = Request.QueryString["email"];

            if (!string.IsNullOrWhiteSpace(partNo))
            {
                que = que.Where(a => a.Email.Contains(partNo));
            }
            if (!Page.IsPostBack)
            {
                PopulateGrid(que);
            }
        }
예제 #9
0
        public List <RoomViewModel> GetRooms(int?hotelId, string city, string pincode, double?price, string category)
        {
            List <Room> rooms = new List <Room>();

            using (HotelManagementEntities db = new HotelManagementEntities())
            {
                var query = from r in db.Rooms select r;
                if (hotelId != null)
                {
                    query = query.Where(x => x.HotelID == hotelId);
                }
                if (!string.IsNullOrEmpty(city))
                {
                    query = query.Where(x => x.Hotel.City == city);
                }
                if (!string.IsNullOrEmpty(pincode))
                {
                    query = query.Where(x => x.Hotel.Pin_Code == pincode);
                }
                if (!string.IsNullOrEmpty(category))
                {
                    query = query.Where(x => x.Category1.Name == category);
                }
                if (price != null)
                {
                    query = query.Where(x => x.Price == price);
                }
                query = query.Include(x => x.Hotel).Include(x => x.Category1).OrderBy(x => x.Price);
                rooms = query.ToList();
            }
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <Room, RoomViewModel>().ForMember(d => d.Hotel, o => o.MapFrom(s => s.Hotel)).ForMember(d => d.Category1, o => o.MapFrom(s => s.Category1));
                cfg.CreateMap <Hotel, HotelViewModel>();
                cfg.CreateMap <Category, CategoryViewModel>();
            });
            IMapper mapper = config.CreateMapper();
            List <RoomViewModel> roomViewModels = mapper.Map <List <Room>, List <RoomViewModel> >(rooms);

            return(roomViewModels);
        }
예제 #10
0
        public bool InsertHotel(HotelViewModel hotel)
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <HotelViewModel, Hotel>();
            });
            IMapper mapper = config.CreateMapper();
            var     Hotel  = mapper.Map <HotelViewModel, Hotel>(hotel);
            bool    status = false;

            using (HotelManagementEntities db = new HotelManagementEntities())
            {
                Hotel.Created_Date = DateTime.Now;
                db.Hotels.Add(Hotel);
                if (db.SaveChanges() > 0)
                {
                    status = true;
                }
            }
            return(status);
        }
예제 #11
0
        public bool InsertRoom(RoomViewModel room)
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <RoomViewModel, Room>();
            });
            IMapper mapper = config.CreateMapper();
            var     Room   = mapper.Map <RoomViewModel, Room>(room);
            bool    status = false;

            using (HotelManagementEntities db = new HotelManagementEntities())
            {
                Room.Created_Date = DateTime.Now;
                db.Rooms.Add(Room);
                if (db.SaveChanges() > 0)
                {
                    status = true;
                }
            }
            return(status);
        }
예제 #12
0
        public bool BookRoom(BookingViewModel booking)
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <BookingViewModel, Booking>();
            });
            IMapper mapper = config.CreateMapper();
            var     Book   = mapper.Map <BookingViewModel, Booking>(booking);

            Book.Status = "Optional";
            bool status = false;

            using (HotelManagementEntities db = new HotelManagementEntities())
            {
                db.Bookings.Add(Book);
                if (db.SaveChanges() > 0)
                {
                    status = true;
                }
            }
            return(status);
        }
예제 #13
0
 public HotelRepository()
 {
     context = new HotelManagementEntities();
 }