Exemplo n.º 1
0
        public BookingHistory CreateHistoryForUpdateBooking(Booking booking,
                                                            Member approveManager)
        {
            var entity = new BookingHistory
            {
                Booking        = booking,
                HappenedTime   = DateTime.UtcNow,
                DisplayContent = $"{approveManager.Email} updated this booking",
                FromStatus     = booking.Status,
                Id             = Guid.NewGuid().ToString(),
                MemberId       = approveManager.UserId,
                ToStatus       = booking.Status,
                Type           = BookingHistoryTypes.UPDATE,
            };

            return(context.BookingHistory.Add(entity).Entity);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var booking   = Module.BookingGetById(Convert.ToInt32(Request.QueryString["bookingid"]));
            var histories = Module.BookingGetHistory(booking);

            _prev = null;
            rptAgencies.DataSource = histories;
            rptAgencies.DataBind();

            _prev = null;
            rptDates.DataSource = histories;
            rptDates.DataBind();

            _prev = null;
            rptTotals.DataSource = histories;
            rptTotals.DataBind();

            _prev = null;
            rptStatus.DataSource = histories;
            rptStatus.DataBind();

            _prev = null;
            rptTrips.DataSource = histories;
            rptTrips.DataBind();

            _prev = null;
            rptCabins.DataSource = histories;
            rptCabins.DataBind();

            _prev = null;
            rptCustomers.DataSource = histories;
            rptCustomers.DataBind();

            _prev = null;
            rptSpecialRequest.DataSource = histories;
            rptSpecialRequest.DataBind();

            _prev = null;
            rptRooms.DataSource = histories;
            rptRooms.DataBind();

            _prev = null;
            rptPickupAddress.DataSource = histories;
            rptPickupAddress.DataBind();
        }
Exemplo n.º 3
0
        public void BookingHistorySave()
        {
            var bookingHistory = new BookingHistory()
            {
                Booking        = Booking,
                Date           = DateTime.Now,
                User           = CurrentUser,
                CabinNumber    = Booking.BookingRooms.Count,
                CustomerNumber = Booking.Pax,
                StartDate      = Booking.StartDate,
                Status         = Booking.Status,
                Trip           = Booking.Trip,
                Agency         = Booking.Agency,
                Total          = Booking.Total,
                TotalCurrency  = Booking.IsTotalUsd ? "USD" : "VND",
            };

            Module.SaveOrUpdate(bookingHistory);
        }
        public void BookingHistorySave(Booking booking)
        {
            var bookingHistory = new BookingHistory()
            {
                Booking        = booking,
                Date           = DateTime.Now,
                User           = UserBLL.UserGetCurrent(),
                CabinNumber    = booking.BookingRooms.Count,
                CustomerNumber = booking.Pax,
                StartDate      = booking.StartDate,
                Status         = booking.Status,
                Trip           = booking.Trip,
                Agency         = booking.Agency,
                Total          = booking.Total,
                TotalCurrency  = booking.IsTotalUsd ? "USD" : "VND",
            };

            SeriesViewBLL.BookingHistorySaveOrUpdate(bookingHistory);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var booking   = Module.BookingGetById(Convert.ToInt32(Request.QueryString["bookingid"]));
                var histories = Module.BookingGetHistory(booking);

                _prev = null;
                rptAgencies.DataSource = histories;
                rptAgencies.DataBind();

                _prev = null;
                rptDates.DataSource = histories;
                rptDates.DataBind();

                _prev = null;
                rptTotals.DataSource = histories;
                rptTotals.DataBind();

                _prev = null;
                rptStatus.DataSource = histories;
                rptStatus.DataBind();

                _prev = null;
                rptTrips.DataSource = histories;
                rptTrips.DataBind();

                _prev = null;
                rptCabins.DataSource = histories;
                rptCabins.DataBind();

                _prev = null;
                rptCustomers.DataSource = histories;
                rptCustomers.DataBind();
            }
            catch (Exception ex)
            {
                _logger.Error("Error when Page_Load in BookingView", ex);
                ShowError(ex.Message);
            }
        }
