Пример #1
0
 public ActionResult SetBookingStatus(int bookingId, BookingStatus status)
 {
     var userId = int.Parse(User.Identity.Name);
     var booking = Provider.GetBooking(bookingId);
     if (booking.Status == BookingStatus.Canceled && status == BookingStatus.Confirmed)
     {
         if (Provider.IsDateAndTimeFree(booking.QuestId, booking.Date))
         {
             booking = Provider.SetBookingStatus(bookingId, status, userId);
         }
         else
         {
             return Json(new { Changed = false }, JsonRequestBehavior.AllowGet);
         }
     }
     else
     {
         booking = Provider.SetBookingStatus(bookingId, status, userId);
     }
     var json = new
     {
         Changed = true,
         StatusCode = booking.Status,
         Status = booking.Status.Description(),
         Processed = string.Format("{0} ({1})", booking.Processed.Value.ToString("dd.MM.yyyy HH:mm"), booking.OperatorName)
     };
     return Json(json, JsonRequestBehavior.AllowGet);
 }
Пример #2
0
        public static BookingEventType GetBookingEventStatus(BookingType bookingType, DateTime startTime,
          BookingStatus bookingStatus, string shortDescription)
        {
            if (shortDescription == TeleConsult.Infrastructure.Core.Const.AlertShortDescription
                    .FileUploadedToBookingByConsultant.ToString()
                || shortDescription == TeleConsult.Infrastructure.Core.Const.AlertShortDescription
                    .FileUploadedToBookingByCustomer.ToString())
            {
                return BookingEventType.Photo;
            }
            else if (bookingStatus == BookingStatus.Requested
                || bookingStatus == BookingStatus.SpecialistRescheduled
                || bookingStatus == BookingStatus.CustomerRescheduled)
            {
                if (bookingStatus == BookingStatus.Requested
                    && bookingType == BookingType.ASAP
                    && (DateTime.UtcNow - startTime).Hours > ConfigurationData.ASAPBookingExpiredTime())
                {
                    return BookingEventType.Past;
                }
                return BookingEventType.Request;
            }
            else if (bookingStatus == BookingStatus.Confirmed)
            {
                return BookingEventType.Confirmed;
            }
            else if (bookingStatus == BookingStatus.Cancel
                || bookingStatus == BookingStatus.Finish)
            {
                return BookingEventType.Past;
            }

            return BookingEventType.InProgress;
        }
Пример #3
0
 public FacilityBookingRequest(int eventid,
     string requestorid, DateTime reqStart, DateTime reqEnd, Faculties fac)
 {
     this.eventID = eventid;
     this.requestStartDateTime = reqStart;
     this.requestEndDateTime = reqEnd;
     this.requestorID = requestorid;
     this.fac = fac;
     this.status = BookingStatus.Pending;
     BookingTime = DateTime.Now;
     remarks = "";
 }
Пример #4
0
        public IHttpActionResult UpdateBookingStatus(int bookingId, BookingStatus bookingStatus)
        {
            if (!(bookingStatus == BookingStatus.Definitive || bookingStatus == BookingStatus.Cancelled)) //if the updated bookingStatus is not Definitive nor Cancelled
            {
                return(BadRequest("Invalid booking status."));
            }

            string result = _bookingManager.UpdateBookingStatus(bookingId, bookingStatus);

            if (result == null)
            {
                return(Json("No record found."));
            }

            return(Ok(result));
        }
Пример #5
0
 public bool SaveBookingStatus(BookingStatus obj)
 {
     using (var _context = new HMSvContext())
     {
         if (obj.ID == 0)
         {
             _context.BookingStatus.Add(obj);
         }
         else
         {
             var booking = _context.BookingStatus.Single(c => c.ID == obj.ID);
             booking.Title = obj.Title;
         }
         return(_context.SaveChanges() > 0);
     }
 }
        private bool PollForHearingStatus(BookingStatus expectedStatus, Guid hearingId)
        {
            const int POLL_FOR_HEARING_STATUS_TIMEOUT = 60;

            for (var i = 0; i < POLL_FOR_HEARING_STATUS_TIMEOUT; i++)
            {
                var hearing = GetHearing(hearingId);
                if (hearing.Status.Equals(expectedStatus))
                {
                    return(true);
                }
                Thread.Sleep(TimeSpan.FromSeconds(1));
            }

            return(false);
        }
Пример #7
0
        public void AutoCreate()
        {
            var booking = new BookingStatus();
            var create  = new BookingStatus()
            {
                // ReferenceNumber =( booking.generateRefernceNumber(booking.BookingStatusId,User.Identity.Name)).ToString(),
                Step1  = false,
                Step2  = false,
                Step3  = false,
                Step4  = false,
                Status = false,
                Email  = User.Identity.Name
            };

            db.BookingStatus.Add(create);
            db.SaveChanges();
        }
Пример #8
0
        public string ChangeBookingStatus(BookingStatus bookingStatus)
        {
            try {
                HotelBookingDBEntities db = new HotelBookingDBEntities();
                var BookingData           = db.HotelsBookings.FirstOrDefault(x => x.Booking_No == bookingStatus.BookingNum && x.SessionId == bookingStatus.Sid);
                BookingData.Booking_Status = bookingStatus.Status;
                db.SaveChanges();


                return("done");
            }
            catch (Exception ex)
            {
                LoggingHelper.WriteToFile("SaveBookingConfirmationController/Errors/", "ConfirmedController" + "INController" + bookingStatus.Sid, ex.InnerException?.Message, ex.Message + ex.StackTrace);

                return(null);
            }
        }
Пример #9
0
        /// <summary>
        /// Sets the update booking status by locker station id, booking id, status, mobile number and reason.
        /// </summary>
        /// <returns>
        ///  Gets the success bool flag, booking id and status.
        /// </returns>
        public JObject UpdateBookingStatus(BookingStatus model)
        {
            JObject result;

            if (TokenResponse.StatusCode == 200)
            {
                var request = SerializerHelper <BookingStatus> .SerializeObject(model);

                Log.Information("[Update Booking Status][Req]" + "[" + request + "]");

                var response = HttpHandler.PostRequestResolver(request, HttpMethod.Put, MemberInfo.Version, MemberInfo.ClientId, MemberInfo.ClientSecret, UriAbsolutePath.UpdateBookingStatus, TokenResponse.AccessToken, TokenResponse.DateTime);
                Log.Information("[Update Booking Status][Res]" + "[" + response + "]");

                result = JObject.Parse(response);
                return(result);
            }
            return(JObject.Parse(SerializerHelper <AuthenticationError> .SerializeObject(new AuthenticationError(false, "401", "Unauthenticated"))));
        }
