예제 #1
0
 internal DeletionReasonDto FromDeletionReason(DeletionReason res)
 {
     return(new DeletionReasonDto
     {
         Id = res.Id,
         Title = res.Title
     });
 }
예제 #2
0
        public static void OnTheRoomWasDeleted(DeletionReason reason)
        {
            var logger = NLog.LogManager.GetCurrentClassLogger();

            logger.Info("Game client got info about room deletion from host. Type: " + reason.ToString());

            TheRoomWasDeleted?.Invoke(null, new RoomDeletionReasonsEventArgs {
                DeletionReason = reason
            });
        }
        private void DeleteOrder()
        {
            var result = MessageBox.Show("Вы уверены, что хотите удалить заказ?", "", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                var deleteReason = new DeletionReason();
                deleteReason.ShowDialog();
                if (deleteReason.DialogResult == true)
                {
                    MessageBox.Show("Заказ удален успешно!");
                    Data.Instance.Orders.Remove(ThisOrder);
                    NavigationService.GoBack();
                }
            }
        }
예제 #4
0
        //room was deleted by the host
        private void RoomDeletionReasonMessageBox(DeletionReason reason)
        {
            var logger = NLog.LogManager.GetCurrentClassLogger();

            logger.Info("The room was closed. Reason: " + reason.ToString());

            switch (reason)
            {
            case DeletionReason.ClosedByHost:
                MessageBox.Show("Host tej gry usunął pokój.\nNastąpiło przeniesienie do okna głównego.",
                                "Informacja", MessageBoxButton.OK, MessageBoxImage.Warning);
                break;

            case DeletionReason.JoiningTimeout:
                MessageBox.Show("Przekroczono dozwolony czas podłączania graczy do pokoju.\nPokój został zamknięty",
                                "Informacja", MessageBoxButton.OK, MessageBoxImage.Warning);
                break;

            case DeletionReason.ReadinessTimeout:
                MessageBox.Show("Przekroczono dozwolony czas potwierdzenia gotowości do gry.\nPokój został zamknięty",
                                "Informacja", MessageBoxButton.OK, MessageBoxImage.Warning);
                break;

            case DeletionReason.LostConnection:
                MessageBox.Show("Jeden z graczy nie odpowiada.\nPokój został zamknięty.",
                                "Informacja", MessageBoxButton.OK, MessageBoxImage.Warning);
                break;

            case DeletionReason.PlayerLeftGame:
                MessageBox.Show("Jeden z graczy zamknął okno z grą.\nPokój został zamknięty.",
                                "Informacja", MessageBoxButton.OK, MessageBoxImage.Warning);
                break;

            default:
                MessageBox.Show("Pokój został zamknięty.",
                                "Informacja", MessageBoxButton.OK, MessageBoxImage.Warning);
                break;
            }

            SynchCont.Post(_ => EnableOrDisableMenu(true), null);
        }
예제 #5
0
        public void PerformDeleteAd_AdExists_PasswordMatches_MarkAdAsDeletedAndRemoveFromSearchAdCache()
        {
            // Given
            DeleteAdModel model = new DeleteAdModel
            {
                AdId     = 56,
                Password = "******",
                NbTry    = 1,
                SelectedDeletionReasonId = 7
            };
            DeletionReason dr = new DeletionReason()
            {
                Id = 7
            };
            SearchAdCache adc = new SearchAdCache()
            {
                AdId = 56
            };
            User creator = new User()
            {
                Password = "******"
            };
            BaseAd ad = new Ad()
            {
                Id        = 56,
                CreatedBy = creator
            };

            var adRepoMock = new Moq.Mock <IAdRepository>();

            adRepoMock.Setup(r => r.GetAdById <BaseAd>(model.AdId)).Returns(ad);

            var repoMock = new Moq.Mock <IRepository>();

            repoMock.Setup(x => x.Get <DeletionReason>(7)).Returns(dr);
            repoMock.Setup(x => x.Get <SearchAdCache>(model.AdId)).Returns(adc);
            repoMock.Setup(x => x.Save <BaseAd>(ad));
            repoMock.Setup(x => x.Delete <SearchAdCache>(adc));

            var helperMock = new Moq.Mock <IHelperService>();

            helperMock.Setup(x => x.GetCurrentDateTime()).Returns(new DateTime(2013, 01, 26));

            AdDeletionServices service = new AdDeletionServices(adRepoMock.Object, repoMock.Object, helperMock.Object);

            // When
            DeleteAdModel result = service.DeleteAd(model);

            // Then
            Assert.AreEqual(model.AdId, result.AdId);
            Assert.IsNull(result.Password);
            Assert.IsNull(result.SelectedDeletionReasonId);
            Assert.AreEqual(0, result.NbTry);
            Assert.AreEqual("Votre annonce a correctement été supprimée. Elle n'est plus disponible à la recherche.", result.InfoMessage);
            Assert.IsFalse(result.CanDeleteAd);
            Assert.IsTrue(result.IsDeleted);

            Assert.AreEqual(new DateTime(2013, 01, 26), ad.DeletionDate);
            Assert.IsTrue(ad.IsDeleted);
            Assert.AreEqual(dr, ad.DeletedReason);

            repoMock.Verify(x => x.Save <BaseAd>(ad), Times.Once());
            repoMock.Verify(x => x.Delete <SearchAdCache>(adc), Times.Once());
        }
        public virtual async System.Threading.Tasks.Task <AsyncStatusResult> asyncDeleteListAsync(BaseRef[] baseRef, DeletionReason deletionReason)
        {
            var request = new asyncDeleteListRequest()
            {
                passport        = passport,
                tokenPassport   = tokenPassport,
                applicationInfo = applicationInfo,
                partnerInfo     = partnerInfo,
                preferences     = preferences,
                baseRef         = baseRef,
                deletionReason  = deletionReason,
            };
            var response = await((NetSuitePortType)this).asyncDeleteListAsync(request);

            return(response.asyncStatusResult);
        }
        public virtual async System.Threading.Tasks.Task <WriteResponse> deleteAsync(BaseRef baseRef, DeletionReason deletionReason)
        {
            var request = new deleteRequest()
            {
                passport        = passport,
                tokenPassport   = tokenPassport,
                applicationInfo = applicationInfo,
                partnerInfo     = partnerInfo,
                preferences     = preferences,
                baseRef         = baseRef,
                deletionReason  = deletionReason,
            };
            var response = await((NetSuitePortType)this).deleteAsync(request);

            return(response.writeResponse);
        }
 //receiving information from host that The Room was deleted
 void IMakaoGameClientService.RoomWasDeleted(DeletionReason request)
 {
     DataPlaceholder.OnTheRoomWasDeleted(request);
 }