public override void SetReservationRequests(ReservationRequests reservationRequests ) { if (reservationRequests == null) { builder.ClearReservationRequests(); return; } this.reservationReqs = reservationRequests; }
public override ReservationRequests GetReservationRequests() { YarnProtos.ReservationDefinitionProtoOrBuilder p = viaProto ? proto : builder; if (reservationReqs != null) { return(reservationReqs); } if (!p.HasReservationRequests()) { return(null); } reservationReqs = ConvertFromProtoFormat(p.GetReservationRequests()); return(reservationReqs); }
private YarnProtos.ReservationRequestsProto ConvertToProtoFormat(ReservationRequests t) { return(((ReservationRequestsPBImpl)t).GetProto()); }
private void CancelTicket() { Logger.MethodCalled("DetailsPage.CancelTicket"); if (Database.TempData.Ticket.Passengers.Count(x => x.LastAction.Type == ActionType.Buying) == 0) // (Database.TempData.Ticket.ActionType == ActionType.Reservation) { if (Database.TempData.Ticket.PNR.ExpirationDate < DateTime.Now) { App.ShowProgress("rezervasyon opsiyon tarihiniz geçmiş", ProgressType.Warning, ProgressTime.Normal); btnContinue.IsActivated = true; btnBack.IsActivated = true; DefaultButtons.Visibility = Visibility.Visible; ContinueButtons.Visibility = Visibility.Collapsed; TicketPassengerItem.HideCheckBoxes(); } else { int totalCount = Database.TempData.Ticket.Passengers.Count(); var checkedPassengers = TicketPassengerItem.CheckedPassengerList; int checkedCount = checkedPassengers.Count(); if (checkedCount != totalCount && Database.TempData.Ticket.Type != TicketType.BusJourney) { App.ShowProgress("biletler hepsi birlikte iptal edilebilir", ProgressType.Error, ProgressTime.Normal); } else if (checkedCount != totalCount && checkedCount > 1) { App.ShowProgress("bileti teker teker iptal edebilirsiniz", ProgressType.Error, ProgressTime.Normal); } else { btnContinue.IsActivated = false; btnBack.IsActivated = false; foreach (var p in TicketPassengerItem.UncheckedPassengerList) { Database.TempData.Ticket.Passengers.Remove(p); } App.ShowProgress("bilet iptal edilecek, onaylıyor musunuz?", ProgressType.Plain, ProgressTime.Infinite, new List <string>() { "Evet, iptal et", "Hayır" }); Header.HeaderConfirmed = (buttonId) => { App.HideProgress(); if (buttonId == 0) { Logger.Clicked("btnConfirm"); App.ShowProgress("işlem gerçekleştiriliyor.."); ReservationRequests.CancelReservationRequest.OnCompleted = (response) => { var actionResult = response.Result; btnContinue.IsActivated = true; btnBack.IsActivated = true; DefaultButtons.Visibility = Visibility.Visible; ContinueButtons.Visibility = Visibility.Collapsed; TicketPassengerItem.HideCheckBoxes(); App.HideProgress(); if (response.Status == ResponseStatus.Successful) { App.ShowProgress("rezervasyon başarıyla iptal edildi", ProgressType.Success, ProgressTime.Normal); Functions.UpdateTicket(Database.TempData.Ticket.PNR, NavigationService); } else { App.ShowProgress(response.Message, ProgressType.Error, ProgressTime.Normal); } }; if (checkedCount != totalCount && checkedCount == 1) { ReservationRequests.GetCancelReservation(Database.TempData.Ticket, checkedPassengers.First()); } else { ReservationRequests.GetCancelReservation(Database.TempData.Ticket); } } else { Logger.Clicked("btnCancel"); btnContinue.IsActivated = true; btnBack.IsActivated = true; } }; } } } else // if (Database.TempData.Ticket.ActionType == ActionType.Buying) { DefaultButtons.Visibility = Visibility.Visible; ContinueButtons.Visibility = Visibility.Collapsed; TicketPassengerItem.HideCheckBoxes(); Header.HeaderConfirmed = (buttonId) => { if (buttonId == 0) { var callTask = new PhoneCallTask(); callTask.DisplayName = "Biletall Çağrı Merkezi"; callTask.PhoneNumber = "+908503603258"; callTask.Show(); } }; App.ShowProgress("satış işlemleri bu sürümde iptal edilememektedir, Biletall Çağrı Merkezi'ni arayabilirsiniz", ProgressType.Plain, ProgressTime.Infinite, new List <string>() { "Ara", "Vazgeç" }); } }
private void btnContinue_Clicked(object sender, EventArgs e) { Logger.Clicked("btnContinue"); bool isValid = true; foreach (var passenger in Database.TempData.Ticket.Passengers.ToList()) { if (!passenger.IsValidForAirplane || (Database.TempData.Ticket.IsPassportRequired && passenger.PassaportId == 0)) { isValid = false; } } if (!App.IsInternetAvailable) { App.ShowProgress("internet bağlantınızı kontrol ediniz", ProgressType.Warning, ProgressTime.Normal); } else if (!isValid || string.IsNullOrEmpty(txtEmail.Value) || string.IsNullOrEmpty(txtPhoneNumber.Value)) { App.ShowProgress("boş bıraktığınız alan(lar) var", ProgressType.Warning, ProgressTime.Normal); } else if (!Regex.Match(txtEmail.Value.ToString(), @"^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$").Success) { App.ShowProgress("email adresiniz geçerli değil", ProgressType.Warning, ProgressTime.Normal); } else if (txtPhoneNumber.Value.Length < 10 || txtTelephoneNumber.Value.Length < 10) { App.ShowProgress("telefon numaranız 10 haneden oluşmalıdır", ProgressType.Warning, ProgressTime.Normal); } else { if (Database.TempData.Ticket.ActionType == ActionType.Reservation) { App.AddBackPressedEvent(BackPressed); btnContinue.IsActivated = false; App.ShowProgress("rezervasyon yapılıyor..."); ReservationRequests.ReservationRequest.OnCompleted = (response) => { var actionResult = response.Result; App.HideProgress(); btnContinue.IsActivated = true; App.RemoveBackPressedEvent(BackPressed); if (response.Status == ResponseStatus.Successful) { Database.AddPassenger(Database.TempData.Ticket.Passengers.ToList()); Database.TempData.Ticket.PNR.Code = actionResult.PNR; Database.TempData.Ticket.PNR.Parameter = Database.TempData.Ticket.Passengers[0].LastName; Database.TempData.Ticket.PNR.ExpirationDate = actionResult.ExpirationDate; Database.SavedData.Tickets.Add(Database.TempData.Ticket); Database.FillSavedPNR(); Functions.UpdateTicket(Database.TempData.Ticket.PNR, NavigationService); App.ClearBackHistory(); } else if (response.Status == ResponseStatus.InvalidTCKN) { App.ShowProgress("belirttiğiniz yolcuların bilgilerini kontrol ediniz", ProgressType.Warning, ProgressTime.Normal); } else { App.ShowProgress(response.Message, ProgressType.Error, ProgressTime.Normal); } }; ReservationRequests.GetReservation(Database.TempData.Ticket); } else { NavigationService.Navigate(new Uri("/Pages/Airplane/CreditCardPage.xaml", UriKind.RelativeOrAbsolute)); } } }
/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> private void ValidateReservationDefinition(ReservationId reservationId, ReservationDefinition contract, Plan plan, string auditConstant) { string message = string.Empty; // check if deadline is in the past if (contract == null) { message = "Missing reservation definition." + " Please try again by specifying a reservation definition."; RMAuditLogger.LogFailure("UNKNOWN", auditConstant, "validate reservation input definition" , "ClientRMService", message); throw RPCUtil.GetRemoteException(message); } if (contract.GetDeadline() <= clock.GetTime()) { message = "The specified deadline: " + contract.GetDeadline() + " is the past. Please try again with deadline in the future."; RMAuditLogger.LogFailure("UNKNOWN", auditConstant, "validate reservation input definition" , "ClientRMService", message); throw RPCUtil.GetRemoteException(message); } // Check if at least one RR has been specified ReservationRequests resReqs = contract.GetReservationRequests(); if (resReqs == null) { message = "No resources have been specified to reserve." + "Please try again by specifying the resources to reserve."; RMAuditLogger.LogFailure("UNKNOWN", auditConstant, "validate reservation input definition" , "ClientRMService", message); throw RPCUtil.GetRemoteException(message); } IList <ReservationRequest> resReq = resReqs.GetReservationResources(); if (resReq == null || resReq.IsEmpty()) { message = "No resources have been specified to reserve." + " Please try again by specifying the resources to reserve."; RMAuditLogger.LogFailure("UNKNOWN", auditConstant, "validate reservation input definition" , "ClientRMService", message); throw RPCUtil.GetRemoteException(message); } // compute minimum duration and max gang size long minDuration = 0; Resource maxGangSize = Resource.NewInstance(0, 0); ReservationRequestInterpreter type = contract.GetReservationRequests().GetInterpreter (); foreach (ReservationRequest rr in resReq) { if (type == ReservationRequestInterpreter.RAll || type == ReservationRequestInterpreter .RAny) { minDuration = Math.Max(minDuration, rr.GetDuration()); } else { minDuration += rr.GetDuration(); } maxGangSize = Resources.Max(plan.GetResourceCalculator(), plan.GetTotalCapacity() , maxGangSize, Resources.Multiply(rr.GetCapability(), rr.GetConcurrency())); } // verify the allocation is possible (skip for ANY) if (contract.GetDeadline() - contract.GetArrival() < minDuration && type != ReservationRequestInterpreter .RAny) { message = "The time difference (" + (contract.GetDeadline() - contract.GetArrival ()) + ") between arrival (" + contract.GetArrival() + ") " + "and deadline (" + contract.GetDeadline() + ") must " + " be greater or equal to the minimum resource duration (" + minDuration + ")"; RMAuditLogger.LogFailure("UNKNOWN", auditConstant, "validate reservation input definition" , "ClientRMService", message); throw RPCUtil.GetRemoteException(message); } // check that the largest gang does not exceed the inventory available // capacity (skip for ANY) if (Resources.GreaterThan(plan.GetResourceCalculator(), plan.GetTotalCapacity(), maxGangSize, plan.GetTotalCapacity()) && type != ReservationRequestInterpreter.RAny) { message = "The size of the largest gang in the reservation refinition (" + maxGangSize + ") exceed the capacity available (" + plan.GetTotalCapacity() + " )"; RMAuditLogger.LogFailure("UNKNOWN", auditConstant, "validate reservation input definition" , "ClientRMService", message); throw RPCUtil.GetRemoteException(message); } }