Пример #10
0
        public static string Setstatus(int bid, BookingStatus str)
        {
            // BookingStatus a = BookingStatus.UNAVAILABLE;
            // BookingStatus s = BookingStatus.RESERVED;
            //Console.WriteLine("hello");
            //int i = (int)str;
            //Console.WriteLine(str);
            string msg = "setting status";

            foreach (var k in roomdata)
            {
                // Console.WriteLine("hello");
                if (k.BookingId == bid)
                {
                    //Console.WriteLine("hello22");
                    switch (str)
                    {
                    case BookingStatus.UNAVAILABLE:

                        Console.WriteLine("hello2");
                        k.CurrentBookingStatus = BookingStatus.UNAVAILABLE;
                        msg = "Sorry booking cancled,Unaviable";
                        Console.WriteLine(msg);
                        BookingHistory();
                        //return msg;
                        break;

                    case BookingStatus.RESERVED:

                        k.CurrentBookingStatus = BookingStatus.RESERVED;
                        msg = "booking succufully confirmed";
                        Console.WriteLine(msg);
                        BookingHistory();
                        //return msg;
                        break;
                    }
                }

                ////BookingHistory();
            }


            return(msg);
        }
Пример #11
0
 public ActionResult CreateCater(int id, UserCatering userCater, BookingStatus booking, Payments payments)
 {
     if (booking.StageCheck(3, User.Identity.Name))
     {
         TempData["Status"] = "You have already Completed this stage for your active booking.";
         return(RedirectToAction("Catering"));
     }
     // var userDecor = new UserCatering { CateringID = id, BookingStatusId = 1 };//change 1
     userCater.CateringID      = id;
     userCater.BookingStatusId = booking.getBookingStatusId(User.Identity.Name);
     booking.editStage(User.Identity.Name, 3);
     if (payments.PaymentCheck(User.Identity.Name))
     {
         payments.AddPayment(booking.getBookingStatusId(User.Identity.Name));
     }
     db.UserCaterings.Add(userCater);
     db.SaveChanges();
     return(RedirectToAction("Payment"));
 }
Пример #12
0
        public static BookingStatus BookingChoice()
        {
            Console.WriteLine(Constant.RideResponseOptions);

            BookingStatus option = (BookingStatus)Helper.ValidInteger();

            switch (option)
            {
            case BookingStatus.Confirm:
            case BookingStatus.Rejected:
            case BookingStatus.Pending:
                return(option);

            default:
                Console.WriteLine(Constant.InValidInput);
                option = BookingChoice();
                return(option);
            }
        }
        public async Task NotifyAsync(BookingStatus bookingStatus)
        {
            const string bookingUnavailable = "Vérification de disponibilité";

            if (bookingStatus.Title.Contains(bookingUnavailable))
            {
                bookingStatus.PageSource = null;
            }
            await NotificationsDB.InsertAsync(new TelegramNotification { Status = bookingStatus }).ConfigureAwait(false);

            var lastNotification = await NotificationsDB.LoadLatestAsync().ConfigureAwait(false);

            if (bookingStatus.Title == lastNotification?.Status?.Title || bookingStatus.Title.Contains(bookingUnavailable))
            {
                return;
            }

            await NotifySubscribersAsync(bookingStatus).ConfigureAwait(false);
        }
Пример #14
0
        public async Task <Booking> UpdateBookingStatusAsync(int id, BookingStatus bookingStatusModel)
        {
            try
            {
                var booking = await bookings.FirstOrDefaultAsync(x => x.Id == id);

                var bookingStatus = await bookingsStatuses.FirstOrDefaultAsync(x => x.Name == bookingStatusModel.Name);

                booking.BookingStatusId   = bookingStatus.Id;
                booking.StatusDescription = bookingStatusModel.Description ?? booking.StatusDescription;

                await context.SaveChangesAsync();

                return(booking);
            }
            catch (Exception e)
            {
                throw new WrappedDbException("Error on get booking status by name async", e);
            }
        }
Пример #15
0
        /// <summary>
        /// 行绑定事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gridBespeakLog_RowDataBound(object sender, FineUI.GridPreRowEventArgs e)
        {
            LinkButtonField lbf = gridBespeakLog.FindColumn("bespeakOpreate") as LinkButtonField;
            DataRowView     row = e.DataItem as DataRowView;

            BookingStatus logStatus = (BookingStatus)int.Parse(row[10].ToString());

            if (logStatus == BookingStatus.Waiting)
            {
                lbf.Enabled = true;
                lbf.ToolTip = "取消预约";
                lbf.Icon    = FineUI.Icon.Delete;
            }
            else
            {
                lbf.Enabled = false;
                lbf.ToolTip = "不可操作";
                lbf.Icon    = FineUI.Icon.None;
            }
        }
Пример #16
0
        public async Task <Booking> UpdateBookingStatusAsync(int id, BookingStatus bookingStatusModel)
        {
            var booking = await repository.GetBookingByIdAsync(id);

            if (booking == null)
            {
                throw new KeyNotFoundException("La reserva no existe.");
            }

            var bookingStatus = await repository.GetBookingStatusByNameAsync(bookingStatusModel.Name);

            if (bookingStatus == null)
            {
                throw new KeyNotFoundException("El estado de reserva no existe.");
            }

            booking = await repository.UpdateBookingStatusAsync(id, bookingStatusModel);

            return(booking);
        }
        private async Task NotifySubscribersAsync(BookingStatus bookingStatus)
        {
            var errors        = new List <Exception>();
            var subscriptions = await SubscriptionDB.LoadAllAsync().ConfigureAwait(false);

            foreach (var subscription in subscriptions)
            {
                try
                {
                    await Bot.SendTextMessageAsync(subscription.ChatId, FormatBookingStatus(bookingStatus), ParseMode.Markdown).ConfigureAwait(false);
                }
                catch (Exception e)
                {
                    errors.Add(e);
                }
            }
            if (errors.Any())
            {
                throw new AggregateException(errors);
            }
        }