Exemplo n.º 6
0
        public void Read_CsvFilesAnd_CreateListWith_BookingView()
        {
            var bookingInfo    = _csvFileManager.ReadBookingsFile(bookingInfoFilePath).ToList();
            var serviceInfo    = _csvFileManager.ReadServicesFile(serviceInfoFilePath).ToList();
            var passangersInfo = _csvFileManager.ReadPassangersFile(passangerInfoFilePath).ToList();

            var bookings = new List <BookingView>();

            foreach (var booking in bookingInfo.GroupBy(x => x.Pnr))
            {
                var bookingView = new BookingView(booking.Key, serviceInfo);
                foreach (var booking1 in booking)
                {
                    var bookingHistory = new BookingHistory(booking1, passangersInfo);
                    bookingView.Histories.Add(bookingHistory);
                }
                bookings.Add(bookingView);
            }

            Assert.IsTrue(bookings.Any());
        }
        private IActionResult BookingHistoryInner(BookingHistory obj)
        {
            if (obj == null)
            {
                obj = new BookingHistory();
            }
            var user_info = Session.Get <UserInfo>("UserInfo");

            obj.page = (obj.page ?? 1);
            var data = _dbAccess.SpBookingHistoryWithPaging(user_info.User_Id, 10, obj.page.Value);

            ViewBag.RecordsCount = data.LastOrDefault().RecordCount;
            ViewBag.PageNo       = (obj.page ?? 1);
            if (obj.forAjax == null)
            {
                return(View(data.Take(data.Count - 1).ToList()));
            }
            else
            {
                return(PartialView("_MovieHistory", data.Take(data.Count - 1).ToList()));
            }
        }
Exemplo n.º 8
0
        public async Task <IActionResult> ReserveRoom(int roomId, DateTime checkIn, DateTime checkOut, decimal price)
        {
            var room = await db.Rooms.FindAsync(roomId);

            if (room is not null && checkIn >= DateTime.Today)
            {
                var newBooking = new BookingHistory()
                {
                    CheckIn  = checkIn,
                    CheckOut = checkOut,
                    Price    = price,
                    Room     = room,
                    Visitor  = (await userManager.GetUserAsync(User)).Visitor
                };
                await db.BookingHistories.AddAsync(newBooking);

                await db.SaveChangesAsync();

                return(RedirectToAction("GetHistories", "Visitor"));
            }
            return(NotFound());
        }
Exemplo n.º 9
0
        protected void btnAddRoom_Click(object sender, EventArgs e)
        {
            Customer customer1 = new Customer();

            customer1.Booking = Booking;
            customer1.Type    = CustomerType.Adult;
            Module.SaveOrUpdate(customer1);
            var history = new BookingHistory();

            history.Booking        = Booking;
            history.Date           = DateTime.Now;
            history.Agency         = Booking.Agency;
            history.StartDate      = Booking.StartDate;
            history.Status         = Booking.Status;
            history.Trip           = Booking.Trip;
            history.User           = UserIdentity;
            history.SpecialRequest = Booking.SpecialRequest;
            history.NumberOfPax    = (Booking.Adult + Booking.Child + Booking.Baby);
            history.CustomerInfo   = Booking.Note;
            Module.SaveOrUpdate(history);
            PageRedirect(Request.RawUrl);
        }
Exemplo n.º 10
0
        public string CreateBooking(BookingViewModel model)
        {
            if (model != null)
            {
                int noOfBooking = _dbContext.Bookings.Where(a => a.VehicleId == model.VehicleId).Where(a => a.ServiceId == model.ServiceId && a.Status != 3 && a.Status != 4).Count();
                if (noOfBooking != 0)
                {
                    return("Exist");
                }

                model.BookingDate = DateTime.Now;
                model.Status      = 1;
                if (model.ServiceId == 4)
                {
                    model.DepartmentId = 2;
                }
                else if (model.ServiceId == 5)
                {
                    model.DepartmentId = 3;
                }
                else
                {
                    model.DepartmentId = model.ServiceId;
                }
                Booking entity = Mapper.Map <BookingViewModel, Booking>(model);
                _dbContext.Bookings.Add(entity);
                _dbContext.SaveChanges();
                BookingHistory bookingHistory = new BookingHistory();
                bookingHistory.ServiceId    = model.ServiceId;
                bookingHistory.BookingId    = entity.BookingId;
                bookingHistory.VehicleId    = model.VehicleId;
                bookingHistory.DepartmentId = model.DepartmentId;
                _dbContext.BookingHistories.Add(bookingHistory);
                _dbContext.SaveChanges();
                return("Booking added");
            }
            return("Model is null");
        }
