Inheritance: System.Web.UI.Page
Ejemplo n.º 1
0
        public void StopEditing(Confirmation confirmation)
        {
            switch (confirmation)
            {
                case Confirmation.Confirmed:
                    // important: we can only disable edit mode 
                    // it text is not empty, otherwise the text box would not be visible
                    if (string.IsNullOrEmpty(Name))
                        return;
                    // only fire change event if name did really change
                    if (_originalName != Name && !HasNameError)
                        Rename(Name);
                    _originalName = Name;
                    IsEditable = false;
                    break;
                case Confirmation.Canceled:
                    if (string.IsNullOrEmpty(_originalName))
                        return;
                    Name = _originalName;
                    IsEditable = false;
                    break;
            }

            // TODO: handle other cancel events
        }
		internal async Task<Steam.ConfirmationDetails> GetConfirmationDetails(Confirmation confirmation) {
			if (confirmation == null) {
				Bot.ArchiLogger.LogNullError(nameof(confirmation));
				return null;
			}

			if (!HasCorrectDeviceID) {
				Bot.ArchiLogger.LogGenericWarning("Can't execute properly due to invalid DeviceID!");
				return null;
			}

			uint time = await GetSteamTime().ConfigureAwait(false);
			if (time == 0) {
				Bot.ArchiLogger.LogNullError(nameof(time));
				return null;
			}

			string confirmationHash = GenerateConfirmationKey(time, "conf");
			if (string.IsNullOrEmpty(confirmationHash)) {
				Bot.ArchiLogger.LogNullError(nameof(confirmationHash));
				return null;
			}

			Steam.ConfirmationDetails response = await Bot.ArchiWebHandler.GetConfirmationDetails(DeviceID, confirmationHash, time, confirmation).ConfigureAwait(false);
			if ((response == null) || !response.Success) {
				return null;
			}

			return response;
		}
Ejemplo n.º 3
0
 public static void ShowConfirmation(string text, Confirmation confirmation, object obj, bool chkConfirm)
 {
     currentConfirmation = confirmation;
     currentObj = obj;
     msgControl.ShowConfirmation(text, chkConfirm);
     msgControl.Visibility = Visibility.Visible;
     bConfirm = true;
 }