Пример #18
0
        public IEnumerable <GuestDTO> GetAllHotelGuests(int hotelId)
        {
            BookingStatus CheckIn = database.BookingStatuses
                                    .GetAll()
                                    .SingleOrDefault(status => status.Name.Contains("CHECK_IN".ToUpper()));

            if (CheckIn == null)
            {
                throw new RecordNotFoundException(typeof(BookingStatus));
            }

            var bookingCheckIn = database.Bookings.Find(booking => booking.StatusId == CheckIn.Id && booking.BookedRoom.HotelId == hotelId);

            var guestsInHotel = new List <GuestDTO>();

            foreach (var booking in bookingCheckIn)
            {
                guestsInHotel.Add(toDtoMapper.Map <Guest, GuestDTO>(booking.NewGuest));
            }

            return(guestsInHotel);
        }
Пример #19
0
        public static async Task <Models.BookingStatus> BookingRooms(BookingReq value, string SessionID, string BN)
        {
            BookingRes    hotels  = new BookingRes();
            BookingStatus booking = new BookingStatus();

            try
            {
                //yyyy-mm-dd

                BookingMapping.MapRequestToDB(value, SessionID, BN);
                hotels = await BookingService.BookingRoomsService(value, SessionID);

                if (hotels == null)
                {
                    booking.status = 2;
                    return(booking);
                }
                BookingMapping.MapResponseToDB(hotels, SessionID, BN);
                booking.status  = 0;
                booking.booking = hotels.booking;
                return(booking);
            }
            catch (Exception ex)
            {
                var requestData = JsonConvert.SerializeObject(ex);

                LoggingHelper.WriteToFile("HBLogs/BookingException", "BookingException_" + SessionID, "BookingException", requestData);
                if (hotels != null)
                {
                    booking.status  = 1;
                    booking.booking = hotels.booking;
                    return(booking);
                }

                booking.status  = 2;
                booking.booking = null;
                return(booking);
            }
        }
Пример #20
0
        private string GetStatusText(BookingStatus bookingStatus)
        {
            var title = "";

            switch (bookingStatus)
            {
            case BookingStatus.Booked:
            {
                title = "Cancel";
            }
            break;

            case BookingStatus.Cancelled:
            {
                title = "Confirm";
            }
            break;

            case BookingStatus.Confirmed:
            {
                title = "Cancel";
            }
            break;

            case BookingStatus.Declined:
            {
                title = "Confirm";
            }
            break;

            case BookingStatus.Pending:
            {
                title = "Confirm";
            }
            break;
            }
            return(title);
        }
        public int sendnotification(BookingStatus bookingStatus, string BN, string Sid, string Status, string message, MailObj mail)
        {
            HotelBookingDAl hotelBooking = new HotelBookingDAl();
            var             Bookingdata  = hotelBooking.ChangeBookingstatusAndGetNotificationData(bookingStatus, BN, Sid, mail);

            if (Bookingdata?.Sales_Channel?.ToLower() != "direct")
            {
                //Direct
                NotificationData notificationData = new NotificationData();
                notificationData.BookingNumber      = BN;
                notificationData.ConfirmationStatus = Status;
                notificationData.Language           = "en";
                notificationData.Message            = message;
                notificationData.NotificationToken  = Bookingdata?.NotificationKey;

                notificationData.PDFURL = mail.confirmationPDF;
                notificationData.SId    = bookingStatus.Sid;
                notificationData.Type   = "hotel";
                NotificationHelper.SendPushNotification(notificationData);
                return(10);
            }
            return(11);
        }
Пример #22
0
        public static BookingStatus BookingChoice()
        {
            Console.WriteLine(Constant.RideRequestChoice);

            BookingStatus option = (BookingStatus)Helper.ValidInteger();

            switch (option)
            {
            case BookingStatus.Confirm:
                return(BookingStatus.Confirm);

            case BookingStatus.Rejected:
                return(BookingStatus.Rejected);

            case BookingStatus.Pending:
                return(BookingStatus.Pending);

            default:
                Console.WriteLine(Constant.InvalidValue);
                option = BookingChoice();
                return(option);
            }
        }
Пример #23
0
        private void GridBindDate()
        {
            string cardNo = this.LoginId;

            if (string.IsNullOrEmpty(cardNo))
            {
                cardNo = this.LoginId;
            }
            BookingStatus status = BookingStatus.None;

            if (ddlBespeakState.SelectedItem != null)
            {
                status = (BookingStatus)int.Parse(ddlBespeakState.SelectedItem.Value);
            }
            DateTime             startDate  = dpStartDate.SelectedDate.Value;
            DateTime             endDate    = dpEndDate.SelectedDate.Value;
            List <BookingStatus> statusList = new List <BookingStatus>();

            if (status == BookingStatus.None)
            {
                statusList.Add(BookingStatus.Cencaled);
                statusList.Add(BookingStatus.Confinmed);
                statusList.Add(BookingStatus.Waiting);
            }
            else
            {
                statusList.Add(status);
            }
            DataTable dt            = LogQueryHelper.BespeakLogQuery(cardNo, null, statusList, startDate, endDate.AddHours(23).AddMinutes(59));
            string    sortField     = gridBespeakLog.Columns[gridBespeakLog.SortColumnIndex].SortField;
            string    sortDirection = gridBespeakLog.SortDirection;
            DataView  TableView     = dt.DefaultView;

            TableView.Sort            = String.Format("{0} {1}", sortField, sortDirection);
            gridBespeakLog.DataSource = TableView;
            gridBespeakLog.DataBind();
        }