Exemplo n.º 11
0
        protected void rptAgencies_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is BookingHistory)
            {
                var history = (BookingHistory)e.Item.DataItem;

                if (_prev != null)
                {
                    try
                    {
                        if (_prev.Agency.Id == history.Agency.Id)
                        {
                            e.Item.Visible = false;
                            return;
                        }
                    }
                    catch (Exception) { }
                }

                try
                {
                    ValueBinder.BindLiteral(e.Item, "litTime", history.Date.ToString("dd-MMM-yyyy HH:mm"));
                    ValueBinder.BindLiteral(e.Item, "litUser", history.User.FullName);
                    ValueBinder.BindLiteral(e.Item, "litTo", history.Agency.Name);
                }
                catch (Exception) { }

                if (_prev != null)
                {
                    try
                    {
                        ValueBinder.BindLiteral(e.Item, "litFrom", _prev.Agency.Name);
                    }
                    catch (Exception) { }
                }
                _prev = history;
            }
        }
        private async void LogBookingStats(object sender, RoutedEventArgs e)
        {
            MenuItem miBuy = (sender as MenuItem);

            miBuy.Click -= this.LogBookingStats;

            try
            {
                MenuItem mi = sender as MenuItem;
                if (mi != null)
                {
                    ContextMenu cm = mi.Parent as ContextMenu;

                    PerformanceInfo pi = (PerformanceInfo)cm.Tag;

                    BookingHistory bh = new BookingHistory(pi);

                    bh.UserId = ExtendedPropertyHelper.GetUserIdentifier();

                    await App.MobileService.GetTable <BookingHistory>().InsertAsync(bh);
                }
            }
            catch { }
        }
 public IActionResult BookingHistoryAjax([FromQuery] BookingHistory obj)
 {
     return(BookingHistoryInner(obj));
 }
 public IActionResult BookingHistory([FromForm] BookingHistory obj)
 {
     return(BookingHistoryInner(obj));
 }
Exemplo n.º 15
0
 public BookingHistory Create(BookingHistory BookingHistory)
 {
     //this.database.GetCollection<BookingHistory>(mongosettings.BookingHistoryCollectionName).InsertOne(BookingHistory);
     GetBookingHistorys.InsertOne(BookingHistory);
     return(BookingHistory);
 }
Exemplo n.º 16
0
 public async Task LogBooking(BookingHistory booking)
 {
     await MobileService.GetTable <BookingHistory>().InsertAsync(booking);
 }
Exemplo n.º 17
0
        protected void btnSaveRoom_OnClick(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(hidChangeRoomIds.Value))
            {
                var ids        = hidChangeRoomIds.Value.Split('$');
                var listChange = new Dictionary <int, int>();
                if (!string.IsNullOrWhiteSpace(hidChangeRoomOption.Value))
                {
                    var cids = hidChangeRoomOption.Value.Split('$');
                    foreach (string cid in cids)
                    {
                        if (!string.IsNullOrWhiteSpace(cid))
                        {
                            var bkc = cid.Split('|');
                            listChange.Add(Convert.ToInt32(bkc[0]), Convert.ToInt32(bkc[1]));
                        }
                    }
                }
                foreach (string crids in ids)
                {
                    var rid         = crids.Split('|');
                    var bookingRoom = Module.BookingRoomGetById(Convert.ToInt32(rid[0]));
                    var newRoom     = Module.RoomGetById(Convert.ToInt32(rid[1]));

                    if (bookingRoom.Room.Id != newRoom.Id)
                    {
                        var oldRoom = bookingRoom.Room;
                        bookingRoom.Room      = newRoom;
                        bookingRoom.RoomClass = newRoom.RoomClass;

                        if (listChange.ContainsKey(bookingRoom.Id))
                        {
                            if (listChange[bookingRoom.Id] == 2) // 2 ghep giuong twin
                            {
                                bookingRoom.RoomType = oldRoom.RoomType;
                            }
                            else
                            {
                                bookingRoom.RoomType = newRoom.RoomType;
                            }
                        }
                        else
                        {
                            bookingRoom.RoomType = newRoom.RoomType;
                        }
                        Module.Update(bookingRoom);

                        // change room export service
                        var exports = Module.GetAllExportService(bookingRoom);
                        if (exports.Count > 0)
                        {
                            // update new room status
                            newRoom.Status = oldRoom.Status;
                            Module.SaveOrUpdate(newRoom);
                            // update current room
                            oldRoom.Status = RoomType.NotCleaned;
                            Module.SaveOrUpdate(oldRoom);

                            foreach (IvExport export in exports)
                            {
                                export.Room = newRoom;
                                Module.SaveOrUpdate(export);
                            }
                        }
                        //save history
                        var bookingHistory = new BookingHistory()
                        {
                            Booking        = bookingRoom.Book,
                            Date           = DateTime.Now,
                            User           = UserIdentity,
                            CabinNumber    = bookingRoom.Book.BookingRooms.Count,
                            CustomerNumber = bookingRoom.Book.Pax,
                            StartDate      = bookingRoom.Book.StartDate,
                            Status         = bookingRoom.Book.Status,
                            Trip           = bookingRoom.Book.Trip,
                            Agency         = bookingRoom.Book.Agency,
                            Total          = bookingRoom.Book.Total,
                            TotalCurrency  = bookingRoom.Book.IsTotalUsd ? "USD" : "VND",
                            SpecialRequest = bookingRoom.Book.SpecialRequest,
                            OldRoom        = oldRoom,
                            NewRoom        = newRoom
                        };
                        Module.SaveOrUpdate(bookingHistory);
                    }
                }
                Page.ClientScript.RegisterStartupScript(this.GetType(), "RefreshParentPage", "RefreshParentPage();", true);
            }
            Page.ClientScript.RegisterStartupScript(this.GetType(), "RefreshParentPage", "RefreshParentPage();", true);
        }