Ejemplo n.º 4
0
 public static void SetupMessage(Grid element)
 {
     currentConfirmation = null;
     currentObj = null;
     msgControl = new MessageControl();
     msgControl.Visibility = Visibility.Collapsed;
     msgControl.ButtonPressed += new EventHandler<MessageDialogEventArgs>(Message_ButtonPressed);
     element.Children.Add(msgControl);
 }
 public void GetAddDocumento(TrancingAsuntoTurnoViewModel viewModel)
 {
     try
     {
         Confirmation confirmacion = new Confirmation();
         this.DataContext = new AddDocumentoAsuntoViewModel(viewModel,confirmacion);
     }
     catch (Exception)
     {
         ;
     }
 }
 public void GetAsunto(AsuntoViewModel viewModel)
 {
     try
     {
         Confirmation confirmacion = new Confirmation();
         this.DataContext = new AsuntoAddViewModel(viewModel,confirmacion);
     }
     catch (Exception)
     {
         ;
     }
 }
        public void GetRegistro(RegistroViewModel view)
        {
            try
            {
                Confirmation confirmacion = new Confirmation();
                this.DataContext = new RegistroAddViewModel(view, confirmacion);
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> ReportInvolvedParty(string occurrenceId,
                                                              [FromBody] InvolvedPartyCommand command)
        {
            command.OccurrenceId = occurrenceId;

            Confirmation confirmation = await _messaging.SendAsync(command);

            if (confirmation.Validations.Empty())
            {
                Ok(confirmation);
            }

            return(BadRequest(confirmation));
        }
Ejemplo n.º 9
0
        private void GenerateConfirmation(ConfirmationRequest request)
        {
            var req           = Newtonsoft.Json.JsonConvert.SerializeObject(request);
            var signedMessage = Sign(req);
            var conf          = new Confirmation {
                SignerId = AppState.State.Instance.UserDetails.UserId, Signature = signedMessage, Request = request
            };

            SaveConfirmedProgress(request);

            var str = Newtonsoft.Json.JsonConvert.SerializeObject(conf);

            DisplayConfirmation(str);
        }
Ejemplo n.º 10
0
        public async Task <IActionResult> CreateAsync(CreateReservationsRequest request)
        {
            // Validate that the email is not already awaiting confirmation
            if (ReservationService.DoesEmailHavePendingConfirmation(request.Email))
            {
                return(this.MakeFailure("Email already has pending confirmations.", StatusCodes.Status400BadRequest));
            }

            // if ID is present && invalid
            if (!String.IsNullOrEmpty(request.EndorsementID) && !DataContext.Endorsements.Any((Endorsement e) => e.ID == request.EndorsementID))
            {
                return(this.MakeFailure("Invalid Endorsement ID.", StatusCodes.Status400BadRequest));
            }


            foreach (CreateReservationsRequest.Slot slot in request.Slots)
            {
                // Validate that the slot is valid
                if (!this.SlotIsValid(slot.Year, slot.MonthIndex, slot.DayIndex, slot.SlotIndex))
                {
                    return(this.MakeFailure("Date or slot is not valid.", StatusCodes.Status400BadRequest));
                }

                // TODO: Validate that slot is in the future

                // TODO: Validate that slot is not already reserved by the email
            }

            // TODO: Validate the country & district

            Confirmation confirmation = new Confirmation()
            {
                ID = ReservationService.GenerateConfirmationID(), Email = request.Email, Reservations = new List <Reservation>()
            };

            foreach (CreateReservationsRequest.Slot slot in request.Slots)
            {
                Reservation reservation = new Reservation()
                {
                    ID = ReservationService.GenerateReservationID(), Email = request.Email, IsConfirmed = false, EndorsementID = request.EndorsementID, Country = request.Country, District = request.District, Year = slot.Year, MonthIndex = slot.MonthIndex, DayIndex = slot.DayIndex, SlotIndex = slot.SlotIndex
                };
                ReservationService.AddReservation(reservation);
                confirmation.Reservations.Add(reservation);
            }
            ReservationService.AddConfirmation(confirmation);

            await ReservationService.SendConfirmationCode(request.Email, confirmation.ID, confirmation.Reservations);

            return(this.MakeSuccess());
        }
Ejemplo n.º 11
0
 public void VerifyQuoteConfirmationDealerExp()
 {
     CPQNavigate.NavigateToBrandDealerExpAccessoriesPage(Brand.RZR, ModelPageUrl.RZR_XP_1000_EPS_BASE_TEST, DEALER_ID);
     Accessories.WaitForAccessoriesPageToLoad();
     Accessories.FooterModule.ClickFooterNextButtonOpenSummary();
     Accessories.WaitUntilBuildSummaryIsDisplayed();
     Accessories.ClikIamFinishedButton();
     Quote.WaitForBuildQuotePageToLoad();
     Quote.FillDealerExpQuoteFormDefaultData();
     Quote.ClickGetInternetPriceButton();
     Confirmation.WaitUntilConfirmationPageLoads();
     Assert.IsFalse(Confirmation.IsSummaryPrintLinkDisplayed(),
                    "Print summary is present on the page for dealer experience URL");
 }
Ejemplo n.º 12
0
        private void Edit(Lowerthird lowerthird)
        {
            Confirmation confirmation = new Confirmation()
            {
                Content = lowerthird, Title = ""
            };

            EditDialogRequest.Raise(confirmation);
            placeholder.Placeholders[lowerthird.Title] = lowerthird.Text;
            if (lowerthird.IsActive)
            {
                Activate(lowerthird);
            }
        }
Ejemplo n.º 13
0
        private void ShowPrintSetupDialog()
        {
            var confirm = new Confirmation();

            confirm.Title = ApplicationStrings.PrintSetupDialogTitle;
            PrintSetupRequest.Raise(confirm,
                                    r =>
            {
                if (r != null && r.Confirmed)
                {
                    // do something!
                }
            });     //)
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Generate new confirmed block
 /// </summary>
 /// <param name="data">Input data</param>
 /// <returns>Block</returns>
 public static Block GenerateNextBlock(string data)
 {
     lock (Lock1)
     {
         var previousBlock     = GetLastBlock();
         var nextIndex         = previousBlock.Index + 1;
         var nextTimestamp     = DateTime.Now.Ticks;
         var nextHash          = Hash.GetHash(nextIndex, previousBlock.Hash, nextTimestamp, data);
         var nextConfirmNumber = Confirmation.FindConfirmNumber(nextHash);
         var block             = new Block(nextIndex, nextConfirmNumber, previousBlock.Hash, nextTimestamp, data, nextHash);
         AddNewBlock(block);
         return(block);
     }
 }
        public void RaiseNotification(DependencyObject parent)
        {
            Confirmation confirmation = new Confirmation();

            confirmation.Title = this.Title;

            InteractionRequestTrigger          trigger     = new InteractionRequestTrigger();
            InteractionRequest <INotification> interaction = new InteractionRequest <INotification>();

            trigger.SourceObject = interaction;
            trigger.Actions.Add(CreateAction());
            trigger.Attach(parent);
            interaction.Raise(confirmation, this.Callback);
        }
Ejemplo n.º 16
0
        private void OnOpenSettingsEditor()
        {
            var notification = new Confirmation();

            notification.Title = "Settings";

            SettingsEditorRequest.Raise(notification, c =>
            {
                if (c.Confirmed && myPresentation != null)
                {
                    myPresentation.InvalidateLayout();
                }
            });
        }
        private void DoDelete()
        {
            Confirmation confirm = new Confirmation();

            confirm.Title   = ApplicationStrings.DeleteAccountTitle;
            confirm.Content = $"Are you sure you want to delete account {Account.AccountName}?\n\nClick OK to delete\nClick Cancel to return to the form.";
            DeleteConfirmationRequest.Raise(confirm,
                                            r => {
                if (r != null && r.Confirmed)
                {
                    DeleteAccount();
                }
            });
        }
Ejemplo n.º 18
0
        private void EffacerVenteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Confirmation cfr = new Confirmation();

            if (cfr.ShowDialog() == DialogResult.OK)
            {
                SqlParameter[] param = new SqlParameter[1];
                param[0]       = new SqlParameter("@NumOB", SqlDbType.Int);
                param[0].Value = dgv_Invoices.CurrentRow.Cells[0].Value.ToString();
                data.ExcuteCommand("DeleteOrderBuying", param);
                dgv_Invoices.DataSource = data.GetData("GetBuyOerder", null);
                ttlAchats.Text          = dgv_Invoices.RowCount.ToString();
            }
        }
        public DirectorDataRetriever ThenConfirmDirector()
        {
            if (_api.Client.State == CommunicationState.Closed)
                _api.Client.Open();

            var confirmReport = _api.Client.confirmDirector(_api.UserToken.ToString(), _director.DirectorId, _director.IdNumber.ToString(),
                Guid.NewGuid().ToString());

            _confirmation = Confirmation.Get(confirmReport);
            if (!_confirmation.Valid())
                throw new Exception(string.Format("Director with Id {0} could not be confirmed", _director.DirectorId));

            return this;
        }
Ejemplo n.º 20
0
        public virtual IFormBuilder <T> Confirm(PromptAttribute prompt, ActiveDelegate <T> condition = null, IEnumerable <string> dependencies = null)
        {
            if (condition == null)
            {
                condition = state => true;
            }
            dependencies = dependencies ?? _form.Dependencies(_form.Steps.Count());
            var confirmation = new Confirmation <T>(prompt, condition, dependencies, _form);

            confirmation.Form = _form;
            _form._fields.Add(confirmation);
            _form._steps.Add(new ConfirmStep <T>(confirmation));
            return(this);
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Handles confirmation from a dialog box and forwards to the waiting task
 /// </summary>
 /// <param name="message"></param>
 public void Handle([NotNull] Confirmation message)
 {
     if (taskActors.ContainsKey(message.TaskId))
     {
         taskActors[message.TaskId].Tell(message);
     }
     else
     {
         eventAggregator.PublishOnUIThread(
             new Messages.LogMessage(Core.Models.Enums.LogLevel.Error,
                                     string.Format("Internal error. Confirmed task with task id {0} was not found anymore!", message.TaskId)
                                     ));
     }
 }
        public void GetTurnoTrancing(AsuntoNotificacionesViewModel _AsuntoViewModel, AsuntoModel _AsuntoModel)
        {
            try
            {
                Confirmation confirmacion = new Confirmation();
                DownloadFile download = new DownloadFile();
                this.DataContext = new TrancingAsuntoTurnoViewModel(_AsuntoViewModel, _AsuntoModel, confirmacion, download);

            }
            catch (Exception)
            {
                ;
            }
        }
        private void DoDelete()
        {
            Confirmation confirm = new Confirmation();

            confirm.Title   = ApplicationStrings.DeleteInvoiceTitle;
            confirm.Content = $"Are you sure you want to delete order {Invoice.InvoiceNumber}?\n\nClick OK to delete. Click Cancel to return to the form.";
            DeleteConfirmationRequest.Raise(confirm,
                                            r => {
                if (r != null && r.Confirmed)
                {
                    DeleteInvoice(Invoice.InvoiceNumber);
                }
            });
        }
Ejemplo n.º 24
0
        private void ShowGeneralPreferences()
        {
            var confirm = new Confirmation();

            confirm.Title = ApplicationStrings.ApplicationSettingsDialogTitle;
            GeneralSettingsRequest.Raise(confirm,
                                         r =>
            {
                if (r != null && r.Confirmed)
                {
                    // do something!
                }
            });     //)
        }
        public void GetRegistroMod(RegistroViewModel view, RegistroModel p)
        {
            try
            {
                Confirmation confirmacion = new Confirmation();

                this.DataContext = new RegistroModViewModel(view, p,confirmacion);
            }
            catch (Exception)
            {

                ;
            }
        }
Ejemplo n.º 26
0
        private void CreateNewProperty(string parameter)
        {
            if (this.model == null)
            {
                throw new InvalidOperationException("Entity is null!");
            }
            if (this.model.State == PersistentState.New)
            {
                Z.Notify(new Notification {
                    Title = "Z-Metadata", Content = "Сущность не записана!"
                });
                return;
            }

            Property property = new Property()
            {
                Entity     = this.model,
                Purpose    = PropertyPurpose.Property,
                Ordinal    = this.model.Properties.Count,
                Name       = $"NewProperty{this.model.Properties.Count}",
                IsAbstract = (parameter == "Abstract")
            };

            Confirmation confirmation = new Confirmation()
            {
                Title   = "Z-Metadata",
                Content = property
            };

            this.PropertyPopup.Raise(confirmation, response =>
            {
                if (response.Confirmed)
                {
                    Property content = response.Content as Property;
                    if (content != null)
                    {
                        this.model.Properties.Add(content);
                        if (content.IsAbstract)
                        {
                            this.AbstractProperties.Add(content);
                        }
                        else
                        {
                            this.OwnProperties.Add(content);
                        }
                    }
                }
            });
        }
        public async Task <IActionResult> Confirm(string id, [FromBody] Confirmation confirmation)
        {
            logger.LogInformation("In Confirm action with id: {Id} and confirmation: {@Confirmation}", id, confirmation.ToLogInfo());

            var delivery = await deliveryRepository.GetAsync(id);

            if (delivery == null)
            {
                logger.LogDebug("Delivery id: {Id} not found", id);
                return(NotFound());
            }

            var confirmedDelivery = new InternalDelivery(delivery.Id,
                                                         delivery.Owner,
                                                         delivery.Pickup,
                                                         confirmation.GeoCoordinates,
                                                         delivery.Deadline,
                                                         delivery.Expedited,
                                                         delivery.ConfirmationRequired,
                                                         delivery.DroneId);

            var internalConfirmation = new InternalConfirmation
            {
                DateTime         = confirmation.DateTime,
                GeoCoordinates   = confirmation.GeoCoordinates,
                ConfirmationType = confirmation.ConfirmationType,
                ConfirmationBlob = confirmation.ConfirmationBlob
            };

            // Adds the delivery complete status event
            await deliveryTrackingRepository.AddAsync(
                new DeliveryTrackingEvent
            {
                DeliveryId = id,
                Stage      = DeliveryStage.Completed
            });

            // sends notifications
            var notifyMeRequests = await notifyMeRequestRepository.GetAllByDeliveryIdAsync(id);

            IEnumerable <Task> notificationTasks = notifyMeRequests.Select(nR => notificationService.SendNotificationsAsync(nR));

            await Task.WhenAll(notificationTasks);

            // logical delivery deletion
            await deliveryRepository.DeleteAsync(id, confirmedDelivery);

            return(Ok());
        }
Ejemplo n.º 28
0
        public ActionResult PhonePurchase(IEnumerable <Guid> valueIds, int musicId, Guid categoryId)
        {
            var  res       = _permCatSrv.CheckPermissionCost(valueIds, musicId, categoryId);
            bool isSuccess = res.Success;

            if (res.Success && res.Entity.Cost == 0)
            {
                var purchase = new Purchase.Purchase();
                purchase.Customer       = User.GetUser();
                purchase.Music          = res.Entity.Music;
                purchase.PurchaseCost   = 0;
                purchase.PurchaseDate   = DateTime.Now;
                purchase.PurchaseStatus = Purchase.PurchaseStatus.NotPaidBycustomer;

                if (res.Entity.IsExistPermission)
                {
                    var addRes =
                        _permCatSrv.GetOrAdd(res.Entity.Permission.PropertyValues.Select(val => val.ID), categoryId);
                    isSuccess = addRes.Success;
                    if (isSuccess)
                    {
                        purchase.Permision = addRes.Entity;
                    }
                }
                else
                {
                    purchase.Permision = res.Entity.Permission;
                }

                if (isSuccess)
                {
                    isSuccess = _prchSrv.Add(purchase).Success;
                }
                if (isSuccess)
                {
                    var confirm = new Confirmation()
                    {
                        ConfirmType = ConfirmType.PhonePurchase,
                        EntityId    = purchase.PurchaseId,
                        Name        = purchase.Music.HebrewName,
                        DateUpdate  = DateTime.Now
                    };

                    isSuccess = _cnfrmSrv.Add(confirm).Success;
                }
            }

            return(Json(isSuccess));
        }
        public async Task Confirm_DeletesDeliveryLogically()
        {
            // Arrange
            InternalDelivery    confirmedDelivery = null;
            DeliveryStatusEvent completeEvent     = null;

            var deliveryRepository = new Mock <IDeliveryRepository>();

            deliveryRepository.Setup(r => r.GetAsync("deliveryid")).ReturnsAsync(delivery);
            deliveryRepository.Setup(r => r.DeleteAsync("deliveryid", It.IsAny <InternalDelivery>()))
            .Returns(Task.CompletedTask)
            .Callback <string, InternalDelivery>((i, d) => confirmedDelivery = d);

            var deliveryStatusEventRepository = new Mock <IDeliveryStatusEventRepository>();

            deliveryStatusEventRepository.Setup(r => r.AddAsync(It.IsAny <DeliveryStatusEvent>()))
            .Returns(Task.CompletedTask)
            .Callback <DeliveryStatusEvent>(e => completeEvent = e);

            deliveryStatusEventRepository.Setup(r => r.GetByDeliveryIdAsync("deliveryid"))
            .ReturnsAsync(new ReadOnlyCollection <DeliveryStatusEvent>(new List <DeliveryStatusEvent>()
            {
                completeEvent
            }));

            var loggerFactory = new Mock <ILoggerFactory>();

            loggerFactory.Setup(f => f.CreateLogger(It.IsAny <string>())).Returns(new Mock <ILogger>().Object);

            var target = new DeliveriesController(deliveryRepository.Object,
                                                  new Mock <INotifyMeRequestRepository>().Object,
                                                  new Mock <INotificationService>().Object,
                                                  new Mock <IDeliveryHistoryService>().Object,
                                                  deliveryStatusEventRepository.Object,
                                                  loggerFactory.Object);
            var location     = new Location(1, 2, 3);
            var confirmation = new Confirmation(new DateTimeStamp("datetimevalue"),
                                                location,
                                                ConfirmationType.Picture,
                                                "confirmationblob");

            // Act
            var result = await target.Confirm("deliveryid", confirmation) as OkResult;

            // Assert
            Assert.IsNotNull(result);
            deliveryRepository.Verify(r => r.DeleteAsync("deliveryid", confirmedDelivery));
            Assert.AreEqual(location, confirmedDelivery.Dropoff);
        }
 public void ServerRelay(RelayMessage message)
 {
     ClientConfirmation(Confirmation.For(message));
     if (message.Tag == RelayMessageTags.InstantMessage)
     {
         Relay(new RelayMessage
         {
             SentDateTimeUtc = DateTimeOffset.UtcNow,
             ToUserId        = message.FromUserId,
             FromUserId      = _userId,
             Tag             = message.Tag,
             Payload         = $"Received: {message.Payload}"
         });
     }
 }
        protected override void RaiseItemAddInteractionRequest()
        {
            var item = _entityFactory.CreateEntity <DynamicContentPublishingGroup>();

            var itemVM = _wizardVmFactory.GetViewModelInstance(
                new KeyValuePair <string, object>("item", item));

            var confirmation = new Confirmation()
            {
                Content = itemVM,
                Title   = "Create content publishing group".Localize()
            };

            ItemAdd(confirmation);
        }
Ejemplo n.º 32
0
        public void ShouldSerializeConfirm()
        {
            // arrange
            var confirm = new Confirmation();
            var radio   = new RadioButtons {
                Confirm = confirm
            };

            // act
            var confirmPayload = SlackClient.SerializeObject(confirm);
            var payload        = SlackClient.SerializeObject(radio);

            // assert
            payload.Should().Contain($"\"confirm\":{confirmPayload}");
        }
        private void OpenPropertySelectionDialog()
        {
            Confirmation confirmation = new Confirmation()
            {
                Title = "Select property", Content = this
            };

            _PropertySelectionDialog.Raise(confirmation, response =>
            {
                if (response.Confirmed)
                {
                    OnExpressionSelected((HermesViewModel)response.Content);
                }
            });
        }
        private void DoCancel()
        {
            var confirm = new Confirmation();

            confirm.Title   = ApplicationStrings.ConfirmCancelTitle;
            confirm.Content = ApplicationStrings.ConfirmCancelPrompt;
            SaveChangesConfirmationRequest.Raise(confirm,
                                                 r =>
            {
                if (r != null && r.Confirmed)
                {
                    InitNewOrder();
                }
            });
        }
Ejemplo n.º 35
0
        public void ShouldAskForConfirmationForSingleSession()
        {
            GivenEventsAreSelected(_displayedEvents[0]);

            _uut.DeleteSelectedEvents();

            var expected = new Confirmation
            {
                Caption = Properties.SessionManager.EventDeleteConfirmTitle,
                Message = Properties.SessionManager.EventDeleteConfirmSingular
            };
            var actual = _confirmationRequestHelper.Context;

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 36
0
        public void RaiseNotification(DependencyObject parent)
        {
            Confirmation tilesetConfirmation = new Confirmation();

            tilesetConfirmation.Title   = this.Title;
            tilesetConfirmation.Content = this.tilesetModel;

            InteractionRequestTrigger          trigger     = new InteractionRequestTrigger();
            InteractionRequest <INotification> interaction = new InteractionRequest <INotification>();

            trigger.SourceObject = interaction;
            trigger.Actions.Add(GetAction());
            trigger.Attach(parent);
            interaction.Raise(tilesetConfirmation, this.Callback);
        }
        public void ShouldSerializeConfirm()
        {
            // arrange
            var confirm  = new Confirmation();
            var overflow = new Overflow {
                Confirm = confirm
            };

            // act
            var confirmPayload = SlackClient.SerializeObject(confirm);
            var payload        = SlackClient.SerializeObject(overflow);

            // assert
            payload.Should().Contain($"\"confirm\":{confirmPayload}");
        }
Ejemplo n.º 38
0
        public void ShouldAskForConfirmationForMultipleSession()
        {
            GivenSessionsAreSelected(_sessionViewModels[0], _sessionViewModels[2]);

            _uut.DeleteSessionsCommand.Execute(null);

            var expected = new Confirmation
            {
                Caption = Properties.SessionManager.SessionDeleteConfirmTitle,
                Message = Properties.SessionManager.SessionDeleteConfirmPlural.FormatEx(2)
            };
            var actual = _confirmationRequestHelper.Context;

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 39
0
        public async Task <ActionResult <Confirmation> > Confirmation(int affiliateId, int customerId, int invoiceId)
        {
            Confirmation returnModel = new Confirmation(Data.Affiliates.Single(x => x.AffiliateId == affiliateId), customerId)
            {
                BillingAddress = await Data.GetBillingAddress(affiliateId, customerId).ConfigureAwait(false)
            };

            returnModel.InvoiceId = invoiceId;

            ViewData["Title"] = string.Concat(returnModel.BillingAddress.FullName, " (", returnModel.Affiliate.Key, ")");
            ViewData["WebServiceHostName"] = Data.WebServiceHostName;
            SetAffiliateColours(0.25);

            return(View(returnModel));
        }
Ejemplo n.º 40
0
        public void ShouldSerializeConfirm()
        {
            // arrange
            var confirm = new Confirmation();
            var button  = new DatePicker {
                Confirm = confirm
            };

            // act
            var confirmPayload = SlackClient.SerializeObject(confirm);
            var payload        = SlackClient.SerializeObject(button);

            // assert
            payload.Should().Contain($"\"confirm\":{confirmPayload}");
        }
Ejemplo n.º 41
0
		internal async Task<Steam.ConfirmationDetails> GetConfirmationDetails(Confirmation confirmation) {
			if (confirmation == null) {
				Logging.LogNullError(nameof(confirmation), Bot.BotName);
				return null;
			}

			uint time = await GetSteamTime().ConfigureAwait(false);
			if (time == 0) {
				Logging.LogNullError(nameof(time), Bot.BotName);
				return null;
			}

			string confirmationHash = GenerateConfirmationKey(time, "conf");
			if (string.IsNullOrEmpty(confirmationHash)) {
				Logging.LogNullError(nameof(confirmationHash), Bot.BotName);
				return null;
			}

			Steam.ConfirmationDetails response = await Bot.ArchiWebHandler.GetConfirmationDetails(DeviceID, confirmationHash, time, confirmation.ID).ConfigureAwait(false);
			if ((response == null) || !response.Success) {
				return null;
			}

			return response;
		}
Ejemplo n.º 42
0
		/// <summary>
		/// Get details for an individual Confirmation
		/// </summary>
		/// <param name="trade">trade Confirmation</param>
		/// <returns>html string of details</returns>
		public string GetConfirmationDetails(Confirmation trade)
		{
			// build details URL
			string url = COMMUNITY_BASE + "/mobileconf/details/" + trade.Id + "?" + ConfirmationsQuery;

			string response = this.GetString(url);
			if (response.IndexOf("success") == -1)
			{
				throw new InvalidSteamRequestException("Invalid request from steam: " + response);
			}
			if (JObject.Parse(response).SelectToken("success").Value<bool>() == true)
			{
				string html = JObject.Parse(response).SelectToken("html").Value<string>();

				Regex detailsRegex = new Regex(@"(.*<body[^>]*>\s*<div\s+class=""[^""]+"">).*(</div>.*?</body>\s*</html>)", RegexOptions.Singleline | RegexOptions.IgnoreCase);
				var match = detailsRegex.Match(this.ConfirmationsHtml);
				if (match.Success == true)
				{
					return match.Groups[1].Value + html + match.Groups[2].Value;
				}
			}

			return "<html><head></head><body><p>Cannot load trade confirmation details</p></body></html>";
		}
Ejemplo n.º 43
0
		/// <summary>
		/// Get the current trade Confirmations
		/// </summary>
		/// <returns>list of Confirmation objects</returns>
		public List<Confirmation> GetConfirmations()
		{
			long servertime = (SteamAuthenticator.CurrentTime + this.Authenticator.ServerTimeDiff) / 1000L;

			var jids = JObject.Parse(this.Authenticator.SteamData).SelectToken("identity_secret");
			string ids = (jids != null ? jids.Value<string>() : string.Empty);

			var timehash = CreateTimeHash(servertime, "conf", ids);

			var data = new NameValueCollection();
			data.Add("p", this.Authenticator.DeviceId);
			data.Add("a", this.Session.SteamId);
			data.Add("k", timehash);
			data.Add("t", servertime.ToString());
			data.Add("m", "android");
			data.Add("tag", "conf");

			string html = GetString(COMMUNITY_BASE + "/mobileconf/conf", "GET", data);

			// save last html for confirmations details
			ConfirmationsHtml = html;
			ConfirmationsQuery = string.Join("&", Array.ConvertAll(data.AllKeys, key => String.Format("{0}={1}", HttpUtility.UrlEncode(key), HttpUtility.UrlEncode(data[key]))));

			List<Confirmation> trades = new List<Confirmation>();

			// extract the trades
			Match match = _tradesRegex.Match(html);
			while (match.Success)
			{
				var tradeIds = match.Groups[1].Value;

				var trade = new Confirmation();

				var innerMatch = _tradeConfidRegex.Match(tradeIds);
				if (innerMatch.Success)
				{
					trade.Id = innerMatch.Groups[1].Value;
				}
				innerMatch = _tradeKeyRegex.Match(tradeIds);
				if (innerMatch.Success)
				{
					trade.Key = innerMatch.Groups[1].Value;
				}

				var traded = match.Groups[2].Value;

				innerMatch = _tradePlayerRegex.Match(traded);
				if (innerMatch.Success)
				{
					if (innerMatch.Groups[1].Value.IndexOf("offline") != -1)
					{
						trade.Offline = true;
					}
					trade.Image = innerMatch.Groups[2].Value;
				}

				innerMatch = _tradeDetailsRegex.Match(traded);
				if (innerMatch.Success)
				{
					trade.Details = innerMatch.Groups[1].Value;
					trade.Traded = innerMatch.Groups[2].Value;
					trade.When = innerMatch.Groups[3].Value;
				}

				trades.Add(trade);

				match = match.NextMatch();
			}

			if (this.Session.Confirmations != null)
			{
				lock (this.Session.Confirmations)
				{
					this.Session.Confirmations.Ids = trades.Select(c => c.Id).ToList();
				}
			}

			return trades;
		}
Ejemplo n.º 44
0
		internal async Task<bool> HandleConfirmation(Confirmation confirmation, bool accept) {
			if (confirmation == null) {
				Logging.LogNullError(nameof(confirmation), Bot.BotName);
				return false;
			}

			uint time = await GetSteamTime().ConfigureAwait(false);
			if (time == 0) {
				Logging.LogNullError(nameof(time), Bot.BotName);
				return false;
			}

			string confirmationHash = GenerateConfirmationKey(time, "conf");
			if (!string.IsNullOrEmpty(confirmationHash)) {
				return await Bot.ArchiWebHandler.HandleConfirmation(DeviceID, confirmationHash, time, confirmation.ID, confirmation.Key, accept).ConfigureAwait(false);
			}

			Logging.LogNullError(nameof(confirmationHash), Bot.BotName);
			return false;
		}
Ejemplo n.º 45
0
 public PlayerNotification(Confirmation conf)
 {
     Confirmation = conf;
 }