Пример #24
0
        private void GridBindDate()
        {
            string               cardNo     = txtCardNo.Text;
            string               roomNum    = ddlReadingRoom.SelectedItem.Value;
            BookingStatus        status     = (BookingStatus)int.Parse(ddlBespeakState.SelectedItem.Value);
            DateTime             startDate  = dpStartDate.SelectedDate.Value;
            DateTime             endDate    = dpEndDate.SelectedDate.Value;
            List <BookingStatus> statusList = new List <BookingStatus>();

            if (status == BookingStatus.None)
            {
                statusList.Add(BookingStatus.Cencaled);
                statusList.Add(BookingStatus.Confinmed);
                statusList.Add(BookingStatus.Waiting);
            }
            else
            {
                statusList.Add(status);
            }
            DataTable dt = new DataTable();

            if (chkSearchMH.Checked == false)
            {
                dt = LogQueryHelper.BespeakLogQuery(cardNo, roomNum, statusList, startDate, endDate.AddHours(23).AddMinutes(59));
            }
            else
            {
                dt = LogQueryHelper.BespeakLogQuery_ByFuzzySearch(cardNo, roomNum, statusList, startDate, endDate.AddHours(23).AddMinutes(59));
            }
            string   sortField     = gridBespeakLog.Columns[gridBespeakLog.SortColumnIndex].SortField;
            string   sortDirection = gridBespeakLog.SortDirection;
            DataView TableView     = dt.DefaultView;

            TableView.Sort            = String.Format("{0} {1}", sortField, sortDirection);
            gridBespeakLog.DataSource = TableView;
            gridBespeakLog.DataBind();
        }
        public async Task <IEnumerable <IReadBooking> > GetFutureOpenBookingsAsync(
            TenantId tenantId,
            DateTime cutoffDate,
            BookingStatus status,
            CancellationToken cancellationToken)
        {
            using (var context = CreateBookingEntityContext())
            {
                var now   = DateTime.UtcNow;
                var query = await context.Bookings
                            .Include(b => b.TherapistBookings)
                            .Where(b =>
                                   b.TenantId == tenantId.Id &&
                                   b.ProposedTime > now && b.ProposedTime < cutoffDate &&
                                   b.Status != BookingStatus.Provisional &&
                                   b.Status != BookingStatus.CancelledByClient)
                            .OrderBy(b => b.ProposedTime)
                            .ToListAsync(cancellationToken)
                            .ConfigureAwait(false);

                return(query
                       .Select(b => new ReadBooking(b)));
            }
        }
Пример #26
0
        private async Task VerifyActiveOrder()
        {
            var order = await _bookingService.GetActiveOrder();

            if (order == null)
            {
                return;
            }

            if (order.Order.IsManualRideLinq)
            {
                var manualRideLinq = await _bookingService.GetTripInfoFromManualRideLinq(order.Order.Id);

                CurrentViewState = HomeViewModelState.ManualRidelinq;

                BookingStatus.StartBookingStatus(manualRideLinq.Data, true);

                return;
            }

            CurrentViewState = HomeViewModelState.BookingStatus;

            BookingStatus.StartBookingStatus(order.Order, order.OrderStatus);
        }
Пример #27
0
        protected override void Create()
        {
            foreach (BookingStatusEnum value in Enum.GetValues(typeof(BookingStatusEnum)))
            {
                var existing = Context.BookingStatuses.FirstOrDefault(r => r.Id == (int)value);

                var shouldBe = new BookingStatus
                {
                    Id          = (int)value,
                    Name        = Enum.GetName(typeof(BookingStatusEnum), value),
                    DisplayName = EnumHelper.GetDescription(value)
                };

                if (existing == null)
                {
                    Context.BookingStatuses.Add(shouldBe);
                    Context.SaveChanges();
                }
                else
                {
                    if (existing.Name != shouldBe.Name || existing.DisplayName != shouldBe.DisplayName)
                    {
                        Context.Entry(existing).CurrentValues.SetValues(shouldBe);
                        Context.SaveChanges();
                    }
                }
            }

            var allForDeletion = Context.BookingStatuses.ToList().Where(t => !Enum.IsDefined(typeof(BookingStatusEnum), t.Id));

            if (allForDeletion.Any())
            {
                Context.BookingStatuses.RemoveRange(allForDeletion);
                Context.SaveChanges();
            }
        }