Exemplo n.º 18
0
        protected void btnAddBooking_OnClick(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(hidRoomId.Value))
            {
                if (_room != null && _room.Id > 0)
                {
                    var newRoom     = Module.RoomGetById(Convert.ToInt32(hidRoomId.Value));
                    var bookingRoom = _booking.BookingRooms.FirstOrDefault(r => r.Room.Id == _room.Id);
                    if (bookingRoom != null)
                    {
                        var oldRoom = bookingRoom.Room;
                        bookingRoom.Room      = newRoom;
                        bookingRoom.RoomClass = newRoom.RoomClass;
                        bookingRoom.RoomType  = newRoom.RoomType;
                        Module.Update(bookingRoom);

                        // change room export service
                        var exports = Module.GetAllExportService(_room, bookingRoom);
                        if (exports.Count > 0)
                        {
                            // update new room status
                            newRoom.Status = _room.Status;
                            Module.SaveOrUpdate(newRoom);
                            // update current room
                            _room.Status = RoomType.NotCleaned;
                            Module.SaveOrUpdate(_room);

                            foreach (IvExport export in exports)
                            {
                                export.Room = newRoom;
                                Module.SaveOrUpdate(export);
                            }
                        }
                        //save history
                        var bookingHistory = new BookingHistory()
                        {
                            Booking        = bookingRoom.Book,
                            Date           = DateTime.Now,
                            User           = UserIdentity,
                            CabinNumber    = bookingRoom.Book.BookingRooms.Count,
                            CustomerNumber = bookingRoom.Book.Pax,
                            StartDate      = bookingRoom.Book.StartDate,
                            Status         = bookingRoom.Book.Status,
                            Trip           = bookingRoom.Book.Trip,
                            Agency         = bookingRoom.Book.Agency,
                            Total          = bookingRoom.Book.Total,
                            TotalCurrency  = bookingRoom.Book.IsTotalUsd ? "USD" : "VND",
                            SpecialRequest = bookingRoom.Book.SpecialRequest,
                            OldRoom        = oldRoom,
                            NewRoom        = newRoom
                        };
                        Module.SaveOrUpdate(bookingHistory);
                    }

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "RefreshParentPage", "RefreshParentPage();", true);
                }
                if (_bookingRoom != null && _bookingRoom.Id > 0)
                {
                    var newRoom = Module.RoomGetById(Convert.ToInt32(hidRoomId.Value));
                    var bkr     = _booking.BookingRooms.FirstOrDefault(b => b.Id == _bookingRoom.Id);

                    if (bkr != null)
                    {
                        var oldRoom = bkr.Room;
                        bkr.Room      = newRoom;
                        bkr.RoomClass = newRoom.RoomClass;
                        bkr.RoomType  = newRoom.RoomType;
                        Module.Update(bkr);
                        //save history
                        var bookingHistory = new BookingHistory()
                        {
                            Booking        = bkr.Book,
                            Date           = DateTime.Now,
                            User           = UserIdentity,
                            CabinNumber    = bkr.Book.BookingRooms.Count,
                            CustomerNumber = bkr.Book.Pax,
                            StartDate      = bkr.Book.StartDate,
                            Status         = bkr.Book.Status,
                            Trip           = bkr.Book.Trip,
                            Agency         = bkr.Book.Agency,
                            Total          = bkr.Book.Total,
                            TotalCurrency  = bkr.Book.IsTotalUsd ? "USD" : "VND",
                            SpecialRequest = bkr.Book.SpecialRequest,
                            OldRoom        = oldRoom,
                            NewRoom        = newRoom
                        };
                        Module.SaveOrUpdate(bookingHistory);
                    }

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "RefreshParentPage", "RefreshParentPage();", true);
                }
            }
        }
