public static bool CanDeleteReservation(ReservationState state, ReservationStateArgs args, DateTime now) { // [2020-09-29 jg] invitee and tool engineer can also delete if (state == ReservationState.StartOrDelete) { return(true); } if (state == ReservationState.Editable) { return(true); } if (state == ReservationState.Invited) { return(true); } if (state == ReservationState.NotInLab) { return(true); } return(false); }
public string GetNotStartableMessage(ReservationState state) { switch (state) { case ReservationState.Undefined: return("Reservation is not startable at this time."); case ReservationState.Editable: case ReservationState.PastSelf: case ReservationState.Other: case ReservationState.Invited: case ReservationState.PastOther: return("Reservation has already ended."); case ReservationState.Endable: return("Reservation is already in progress."); case ReservationState.Repair: return("Resource offline for repair"); case ReservationState.NotInLab: return("You must be in the lab to start the reservation"); case ReservationState.UnAuthToStart: return("You are not authorized to start this reservation"); case ReservationState.Meeting: return("Reservation takes place during regular meeting time."); default: return(string.Empty); } }
public async Task <Models.ReservationModel> Start(int reservationId, int clientId, string ip) { var rsv = DA.Scheduler.Reservation.Single(reservationId); var isInLab = KioskUtility.ClientInLab(rsv.Resource.ProcessTech.Lab.LabID, clientId, ip); ReservationState state = ReservationUtility.GetReservationState(rsv.ReservationID, clientId, isInLab); var startable = ReservationUtility.IsStartable(state); if (!startable) { throw new InvalidOperationException(string.Format("ReservationID {0} cannot be started: {1}", reservationId, GetNotStartableMessage(state))); } if (rsv != null) { await ReservationUtility.StartReservation(rsv, clientId, isInLab); return(CreateReservationModel(rsv, clientId, ip)); } else { throw new ArgumentException(string.Format("Cannot find record for ReservationID = {0}", reservationId), "reservationId"); } }
public ContractComplete(CarRentDBContext context, Contract contract) { Reservation reservation = context.Reservations.Find(contract.ReservationId); this.ReservationDate = reservation.ReservationDate; this.State = reservation.State; this.Costs = reservation.Costs; this.ReservationDate = reservation.ReservationDate; this.RentalDate = reservation.RentalDate; this.RentalDays = reservation.RentalDays; Customer customer = context.Customers.Find(reservation.CustomerId); this.Firstname = customer.Firstname; this.Lastname = customer.Lastname; this.Adress = customer.Adress; this.EMailAdress = customer.EMailAdress; this.Telephonenumber = customer.Telephonenumber; Car car = context.Cars.Find(reservation.CarId); CarBrand brand = context.CarBrands.Find(car.BrandId); this.BrandName = brand.BrandName; CarClass carclass = context.CarClasses.Find(car.ClassId); this.Class = carclass.Class; CarType type = context.CarTypes.Find(car.TypeId); this.carType = type.carType; this.CostsPerDay = carclass.CostsPerDay; }
public void UpdateTable() { reservationTable.Clear(); reservationTable = DBFacade.GetReservations(); for (int i = 0; i < reservationTable.Rows.Count; i++) { Guid ID = Guid.Parse(reservationTable.Rows[i]["ID"].ToString()); Guid flightID = Guid.Parse(reservationTable.Rows[i]["FlightID"].ToString()); Flight flight = ServiceFactory.GetFlights().GetFlightByID(flightID); Guid passengerID = Guid.Parse(reservationTable.Rows[i]["PassengerID"].ToString()); Passenger passenger = ServiceFactory.GetPassengers().GetPassengerByID(passengerID); Guid staffID = Guid.Parse(reservationTable.Rows[i]["StaffID"].ToString()); Staff staff = ServiceFactory.GetStaffs().GetStaffByID(staffID); DateTime reservationTime = DateTime.Parse(reservationTable.Rows[i]["ReservationTime"].ToString()); String cancelTimeStr = reservationTable.Rows[i]["cancelTime"].ToString(); Nullable <DateTime> cancelTime = null; if (!cancelTimeStr.Equals("")) { cancelTime = DateTime.Parse(cancelTimeStr); } uint seatNumber = uint.Parse(reservationTable.Rows[i]["SeatNumber"].ToString()); ReservationState state = Utilities.StringToReservationState(reservationTable.Rows[i]["State"].ToString()); reservations.Add(new Reservation(ID, flight, passenger, staff, seatNumber, reservationTime, state, cancelTime)); } }
public static bool CanModifyReservation(ReservationState state, ReservationStateArgs args, DateTime now) { // [2020-09-29 jg] Editable means Delete or Modify so we must check here for isReserver. // only reserver can modify if (!args.IsReserver) { return(false); } if (state == ReservationState.StartOrDelete) { return(true); } if (state == ReservationState.Editable) { return(true); } if (state == ReservationState.NotInLab) { return(true); } return(false); }
public async Task <IActionResult> UpdateStatus(int reservationId, ReservationState status) { using var client = new ApiClient(); User user; client.Token = Request.Cookies["token"]; user = await client.GetUserAsync(); if (user == null) { return(RedirectToAction("Login", "Authentication")); } var reservation = await client.GetReservationAsync(reservationId); if (reservation == null) { return(NotFound()); } reservation.State = status; bool result = await client.UpdateReservation(reservation); return(RedirectToAction("Details", "Reservations", new { id = reservation.Id })); }
public Reservation(int id, int perfId, DateTime date, int ticketQuantity) { Id = id; PerformanceId = perfId; Date = date; TicketQuantity = ticketQuantity; State = ReservationState.UNPAID; }
private async void SwitchState(Reservation self, ReservationState state) { self.State = state; switch (self.State) { case ReservationState.Sleep: break; case ReservationState.Show: { CreateRoomAsync(self); } break; case ReservationState.Run: { try { if (self.room == null) { return; } if (self.room.Type != RoomType.Team) { return; } if (self.room.State != RoomState.Start) { return; } var lobbyComponent = Game.Scene.GetComponent <LobbyComponent>(); await lobbyComponent.RunRoomOnTeam(self.room.Id); } catch (Exception e) { Log.Error(e); } } break; case ReservationState.Destroy: { var reservationComponent = Game.Scene.GetComponent <ReservationComponent>(); await reservationComponent.DestroyReservation(self.Id); } break; } // 同步預約的狀態 var proxy = Game.Scene.GetComponent <CacheProxyComponent>(); var memsync = proxy.GetMemorySyncSolver <Reservation>(); await memsync.Update(self); }
private void CreateAndSendEmail(int?id, ReservationState state) { var reservation = db.Reservations.Find(id); Email mail = new Email(); mail.To = reservation.Email; mail.From = ConfigurationManager.AppSettings["ClinicsEmail"]; mail.Password = ConfigurationManager.AppSettings["EmailPassword"]; switch (state) { case ReservationState.Pending: mail.DisplayNameFrom = "Oczekująca na potwierdzenie wizyta w MindClinic"; mail.Subject = "Twoja wizyta została zarezerwowana"; mail.Body = "Witaj, " + reservation.Name + "!" + Environment.NewLine + " Twoja wizyta z dnia " + reservation.Appointment.Date.ToString("f") + " u " + reservation.Appointment.Doctor.Name + " " + reservation.Appointment.Doctor.Surname + " została zarezerwowana i oczekuje na potwierdzenie. Oczekuj wkrótce maila z potwierdzeniem! " + "Możesz umówić się na następną wizytę już dziś poprzez naszą stronę! " + Environment.NewLine + " Pozdrawiamy! " + Environment.NewLine + "Zespól MindClinic"; break; case ReservationState.Confirmed: mail.DisplayNameFrom = "Potwierdzona wizyta w MindClinic"; mail.Subject = "Twoja wizyta została potwierdzona"; mail.Body = "Witaj, " + reservation.Name + "!" + Environment.NewLine + "Twoja wizyta z dnia " + reservation.Appointment.Date.ToString("f") + " u " + reservation.Appointment.Doctor.Name + " " + reservation.Appointment.Doctor.Surname + " została potwierdzona. Zapraszamy. " + "Możesz umówić się na następną wizytę już dziś poprzez naszą stronę! " + Environment.NewLine + " Pozdrawiamy! " + Environment.NewLine + "Zespól MindClinic"; break; case ReservationState.Cancelled: mail.DisplayNameFrom = "Odwołana wizyta w MindClinic"; mail.Subject = "Twoja wizyta została odwołana"; mail.Body = "Witaj, " + reservation.Name + "!" + Environment.NewLine + "Twoja wizyta z dnia " + reservation.Appointment.Date.ToString("f") + " u " + reservation.Appointment.Doctor.Name + " " + reservation.Appointment.Doctor.Surname + " została odwołana. Przeraszamy za utrudnienia. " + "Możesz umówić się na kolejną już dziś poprzez naszą stronę! " + Environment.NewLine + " Pozdrawiamy! " + Environment.NewLine + "Zespól MindClinic"; break; } SendMail(mail); }
public static ICollection <Reservation> GetReservationsForUserWithState(User user, ReservationState reservationState) { using (var context = new AirportContext()) { var reservations = GetReservationsForUser(user).Where(reservation => reservation.ReservationState == reservationState) .ToList(); return(reservations); } }
public static void SetStateToReservation(int reservationId, ReservationState state) { using (var context = new AirportContext()) { context.Reservations .FirstOrDefault(r => r.ReservationId == reservationId) .ReservationState = state; context.SaveChanges(); } }
public static StartReservationItem CreateStartReservationItem(HttpContextBase context, IProvider provider, IReservationItem rsv) { var now = DateTime.Now; var item = new StartReservationItem { ReservationID = rsv.ReservationID, ResourceID = rsv.ResourceID, ResourceName = rsv.ResourceName, ReservedByClientID = rsv.ClientID, ReservedByClientName = string.Format("{0} {1}", rsv.FName, rsv.LName) }; var currentUser = context.CurrentUser(provider); if (rsv.ClientIDBegin.HasValue) { if (rsv.ClientIDBegin.Value > 0) { IClient startedBy = provider.Data.Client.GetClient(rsv.ClientIDBegin.Value); item.StartedByClientID = startedBy.ClientID; item.StartedByClientName = string.Format("{0} {1}", startedBy.FName, startedBy.LName); } else { item.StartedByClientID = 0; item.StartedByClientName = string.Empty; } } else { item.StartedByClientID = currentUser.ClientID; item.StartedByClientName = string.Format("{0} {1}", currentUser.FName, currentUser.LName); } var reservationItem = provider.Scheduler.Reservation.GetReservationWithInvitees(rsv.ReservationID); var helper = new SchedulerContextHelper(context, provider); var args = ReservationStateArgs.Create(reservationItem, helper.GetReservationClient(reservationItem), now); var stateUtil = ReservationStateUtility.Create(now); ReservationState state = stateUtil.GetReservationState(args); item.Startable = stateUtil.IsStartable(state); item.NotStartableMessage = GetNotStartableMessage(state); var inst = ActionInstances.Find(ActionType.Interlock, rsv.ResourceID); item.HasInterlock = inst != null; var res = provider.Scheduler.Resource.GetResource(rsv.ResourceID); item.ReturnUrl = GetResourceUrl(context, res); return(item); }
private void Validate(Reservation reservation, ReservationState desiredState, long desiredReservationId) { if (reservation == null) { throw new CustomException($"Unknown Reservation - Id {desiredReservationId}", ErrorCode.UnknownReservation); } if (!ValidateDesiredState(reservation, desiredState)) { throw new CustomException($"Invalid state change - {reservation.State} -> {desiredState}", ErrorCode.InvalidStateTransition); } }
private void Initial(Guid ID, Flight flight, Passenger passenger, Staff salesman, uint seatNumber, DateTime time, ReservationState state, Nullable<DateTime> cancelTime) { this.ID = ID; this.flight = flight; this.passenger = passenger; this.salesman = salesman; this.reservationDate = time; this.seatNumber = seatNumber; this.reservationState = state; this.cancelTime = cancelTime; }
private Reservation BuildReservation(long id, DateTime pickUpDateTime, ReservationState state, long clientId, string clientFullName, string clientEmail, string clientPhoneNumber) { return(new Reservation { Id = id, PickUpDateTime = pickUpDateTime, State = state, Client = new Client { Id = clientId, FullName = clientFullName, Email = clientEmail, PhoneNumber = clientPhoneNumber } }); }
public bool IsStartable(ReservationState state) { switch (state) { case ReservationState.StartOrDelete: case ReservationState.StartOnly: return(true); default: return(false); } }
public Reservation(Guid pId, string pUserFrom, string pCustomerName, string pPhone, DateTime pArriveTime, string pTableName, int pSeat, ReservationType pType, ReservationState pState) { id = pId; userFrom = pUserFrom; customerName = pCustomerName; phone = pPhone; arriveTime = pArriveTime; tableName = pTableName; seat = pSeat; type = pType; state = pState; }
public Models.ReservationModel CreateReservationModel(Reservation rsv, int clientId, string ip) { var item = new Models.ReservationModel(); item.ReservationID = rsv.ReservationID; item.ResourceID = rsv.Resource.ResourceID; item.ResourceName = rsv.Resource.ResourceName; item.AccountID = rsv.Account.AccountID; item.AccountName = rsv.Account.Name; item.ShortCode = rsv.Account.ShortCode; item.ReservedByClientID = rsv.Client.ClientID; item.ReservedByClientName = string.Format("{0} {1}", rsv.Client.FName, rsv.Client.LName); Client c; if (rsv.ClientIDBegin.HasValue) { if (rsv.ClientIDBegin.Value > 0) { c = DA.Current.Single <Client>(rsv.ClientIDBegin.Value); item.StartedByClientID = c.ClientID; item.StartedByClientName = string.Format("{0} {1}", c.FName, c.LName); } else { item.StartedByClientID = 0; item.StartedByClientName = string.Empty; } } else { c = DA.Current.Single <Client>(clientId); item.StartedByClientID = clientId; item.StartedByClientName = string.Format("{0} {1}", c.FName, c.LName); } var isInLab = KioskUtility.ClientInLab(rsv.Resource.ProcessTech.Lab.LabID, clientId, ip); ReservationState state = ReservationUtility.GetReservationState(rsv.ReservationID, clientId, isInLab); item.Startable = ReservationUtility.IsStartable(state); item.NotStartableMessage = GetNotStartableMessage(state); var inst = ActionInstanceUtility.Find(ActionType.Interlock, rsv.Resource.ResourceID); item.HasInterlock = inst != null; item.ReturnUrl = GetResourceUrl(rsv.Resource.ResourceID); return(item); }
public void RaisesReservationConfirmed() { var reservationId = Guid.NewGuid(); var history = new object[] { new TicketsRequested(reservationId, Guid.NewGuid(), 4, DateTime.UtcNow.AddMinutes(-2)), }; var state = ReservationState.Apply(history); var command = new ConfirmReservation(reservationId); var events = Reservation.Handle(state, command).ToList(); Assert.Single(events); Assert.IsType <ReservationConfirmed>(events.Single()); }
private bool ValidateDesiredState(Reservation reservation, ReservationState desiredState) { switch (desiredState) { case ReservationState.Cancelled: case ReservationState.PickedUp: return(reservation.State == ReservationState.Booked); case ReservationState.Returned: return(reservation.State == ReservationState.PickedUp); default: throw new CustomException($"Unknown State {desiredState}", ErrorCode.UnknownDesiredState); } }
public void Prepare(BookingModel form, ReservationState reservation) { this.Reservation = reservation; this.Form = new BookingModel(); if (form != null) { this.Form.PartnerAlias = form.PartnerAlias; this.Form.PartnerSessionID = form.PartnerSessionID; this.Form.CustomerName = form.CustomerName; this.Form.CustomerSecondName = form.CustomerSecondName; this.Form.CustomerAddress = form.CustomerAddress; this.Form.CustomerEmail = form.CustomerEmail; this.Form.CustomerMobile = form.CustomerMobile; this.Form.BookingNote = form.BookingNote; this.Form.PromoCodes = form.PromoCodes; } if (this.Reservation != null) { if (this.Reservation.orders != null) { this.Reservation.orders.ForEach(delegate(ReservationOrder m) { BookingOrderModel order = new BookingOrderModel(); order.ReservationOrder = m; if (form != null && form.Orders != null) { BookingOrderModel formOrder = form.Orders.FirstOrDefault((BookingOrderModel o) => o != null && o.BookingOrder != null && o.BookingOrder.orderid == m.id); if (formOrder != null) { order.BookingOrder = formOrder.BookingOrder; } } this.Form.Orders.Add(order); }); } } bool arg_17A_1; if (this.Reservation != null) { arg_17A_1 = (this.Reservation.errors.FirstOrDefault((ReservationError m) => m.isstop) == null); } else { arg_17A_1 = false; } this.IsBookingEnabled = arg_17A_1; }
public ActionResult Summary([Bind(Prefix = "OrderFindForm")] OrderModel model) { SummaryContext context = new SummaryContext { ShowOrderFindForm = true }; if (base.ModelState.IsValid) { DateTime? currentDate = model.CurrentDate; DateTime dateFrom = currentDate.HasValue ? currentDate.GetValueOrDefault() : DateTime.Now.Date; List <GuestClaim> claims = GuestProvider.FindGuestClaims(UrlLanguage.CurrentLanguage, 0, model.ClaimName, new int?(Convert.ToInt32(model.Claim)), null); if ((claims != null) && (claims.Count > 0)) { int?nullable2; ReservationState reservationState = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, claims[0].claim); if ((reservationState != null) && (nullable2 = reservationState.claimId).HasValue) { context.Claim = reservationState; context.ShowOrderFindForm = false; context.Hotels = new List <DepartureHotel>(); foreach (GuestClaim claim in claims) { nullable2 = null; context.Hotels.AddRange(GuestProvider.GetDepartureInfo(UrlLanguage.CurrentLanguage, dateFrom, dateFrom.AddDays(1.0), nullable2, new int?(claim.claim))); } context.GuideDurties = new List <HotelGuideResult>(); List <GuestOrder> list2 = GuestProvider.GetActiveHotelOrders(claims, dateFrom, dateFrom.AddDays(1.0)); if ((list2 != null) && (list2.Count > 0)) { GuideController controller = new GuideController(); foreach (GuestOrder order in list2) { HotelGuideParam param = new HotelGuideParam { h = order.hotelid, ln = UrlLanguage.CurrentLanguage, pb = new DateTime?(order.period.begin.Value), pe = new DateTime?(order.period.end.Value) }; HotelGuideResult item = controller.HotelGuide(param); context.GuideDurties.Add(item); } } } } } context.OrderFindNotFound = context.Claim == null; return(base.View(context)); }
public void Prepare(BookingModel form, ReservationState reservation) { this.Reservation = reservation; this.Form = new BookingModel(); if (form != null) { this.Form.PartnerAlias = form.PartnerAlias; this.Form.PartnerSessionID = form.PartnerSessionID; this.Form.CustomerName = form.CustomerName; this.Form.CustomerSecondName = form.CustomerSecondName; this.Form.CustomerAddress = form.CustomerAddress; this.Form.CustomerEmail = form.CustomerEmail; this.Form.CustomerMobile = form.CustomerMobile; this.Form.BookingNote = form.BookingNote; this.Form.PromoCodes = form.PromoCodes; } if (this.Reservation != null) { if (this.Reservation.orders != null) { this.Reservation.orders.ForEach(delegate (ReservationOrder m) { BookingOrderModel order = new BookingOrderModel(); order.ReservationOrder = m; if (form != null && form.Orders != null) { BookingOrderModel formOrder = form.Orders.FirstOrDefault((BookingOrderModel o) => o != null && o.BookingOrder != null && o.BookingOrder.orderid == m.id); if (formOrder != null) { order.BookingOrder = formOrder.BookingOrder; } } this.Form.Orders.Add(order); }); } } bool arg_17A_1; if (this.Reservation != null) { arg_17A_1 = (this.Reservation.errors.FirstOrDefault((ReservationError m) => m.isstop) == null); } else { arg_17A_1 = false; } this.IsBookingEnabled = arg_17A_1; }
public ReservationState State(int?id, [FromUri] StatusParams param) { Func <GuestClaim, bool> func = null; if (!id.HasValue) { throw new ArgumentNullExceptionWithCode(110, "id"); } if (param == null) { throw new ArgumentNullException("param"); } WebPartner partner = UserToolsProvider.GetPartner(param); ReservationState result = BookingProvider.GetReservationState(param.Language, id.Value); ReservationState result2; if (result != null && result.claimId.HasValue) { if (param.PartnerSessionID != null && result.partner != null && result.partner.id == partner.id) { result2 = result; return(result2); } if (WebSecurity.CurrentUserId > 0) { System.Collections.Generic.List <GuestClaim> claims = GuestProvider.GetLinkedClaims(param.Language, WebSecurity.CurrentUserId); bool arg_10E_0; if (claims != null) { arg_10E_0 = (claims.FirstOrDefault((GuestClaim m) => m.claim == result.claimId.Value) == null); } else { arg_10E_0 = true; } if (!arg_10E_0) { result2 = result; return(result2); } } } return(null); }
public ActionResult ReservationStatus(int reservationId, ReservationState reservationState) { var reservation = db.Reservations.Find(reservationId); reservation.ReservationState = reservationState; db.SaveChanges(); if (reservationState == ReservationState.InProgress) { bool isBillAlreadyCreated = db.Bills.Any(b => b.ReservationId == reservationId); if (!isBillAlreadyCreated) { var controller = DependencyResolver.Current.GetService <BillController>(); var result = controller.NewBill(reservation); } } return(RedirectToAction("AllReservations")); }
private void ReservationStateTester(int resourceId, int reserverClientId, int currentClientId, int inviteeClientId, int activityId, DateTime beginDateTime, int duration, bool inlab, bool canDelete, bool canModify) { var now = DateTime.Now; DateTime endDateTime = beginDateTime.AddMinutes(duration); IReservationItem rsv = GetMockReservation(123456, resourceId, reserverClientId, activityId, beginDateTime, endDateTime, null, null); ReservationStateArgs args = GetReservationStateArgs(rsv, currentClientId, inviteeClientId, inlab, now); ReservationState state = ReservationStateUtility.Create(now).GetReservationState(args); bool actual; actual = SchedulerUtility.CanDeleteReservation(state, args, now); Assert.AreEqual(canDelete, actual); actual = SchedulerUtility.CanModifyReservation(state, args, now); Assert.AreEqual(canModify, actual); }
public ActionResult Order(int?id) { OrderContext model = new OrderContext(); int currentUserId = WebSecurity.CurrentUserId; List <GuestClaim> linkedClaims = GuestProvider.GetLinkedClaims(UrlLanguage.CurrentLanguage, currentUserId); int? detailedId = null; if (id.HasValue) { if (linkedClaims.FirstOrDefault((GuestClaim m) => m.claim == id.Value) != null) { detailedId = new int?(id.Value); } } if (!(detailedId.HasValue || (linkedClaims.Count <= 0))) { detailedId = new int?(linkedClaims[0].claim); } if (detailedId.HasValue) { ReservationState reservationState = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, detailedId.Value); if ((reservationState != null) && reservationState.claimId.HasValue) { model.Claim = reservationState; model.ExcursionTransfers = GuestProvider.GetExcursionTransferByClaim(UrlLanguage.CurrentLanguage, reservationState.claimId.Value); } } model.ClaimsNotFound = linkedClaims.Count == 0; model.ShowOtherClaims = true; model.OtherClaims = ( from m in linkedClaims //удалить детальн // where m.claim != detailedId select m).ToList <GuestClaim>(); // model.OtherClaims = linkedClaims.Where<GuestClaim>(new Func<GuestClaim, bool>(class2, (IntPtr) this.<Order>b__2)).ToList<GuestClaim>(); return(base.View(model)); }
/// <summary> /// Compose the tooltip caption text for the specified reservation /// </summary> public static string GetReservationCaption(ReservationState state) { switch (state) { case ReservationState.Undefined: return("Reservation will be startable shortly"); case ReservationState.Editable: return("Reservation Summary (click icon to modify)"); case ReservationState.StartOnly: case ReservationState.StartOrDelete: return("Click to start reservation"); case ReservationState.Endable: return("Click to end reservation"); case ReservationState.PastSelf: return("Click to edit reservation run notes"); case ReservationState.Other: case ReservationState.Invited: case ReservationState.PastOther: return("Click to send email to reservation reserver"); case ReservationState.Repair: return("Resource offline for repair"); case ReservationState.NotInLab: return("You must be in the lab to start the reservation"); case ReservationState.UnAuthToStart: return("You are not authorized to start this reservation"); case ReservationState.Meeting: return("Regular meeting time"); default: return(string.Empty); } }
public ActionResult Order([Bind(Prefix = "OrderFindForm")] OrderModel model) { OrderContext context = new OrderContext { ShowOrderFindForm = true }; if (base.ModelState.IsValid) { List <GuestClaim> list = GuestProvider.FindGuestClaims(UrlLanguage.CurrentLanguage, 0, model.ClaimName, new int?(Convert.ToInt32(model.Claim)), null); if ((list != null) && (list.Count > 0)) { ReservationState reservationState = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, list[0].claim); if ((reservationState != null) && reservationState.claimId.HasValue) { context.Claim = reservationState; context.ExcursionTransfers = GuestProvider.GetExcursionTransferByClaim(UrlLanguage.CurrentLanguage, reservationState.claimId.Value); context.ShowOrderFindForm = false; } } } context.OrderFindNotFound = context.Claim == null; return(base.View(context)); }
public Reservation() { this.resState = new PendingState(this); Console.WriteLine("Rezervayon yeni oluşturuldu. Varsayılan state' i pending."); }
//public void DeleteDish(Guid pId) //{ // foreach (DishQuota dq in dishQuotaList) // { // if (dq.id == pId) // { // dishQuotaList.Remove(dq); // } // else // { } // } //} public void ChangeState(ReservationState pState) { state = pState; //~ synchronize to db, if need to maintain the state in db DataContextDataContext dc = new DataContextDataContext(); dc.update_state_reservation(id, (int?)state); }
public Reservation() { this.resState = new PendingState(this); Console.WriteLine("Rezervayon yeni oluşturuldu. Varsayılan state' i pending."); }
private static ReservationState ConvertToNewCurrency(ReservationState model, string currency) { var targetCurr = currency; if (targetCurr != model.price.currency) { var excontrol = new GuestService.Controllers.Api.ExcursionController(); model.price = excontrol.ConvertPrice(model.price, targetCurr); for (int i = 0; i < model.orders.Count; i++) { model.orders[i].price = excontrol.ConvertPrice(model.orders[i].price, targetCurr); } } return model; }
public Reservation(Guid ID, Flight flight, Passenger passenger, Staff saleman, uint seatNumber, DateTime time, ReservationState state, Nullable<DateTime> cancelTime) { Initial(ID, flight, passenger, salesman, seatNumber, time, state, cancelTime ); }
public ActionResult Index(int?claim) { ReservationState state = null; if (claim.HasValue) { state = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, claim.Value); } #region ПРОВЕРКА ПРАВ ПОЛЬЗОВАТЕЛЯ НА ПРОСМОТР ЗАКАЗА //если есть в параметрах телефон, проверяем его if (!string.IsNullOrEmpty(Request.Params["phone"])) { try { //проверяем правильность телефона, добавляем в список разрешенных if (ClearPhoneFromGarbege(Request.Params["phone"]) == ClearPhoneFromGarbege(state.customer.phone)) { if (System.Web.HttpContext.Current.Session["allowed_claims"] == null) { System.Web.HttpContext.Current.Session["allowed_claims"] = new List <int>(); } (System.Web.HttpContext.Current.Session["allowed_claims"] as List <int>).Add(claim.Value); } else { state = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, 0); } } catch (Exception) { state = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, 0); } } else //если нет, проверяем есть ли в сессии разрешение на заявку { try { if ((claim.HasValue) && ((System.Web.HttpContext.Current.Session["allowed_claims"] == null) || (!(System.Web.HttpContext.Current.Session["allowed_claims"] as List <int>).Contains(claim.Value)))) { state = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, 0); } } catch (NullReferenceException) { state = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, 0); } } #endregion PaymentContext context = new PaymentContext(); if (claim.HasValue) { context.Reservation = state; context.PaymentModes = BookingProvider.GetPaymentModes(UrlLanguage.CurrentLanguage, claim.Value); } if (!string.IsNullOrEmpty(Request.Params["paymentMethod"])) { return(ProcessingPrivate(new ProcessingModel() { claimId = claim.Value, paymentId = Request.Params["paymentMethod"] })); } return(base.View(context)); }
public override string ToString() { return($"ReservationState: {ReservationState.ToString()} - ReservationKey: {ReservationKey}"); }
//updateTimelimit private static DateTime UpdateClaimTimelimit(ReservationState state) { try { //по умолчанию ставим таймлимит максимальным DateTime timelimit = DateTime.Now.AddHours(Convert.ToInt32(ConfigurationManager.AppSettings["timelimit_max_hours"])); // ставим максимальный таймлимит //state.o foreach (ReservationOrder order in state.orders) { DateTime orderTimeLimit = GetOrderTimeLimit(order.excursion.id, order.datefrom, order.excursion.language); if (timelimit > orderTimeLimit) timelimit = orderTimeLimit; } DateTime minTimelimit = DateTime.Now.AddHours(Convert.ToInt32(ConfigurationManager.AppSettings["timelimit_min_hours"])); if (timelimit < minTimelimit) timelimit = minTimelimit; //updateTimeLimit in claim DatabaseOperationProvider.Query("insert into pr_claim_timelimit values(@claimId, @timelimit)", "customer", new { claimId = state.claimId, timelimit = timelimit.ToString("yyyy-MM-dd HH:mm:ss") }); return timelimit; } catch (Exception ex) { Console.WriteLine(ex.Message); return DateTime.Now.AddHours(Convert.ToInt32(ConfigurationManager.AppSettings["timelimit_max_hours"])); } }