Пример #28
0
        public async Task <VideoHearing> SeedVideoHearing(Action <SeedVideoHearingOptions> configureOptions,
                                                          bool addSuitabilityAnswer = false, BookingStatus status = BookingStatus.Booked)
        {
            var options = new SeedVideoHearingOptions();

            configureOptions?.Invoke(options);
            var caseType = GetCaseTypeFromDb(options.CaseTypeName);

            var claimantCaseRole  = caseType.CaseRoles.First(x => x.Name == options.ClaimantRole);
            var defendantCaseRole = caseType.CaseRoles.First(x => x.Name == options.DefendentRole);
            var judgeCaseRole     = caseType.CaseRoles.First(x => x.Name == "Judge");

            var claimantLipHearingRole             = claimantCaseRole.HearingRoles.First(x => x.Name == options.ClaimantHearingRole);
            var claimantRepresentativeHearingRole  = claimantCaseRole.HearingRoles.First(x => x.Name == "Representative");
            var defendantRepresentativeHearingRole = defendantCaseRole.HearingRoles.First(x => x.Name == "Representative");
            var judgeHearingRole = judgeCaseRole.HearingRoles.First(x => x.Name == "Judge");

            var hearingType = caseType.HearingTypes.First(x => x.Name == options.HearingTypeName);

            var venues = new RefDataBuilder().HearingVenues;

            var          person1                  = new PersonBuilder(true).WithOrganisation().WithAddress().Build();
            var          person2                  = new PersonBuilder(true).Build();
            var          person3                  = new PersonBuilder(true).Build();
            var          person4                  = new PersonBuilder(true).Build();
            var          scheduledDate            = DateTime.Today.AddDays(1).AddHours(10).AddMinutes(30);
            const int    duration                 = 45;
            const string hearingRoomName          = "Room02";
            const string otherInformation         = "OtherInformation02";
            const string createdBy                = "*****@*****.**";
            const bool   questionnaireNotRequired = false;
            const bool   audioRecordingRequired   = true;
            var          cancelReason             = "Online abandonment (incomplete registration)";

            var videoHearing = new VideoHearing(caseType, hearingType, scheduledDate, duration,
                                                venues.First(), hearingRoomName, otherInformation, createdBy, questionnaireNotRequired,
                                                audioRecordingRequired, cancelReason);

            videoHearing.AddIndividual(person1, claimantLipHearingRole, claimantCaseRole,
                                       $"{person1.FirstName} {person1.LastName}");

            videoHearing.AddRepresentative(person2, claimantRepresentativeHearingRole, claimantCaseRole,
                                           $"{person2.FirstName} {person2.LastName}", string.Empty, "Ms X");

            videoHearing.AddRepresentative(person3, defendantRepresentativeHearingRole, defendantCaseRole,
                                           $"{person3.FirstName} {person3.LastName}", string.Empty, "Ms Y");

            videoHearing.AddJudge(person4, judgeHearingRole, judgeCaseRole, $"{person4.FirstName} {person4.LastName}");

            videoHearing.AddCase($"{Faker.RandomNumber.Next(1000, 9999)}/{Faker.RandomNumber.Next(1000, 9999)}",
                                 $"{_defaultCaseName} {Faker.RandomNumber.Next(900000, 999999)}", true);
            videoHearing.AddCase($"{Faker.RandomNumber.Next(1000, 9999)}/{Faker.RandomNumber.Next(1000, 9999)}",
                                 $"{_defaultCaseName} {Faker.RandomNumber.Next(900000, 999999)}", false);
            if (status == BookingStatus.Created)
            {
                videoHearing.UpdateStatus(BookingStatus.Created, createdBy, null);
            }

            await using (var db = new BookingsDbContext(_dbContextOptions))
            {
                await db.VideoHearings.AddAsync(videoHearing);

                await db.SaveChangesAsync();
            }

            var hearing = await new GetHearingByIdQueryHandler(new BookingsDbContext(_dbContextOptions)).Handle(
                new GetHearingByIdQuery(videoHearing.Id));

            _individualId = hearing.Participants.First(x =>
                                                       x.HearingRole.Name.ToLower().IndexOf("judge", StringComparison.Ordinal) < 0 &&
                                                       x.HearingRole.Name.ToLower().IndexOf("representative", StringComparison.Ordinal) < 0).Id;
            _participantRepresentativeIds = hearing.Participants
                                            .Where(x => x.HearingRole.Name.ToLower().IndexOf("representative", StringComparison.Ordinal) >= 0).Select(x => x.Id).ToList();

            if (addSuitabilityAnswer)
            {
                await AddQuestionnaire();
            }

            hearing = await new GetHearingByIdQueryHandler(new BookingsDbContext(_dbContextOptions)).Handle(
                new GetHearingByIdQuery(videoHearing.Id));
            _seededHearings.Add(hearing.Id);
            return(hearing);
        }
Пример #29
0
 public Task <VideoHearing> SeedVideoHearing(bool addSuitabilityAnswer = false, BookingStatus status = BookingStatus.Booked)
 {
     return(SeedVideoHearing(null, addSuitabilityAnswer, status));
 }
Пример #30
0
        private List<Booking> GetListBookingByStatus(IQueryable<Booking> query, BookingStatus status)
        {
            // Book ASAP will be expired after 72 hours
            int ASAPBookingExpiredTime = ConfigurationData.ASAPBookingExpiredTime();

            BookingStatus[] customerNotYetConfirmedStatus = new BookingStatus[] {
                BookingStatus.Requested,
                BookingStatus.SpecialistRescheduled,
                BookingStatus.CustomerRescheduled
            };

            if (customerNotYetConfirmedStatus.Contains(status))
            {
                //todo: re-test
                return query.Where(x => customerNotYetConfirmedStatus.Contains(x.Status)
                    && ((x.Type == BookingType.ASAP && DbFunctions.DiffHours(x.StartTime, DateTime.UtcNow) <= ASAPBookingExpiredTime)
                        || x.Type == BookingType.StandardHour || x.Type == BookingType.OutOfHour)).OrderBy(x => x.StartTime).ToList();
            }
            else if (BookingStatus.Confirmed.Equals(status))
            {
                return query.Where(x => x.EndTime >= DateTime.UtcNow
                    && x.Status == BookingStatus.Confirmed).OrderBy(x => x.StartTime).ToList();
            }
            else
            {
                var executedQuery = query.Where(x => (x.Type == BookingType.ASAP
                    && DbFunctions.DiffHours(x.StartTime, DateTime.UtcNow) > ASAPBookingExpiredTime)
                    || (x.Status == BookingStatus.Confirmed && x.EndTime < DateTime.UtcNow)
                    || x.Status == BookingStatus.Cancel
                    || x.Status == BookingStatus.Finish).OrderByDescending(x => x.ModifiedDate).ToList();

                if (executedQuery != null && executedQuery.Any())
                {
                    foreach (var item in executedQuery)
                    {
                        item.Status = BookingStatus.Finish;

                        Repository.Update<Booking>(item);
                    }
                    UnitOfWork.Save();
                }
                return executedQuery;
            }
        }
Пример #31
0
        private List<Booking> GetListSpecialistBookingByStatus(Guid specialistId, BookingStatus status)
        {
            IQueryable<Booking> listBooking = Repository.Query<Booking>()
                .Where(x => x.Specialist.Id.Equals(specialistId));

            return GetListBookingByStatus(listBooking, status);
        }
Пример #32
0
 static string StatusToCompactStr(BookingStatus status)
 => status.ToString();