Exemplo n.º 19
0
 public void BookingHistorySaveOrUpdate(BookingHistory bookingHistory)
 {
     BookingHistoryRepository.SaveOrUpdate(bookingHistory);
 }
        protected void btnAddBooking_OnClick(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(Request["startdate"]))
            {
                var startDate = DateTime.ParseExact(Request["startdate"], "dd/MM/yyyy",
                                                    CultureInfo.InvariantCulture);
                _booking.StartDate = startDate;
            }

            _booking.Trip              = Module.TripGetById(Convert.ToInt32(ddlTrips.SelectedValue));
            _booking.EndDate           = _booking.StartDate.AddDays(_booking.Trip.NumberOfDay - 1);
            _booking.Transfer_DateTo   = _booking.StartDate;
            _booking.Transfer_DateBack = _booking.EndDate;
            Module.SaveOrUpdate(_booking);
            if (!string.IsNullOrWhiteSpace(hidChangeRoomIds.Value))
            {
                _booking.Cruise = Module.CruiseGetById(Convert.ToInt32(ddlCruises.SelectedValue));
                Module.SaveOrUpdate(_booking);
                var ids = hidChangeRoomIds.Value.Split('$');
                foreach (string crids in ids)
                {
                    var rid     = crids.Split('|');
                    var oldRoom = Module.RoomGetById(Convert.ToInt32(rid[0]));
                    var newRoom = Module.RoomGetById(Convert.ToInt32(rid[1]));
                    foreach (var bookingRoom in _booking.BookingRooms)
                    {
                        if (bookingRoom.Room.Id == oldRoom.Id)
                        {
                            bookingRoom.Room      = newRoom;
                            bookingRoom.RoomClass = newRoom.RoomClass;
                            bookingRoom.RoomType  = newRoom.RoomType;
                            Module.Update(bookingRoom);

                            // change room export service
                            var exports = Module.GetAllExportService(oldRoom, bookingRoom);
                            if (exports.Count > 0)
                            {
                                // update new room status
                                newRoom.Status = oldRoom.Status;
                                Module.SaveOrUpdate(newRoom);
                                // update current room
                                oldRoom.Status = RoomType.NotCleaned;
                                Module.SaveOrUpdate(oldRoom);

                                foreach (IvExport export in exports)
                                {
                                    export.Room = newRoom;
                                    Module.SaveOrUpdate(export);
                                }
                            }
                            //save history
                            var bookingHistory = new BookingHistory()
                            {
                                Booking        = bookingRoom.Book,
                                Date           = DateTime.Now,
                                User           = UserIdentity,
                                CabinNumber    = bookingRoom.Book.BookingRooms.Count,
                                CustomerNumber = bookingRoom.Book.Pax,
                                StartDate      = bookingRoom.Book.StartDate,
                                Status         = bookingRoom.Book.Status,
                                Trip           = bookingRoom.Book.Trip,
                                Agency         = bookingRoom.Book.Agency,
                                Total          = bookingRoom.Book.Total,
                                TotalCurrency  = bookingRoom.Book.IsTotalUsd ? "USD" : "VND",
                                SpecialRequest = bookingRoom.Book.SpecialRequest,
                                OldRoom        = oldRoom,
                                NewRoom        = newRoom
                            };
                            Module.SaveOrUpdate(bookingHistory);
                        }
                    }
                }

                Page.ClientScript.RegisterStartupScript(this.GetType(), "RefreshParentPage", "RefreshParentPage();", true);
            }
            Page.ClientScript.RegisterStartupScript(this.GetType(), "RefreshParentPage", "RefreshParentPage();", true);
        }
Exemplo n.º 21
0
 public async Task DeleteAsync(BookingHistory history)
 {
     _dbContext.BookingHistories.Remove(history);
     await _dbContext.SaveChangesAsync();
 }