Пример #33
0
        public static bool UpdateBookingStatus(Guid id, BookingStatus status, bool isSpecialist, IServices service)
        {
            if (id != null)
            {
                var bookDto = service.Booking.GetById(id);

                if (!isSpecialist && BookingStatus.Cancel.Equals(status))
                {
                    if (bookDto.Status.Equals(BookingStatus.Confirmed) && !bookDto.IsApplyNoMinimumCharge)
                    {
                        try
                        {
                            PaymentHelper.CreateTransaction(bookDto, bookDto.CustomerMinCharge, true, service);

                            service.Invoices.CreateConsultationInvoice(bookDto.SpecialistMinCharge, bookDto.Id, true, false, null);
                        }
                        catch (Exception e)
                        {
                            Log.Error("Create minimum charge invoice", e);
                            //throw;
                            return false;
                        }
                    }
                }
                // Customer confirm
                if (bookDto.Status == BookingStatus.SpecialistRescheduled && status == BookingStatus.Confirmed)
                {
                    // Add booking event for consultant
                    service.Booking.CreateBookingEvent(
                        new BookingEventDto
                    {
                        Booking = bookDto,
                        SourceUser = bookDto.Customer,
                        TargetUser = bookDto.Specialist,
                        ShortDescription = AlertShortDescription.BookingRequestConfirmedToConsultant,
                        Description = AlertDescription.BookingRequestConfirmedToConsult,
                        CreatedDate = DateTime.UtcNow,
                        ModifiedDate = DateTime.UtcNow,
                        IsRead = false,
                        EmailAlertDetail = EmailAlertDetail.BookingRequestConfirmedToConsult,
                        SMSAlertDetail = SMSAlertDetail.BookingRequestConfirmedToConsult,
                        EmailAlertSubject = EmailAlertSubject.BookingRequestConfirmedToConsult
                    });
                }
                // Customer cancel
                else if (bookDto.Status == BookingStatus.SpecialistRescheduled && status == BookingStatus.Cancel)
                {
                    // Add booking event for specialist
                    service.Booking.CreateBookingEvent(
                       new BookingEventDto
                       {
                           Booking = bookDto,
                           SourceUser = bookDto.Customer,
                           TargetUser = bookDto.Specialist,
                           ShortDescription = AlertShortDescription.ScheduleDeclined,
                           Description = AlertDescription.SpecialistsProposedScheduleDeclined,
                           CreatedDate = DateTime.UtcNow,
                           ModifiedDate = DateTime.UtcNow,
                           IsRead = false,
                           EmailAlertDetail = EmailAlertDetail.SpecialistsProposedScheduleDeclined,
                           SMSAlertDetail = SMSAlertDetail.SpecialistsProposedScheduleDeclined,
                           EmailAlertSubject = EmailAlertSubject.SpecialistsProposedScheduleDeclined
                       });
                }
                // Consultant confirm
                else if ((bookDto.Status == BookingStatus.CustomerRescheduled && status == BookingStatus.Confirmed) || (bookDto.Status == BookingStatus.Requested && status == BookingStatus.Confirmed))
                {
                    // Add booking event for customer
                    service.Booking.CreateBookingEvent(
                       new BookingEventDto
                       {
                           Booking = bookDto,
                           SourceUser = bookDto.Specialist,
                           TargetUser = bookDto.Customer,
                           ShortDescription = AlertShortDescription.BookingRequestConfirmedToCustomer,
                           Description = AlertDescription.BookingRequestConfirmedToCustomer,
                           CreatedDate = DateTime.UtcNow,
                           ModifiedDate = DateTime.UtcNow,
                           IsRead = false,
                           EmailAlertDetail = EmailAlertDetail.BookingRequestConfirmedToCustomer,
                           SMSAlertDetail = SMSAlertDetail.BookingRequestConfirmedToCustomer,
                           EmailAlertSubject = EmailAlertSubject.BookingRequestConfirmedToCustomer
                       });
                }
                // Consultant decline
                else if ((bookDto.Status == BookingStatus.CustomerRescheduled && status == BookingStatus.Cancel))
                {
                    // Add booking event for customer
                    service.Booking.CreateBookingEvent(
                       new BookingEventDto
                       {
                           Booking = bookDto,
                           SourceUser = bookDto.Specialist,
                           TargetUser = bookDto.Customer,
                           ShortDescription = AlertShortDescription.ScheduleDeclined,
                           Description = AlertDescription.CustomersProposedScheduleDeclined,
                           CreatedDate = DateTime.UtcNow,
                           ModifiedDate = DateTime.UtcNow,
                           IsRead = false,
                           EmailAlertDetail = EmailAlertDetail.CustomersProposedScheduleDeclined,
                           SMSAlertDetail = SMSAlertDetail.CustomersProposedScheduleDeclined,
                           EmailAlertSubject = EmailAlertSubject.CustomersProposedScheduleDeclined
                       });
                }
                // Consultant cancel
                else if (bookDto.Status == BookingStatus.Requested && status == BookingStatus.Cancel)
                {
                    // Add booking event for customer
                    service.Booking.CreateBookingEvent(
                      new BookingEventDto
                      {
                          Booking = bookDto,
                          SourceUser = bookDto.Specialist,
                          TargetUser = bookDto.Customer,
                          ShortDescription = AlertShortDescription.BookingRequestDeclined,
                          Description = AlertDescription.BookingRequestDeclined,
                          CreatedDate = DateTime.UtcNow,
                          ModifiedDate = DateTime.UtcNow,
                          IsRead = false,
                          EmailAlertDetail = EmailAlertDetail.BookingRequestDeclined,
                          SMSAlertDetail = SMSAlertDetail.BookingRequestDeclined,
                          EmailAlertSubject = EmailAlertSubject.BookingRequestDeclined
                      });
                }
                if (bookDto.Status == BookingStatus.Confirmed && status == BookingStatus.Cancel)
                {
                    if (isSpecialist)
                    {
                        // Add booking event for specialist
                        service.Booking.CreateBookingEvent(
                          new BookingEventDto
                          {
                              Booking = bookDto,
                              SourceUser = bookDto.Specialist,
                              TargetUser = bookDto.Customer,
                              ShortDescription = AlertShortDescription.ConfirmedBookingIsCancelledByConsultant,
                              Description = AlertDescription.ConfirmedBookingIsCancelledBySpecialist,
                              CreatedDate = DateTime.UtcNow,
                              ModifiedDate = DateTime.UtcNow,
                              IsRead = false,
                              EmailAlertDetail = EmailAlertDetail.ConfirmedBookingIsCancelledBySpecialist,
                              SMSAlertDetail = SMSAlertDetail.ConfirmedBookingIsCancelledBySpecialist,
                              EmailAlertSubject = EmailAlertSubject.ConfirmedBookingIsCancelledBySpecialist
                          });
                    }
                    else
                    {
                        // Add booking event for customer
                        service.Booking.CreateBookingEvent(
                          new BookingEventDto
                          {
                              Booking = bookDto,
                              SourceUser = bookDto.Customer,
                              TargetUser = bookDto.Specialist,
                              ShortDescription = AlertShortDescription.ConfirmedBookingIsCancelledByCustomer,
                              Description = AlertDescription.ConfirmedBookingIsCancelledByCustomer,
                              CreatedDate = DateTime.UtcNow,
                              ModifiedDate = DateTime.UtcNow,
                              IsRead = false,
                              EmailAlertDetail = EmailAlertDetail.ConfirmedBookingIsCancelledByCustomer,
                              SMSAlertDetail = SMSAlertDetail.ConfirmedBookingIsCancelledByCustomer,
                              EmailAlertSubject = EmailAlertSubject.ConfirmedBookingIsCancelledByCustomer
                          });
                    }
                }
                service.Booking.UpdateBookingStatus(id, status);

                // Reload alert and booking list
                NotifyHelper.ReloadAlert(bookDto.Specialist.UserName);
                NotifyHelper.ReloadAlert(bookDto.Customer.UserName);

                return true;
            }
            else
            {
                return false;
            }
        }
Пример #34
0
 public List<BookingDto> GetListBookingByStatus(Guid UserId, Role roleName, BookingStatus status, string keyword)
 {
     if (Role.Customer.Equals(roleName))
     {
         return this.GetListCustomerBookingByStatus(UserId, status, keyword)
             .Select(booking => booking.ExposedAs<BookingDto>()).ToList();
     }
     else
     {
         return this.GetListSpecialistBookingByStatus(UserId, status, keyword)
             .Select(booking => booking.ExposedAs<BookingDto>()).ToList();
     }
 }
Пример #35
0
        private List<Booking> GetListCustomerBookingByStatus(Guid customerId, BookingStatus status)
        {
            IQueryable<Booking> listBooking = Repository.Query<Booking>()
                .Where(x => x.Customer.Id.Equals(customerId));

            return GetListBookingByStatus(listBooking, status);
        }
Пример #36
0
 //For Event on specific day, @PARAM pass in the Day StartDateTime
 public static List<FacilityBookingRequest> ViewBookingRequestByStatusNEventDay(string userID, BookingStatus s, int evID, bool viewAllStatus, bool ViewAllEvents, DateTime day)
 {
     return FaciRequestController.ViewBookingRequestByStatusNEvent
     (userID, s, evID, viewAllStatus, ViewAllEvents, day);
 }
Пример #37
0
 public List<DashBoardBookingDto> GetListBookingForDashBoard(Guid userId, Role roleName, BookingStatus status)
 {
     if (Role.Customer.Equals(roleName))
     {
         return this.GetListCustomerBookingByStatus(userId, status)
             .Select(booking => booking.ExposedAs<DashBoardBookingDto>()).ToList();
     }
     else
     {
         return this.GetListSpecialistBookingByStatus(userId, status)
             .Select(booking => booking.ExposedAs<DashBoardBookingDto>()).ToList();
     }
 }
Пример #38
0
        /// <summary>
        /// Update booking status when click confirm or cancel
        /// </summary>
        /// <param name="id"></param>
        /// <param name="status"></param>
        public void UpdateBookingStatus(Guid bookingId, BookingStatus status)
        {
            Booking book = Repository.FindById<Booking>(bookingId);

            book.Status = status;
            book.ModifiedDate = DateTime.UtcNow;

            Repository.Update<Booking>(book);
            UnitOfWork.Save();
        }
Пример #39
0
 /// <summary>
 /// get format datetime to display on popup
 /// </summary>
 /// <param name="type"></param>
 /// <param name="startTime"></param>
 /// <param name="endTime"></param>
 /// <returns></returns>
 public static string GetDisplayTime(BookingType type, BookingStatus status, DateTime? startTime, DateTime? endTime)
 {
     string result = string.Empty;
     if (BookingType.ASAP.Equals(type) && status == BookingStatus.Requested)
     {
         result = Constants.ASAPMessage;
     }
     else if (startTime.HasValue && endTime.HasValue)
     {
         if (startTime.Value.Date == DateTimeUtilities.GetDateTimeLocalNow().Date)
         {
             result = string.Format(Constants.TemplateDisplayTime, Constants.Today, startTime.Value.ToString(Constants.TimeFormat12hFull), endTime.Value.ToString(Constants.TimeFormat12hFull));
         }
         else
         {
             if (startTime.Value.Date == endTime.Value.Date)
             {
                 result = string.Format(Constants.TemplateDisplayTime, startTime.Value.ToString(Constants.GlobalDateFormat), startTime.Value.ToString(Constants.TimeFormat12hFull), endTime.Value.ToString(Constants.TimeFormat12hFull));
             }
             else
             {
                 result = string.Format(Constants.TemplateDisplayDateTime, startTime.Value.ToString(Constants.GlobalDateFormat), startTime.Value.ToString(Constants.TimeFormat12hFull), endTime.Value.ToString(Constants.GlobalDateFormat), endTime.Value.ToString(Constants.TimeFormat12hFull));
             }
         }
     }
     else if (!startTime.HasValue || !endTime.HasValue)
     {
         result = string.Format("{0} - {0}", Constants.DetermineContent);
         if (startTime.HasValue)
         {
             result = string.Format(Constants.TemplateDisplayTime, startTime.Value.ToString(Constants.GlobalDateFormat), startTime.Value.ToString(Constants.TimeFormat12hFull), Constants.DetermineContent);
         }
     }
     return result;
 }
Пример #40
0
        private static Booking UpdateBooking(Guid id, BookingStatus status, string reason = "")
        {
            using (var db = new ApplicationDbContext())
            {
                var booking = db.Bookings.Find(id);
                booking.Status = (int)status;
                booking.Reason = reason;

                db.SaveChanges();

                return booking;
            }
        }
Пример #41
0
        public static void UpdateFacilityRequestStatus(FacilityBookingRequest request, BookingStatus status, string remarks)
        {
            DAL dalDataContext = new DAL();
            FacilityBookingRequest existingRequest =
                (from facBookings in dalDataContext.facBookReqs
                 where facBookings.EventID == request.EventID &&
                 facBookings.RequestID == request.RequestID
                 select facBookings).FirstOrDefault<FacilityBookingRequest>();

            existingRequest.Status = status;
            existingRequest.Remarks = remarks;
            dalDataContext.SubmitChanges();
        }
Пример #42
0
        private List<Booking> GetListSpecialistBookingByStatus(Guid specialistId, BookingStatus status, string keyword)
        {
            IQueryable<Booking> listBooking = Repository.Query<Booking>()
                .Where(x => x.Specialist.Id.Equals(specialistId)
                    && (x.Customer.FirstName.Contains(keyword)
                        || x.Customer.LastName.Contains(keyword)));

            return GetListBookingByStatus(listBooking, status);
        }
Пример #43
0
        public static List<FacilityBookingRequest> ViewBookingRequestByStatusNEvent(string sender, BookingStatus status, int evID, bool viewAllStatus, bool ViewAllDays, DateTime day)
        {
            User user = UserController.GetUser(sender);
            if (user.isFacilityAdmin ||
                user.isAuthorized(EventController.GetEvent(evID), EnumFunctions.Manage_Facility_Bookings))//, EnumFunctions.ManageFacBookings))
            {
                DAL dalDataContext = new DAL();
                IQueryable<FacilityBookingRequest> facRequest = from facBookings in dalDataContext.facBookReqs
                                                                where
                                                                facBookings.EventID == evID
                                                                orderby facBookings.BookingTime descending
                                                                select facBookings;

                if (!viewAllStatus)
                    facRequest = facRequest.Where(f => f.Status == status);

                if (!ViewAllDays)
                    facRequest = facRequest.Where(f => f.RequestStartDateTime.Date == day.Date);

                List<FacilityBookingRequest> existingRequests = (from faci in facRequest
                                                                 select faci).ToList<FacilityBookingRequest>();
                return existingRequests;
            }
            else
            {
                throw new FaultException<SException>(new SException(),
                    new FaultReason("User is not authorized to view facility booking requests!"));
            }
        }
Пример #44
0
        public static string GenerateBookingIcs(string clientName, string clientMedi, string clientPhoneNumber,
                                                DateTime bookingTime, TimeSpan duration, BookingStatus status = BookingStatus.Pending)
        {
            if (string.IsNullOrWhiteSpace(clientPhoneNumber))
            {
                clientPhoneNumber = "Phone number unprovided";
            }
            var sbTitle = new StringBuilder();

            sbTitle.Append($"KMPBooking [{StatusToCompactStr(status)}] - ");
            sbTitle.Append(StandardClientTitle(clientName, clientMedi, clientPhoneNumber));
            return(GenerateIcs(UID,
                               DateTime.Now,
                               bookingTime,
                               bookingTime + duration,
                               sbTitle.ToString(),
                               "",
                               "Unit 12 66-80 Totterdell Street Belconnen ACT 2617"));
        }
Пример #45
0
        public static int Count(int ListingId = 0, int UserId = 0, int SupplierId = 0, DateTime?StartDate = null, DateTime?EndDate = null, BookingStatus Status = BookingStatus.None, bool Upcoming = false)
        {
            using (var ctx = new AgrishareEntities())
            {
                var query = ctx.Bookings.Include(o => o.Listing).Where(o => !o.Deleted);

                if (ListingId > 0)
                {
                    query = query.Where(o => o.ListingId == ListingId);
                }

                if (UserId > 0)
                {
                    query = query.Where(o => o.UserId == UserId);
                }

                if (SupplierId > 0)
                {
                    query = query.Where(o => o.Listing.UserId == SupplierId);
                }

                if (StartDate.HasValue)
                {
                    var startDate = StartDate.Value.StartOfDay();
                    query = query.Where(o => o.EndDate >= startDate);
                }

                if (EndDate.HasValue)
                {
                    var endDate = EndDate.Value.StartOfDay();
                    query = query.Where(o => o.StartDate <= endDate);
                }

                if (Status != BookingStatus.None)
                {
                    query = query.Where(e => e.StatusId == Status);
                }

                if (Upcoming)
                {
                    query = query.Where(e => e.StatusId == BookingStatus.Approved || e.StatusId == BookingStatus.InProgress);
                }

                return(query.Count());
            }
        }
Пример #46
0
 public List<FacilityBookingRequest> ViewFacilityBookingRequestsByEventDay(User user, int evID,
     BookingStatus status, bool viewAllStatus, bool ViewAllDays, DateTime day)
 {
     return FacilityBookingController.ViewBookingRequestByStatusNEventDay(user.UserID, status, evID,
         viewAllStatus, ViewAllDays, day);
 }
Пример #47
0
        /*
         * An update function to update the contents of the text file
         * when the ticket is booked
         */
        private void updateDB(string date, string from, string to, string start, string end, int noOfTickets, BookingStatus transactionType)
        {
            int           counter = 0;
            string        path    = Path.Combine(HttpRuntime.AppDomainAppPath, getTickets());
            List <string> currentList;

            /*
             * If the file exists in the path
             * retrieve the row entry and update the count
             * and put it back into the text file
             */
            if (File.Exists(path))
            {
                currentList = returnList(getTickets());
                List <string> changedEntry = currentList;

                /*
                 * iterate over the list
                 */
                foreach (string ticket in currentList)
                {
                    /*
                     * decouple and check for correctness
                     */
                    string[] elements = ticket.Split(' ');
                    if (checkCondition(ticket, date, from, to, noOfTickets) && elements[3] == start && elements[4] == end)
                    {
                        /*
                         * update the new ticket availability by
                         * deducting the tickets purchased
                         */
                        int newAvailability = 0;
                        if (transactionType == BookingStatus.Reserve)
                        {
                            newAvailability = Convert.ToInt32(elements[5]) - noOfTickets;
                        }
                        else if (transactionType == BookingStatus.Cancel)
                        {
                            newAvailability = Convert.ToInt32(elements[5]) + noOfTickets;
                        }
                        string newEntry = elements[0] + ' ' + elements[1] + ' ' + elements[2] + ' ' + elements[3] + ' ' + elements[4] + ' ' + newAvailability;

                        /*
                         * update the list entry
                         */
                        changedEntry[counter] = newEntry;
                        break;
                    }
                    counter++;
                }

                /*
                 * put the contents back into the text file
                 */
                File.WriteAllLines(path, changedEntry.ToArray());
            }
        }