예제 #1
0
 public ServerPollResult(ClientEntity[] players,  int[] removedAppleIds, ClientMessage[] recentMessages, GameState gameState, int gameScore, int pacMenLeft)
 {
     Players = players;
     RemovedAppleIds = removedAppleIds;
     RecentMessages = recentMessages;
     GameState = gameState;
     Score = gameScore;
     PacMenLeft = pacMenLeft;
 }
 public PollAndGetAllMapDataResult(ClientEntity[] players, ClientApple[] apples, Geo[] gameBorderPoints, GameState gameState, int score, int pacMenLeft, string lastGameMessage)
 {
     Players = players;
     Apples = apples;
     GameBorderPoints = gameBorderPoints;
     GameState = gameState;
     Score = score;
     PacMenLeft = pacMenLeft;
     LastGameMessage = lastGameMessage;
 }
예제 #3
0
 public BookingEntity(Booking booking)
 {
     _pcs = new PropertyChangeSupport(this);
     _booking = booking;
     _clientEntity = new ClientEntity(_booking.Client);
     _paymentEntity = new PaymentEntity(booking);
     _datesEntity = new DateRangeEntity(_booking.Dates);
     _discountedOptionChoiceEntity = new OptionChoiceEntity(_booking, _booking.DiscountedOptionChoice);
     _optionDiscountEntity = new DiscountEntity(_booking.OptionDiscount);
 }
예제 #4
0
 public async Task DeleteAsync(ClientEntity entity)
 {
     try
     {
         _collection.Delete(entity);
     }
     catch (Exception e)
     {
         throw new ApplicationException(string.Format("Mongo driver failure: {0}", e));
     }
 }
예제 #5
0
        public async Task<ClientEntity> EditAsync(ClientEntity entity)
        {
            ClientEntity result;
            try
            {
                result = _collection.Update(entity);
            }
            catch (Exception e)
            {
                throw new ApplicationException(string.Format("Mongo driver failure: {0}", e));
            }

            return result;
        }
예제 #6
0
        public async Task<ClientEntity> GetAsync(ClientEntity entity)
        {
            if (!string.IsNullOrEmpty(entity.Id))
            {
                return _collection.FirstOrDefault(s => s.Id == entity.Id);
            }

            if (!string.IsNullOrEmpty(entity.UserId))
            {
                return _collection.FirstOrDefault(s => s.UserId == entity.UserId);
            }

            return null;
        }
예제 #7
0
        public ClientBookingsViewModel(ClientEntity clientEntity)
        {
            _pcs = new PropertyChangeSupport(this);
            _clientEntity = clientEntity;
            _clientBookingsSource = CollectionViewProvider.Provider(clientEntity.Bookings);
            _clientBookingsView = _clientBookingsSource.View;
            Booking booking = default(Booking);
            _clientBookingsView.SortDescriptions.Add(new SortDescription($"{nameof(booking.Dates)}.{nameof(booking.Dates.Start)}", ListSortDirection.Ascending));
            _clientBookingsView.CurrentChanged += _clientBookingsView_currentChanged;

            _selectBookingCommand = new DelegateCommand<object>(_selectBooking);
            _cancelBookingCommand = new DelegateCommandAsync<object>(_cancelBooking);

            _clientBookingsView.Filter = _mustShowBooking;
        }
예제 #8
0
        public void Add(Client client)
        {
            var entity = new ClientEntity
            {
                PlaceId = client.Place.Id,
                Name = client.Description,
                Phone = client.Phone,
                IsActive = true,
            };

            _context.Clients.AddObject(entity);
            _context.SaveChanges();

            client.Id = entity.Id;
        }
예제 #9
0
        public SearchClientViewModel(ClientEntity clientEntity, IEnumerable<ClientEntity> clientEntities)
        {
            _pcs = new PropertyChangeSupport(this);
            _displayMoreToggled = false;
            _clientEntity = clientEntity;
            _subClientEntities = new ObservableCollection<ClientEntity>();
            _subClientEntitiesSource = CollectionViewProvider.Provider(_subClientEntities);
            _subClientEntitiesView = _subClientEntitiesSource.View;
            _subClientEntitiesView.CurrentChanged += _subClientEntitiesView_CurrentChanged;

            foreach(ClientEntity clientE in clientEntities)
            {
                if(clientE.FirstName == _clientEntity.FirstName && clientE.LastName == _clientEntity.LastName)
                {
                    _subClientEntities.Add(clientE);
                }
            }

            _needsCount = _subClientEntities.Count > 1;
            _foundClientsCount = _subClientEntities.Count;
        }
예제 #10
0
        public BookingViewModel(LinkedList<INavigableViewModel> navigation, Booking booking, LinkedListNode<INavigableViewModel> prevNode = null)
        {
            _pcs = new PropertyChangeSupport(this);
            _navigation = navigation;
            _parameters = new BookingParametersViewModel(booking);
            _parameters.Defined += _parameters_defined;
            _parameters.PropertyChanged += _parametersChanged;
            _parametersValidated = false;
            _booking = booking;
            _clientEntity = new ClientEntity(_booking.Client);
            _bookingEntity = new BookingEntity(_booking);
            _clientEntity.Bookings.Add(_bookingEntity);
            _computeTitle(_clientEntity);
            _clientEntity.PropertyChanged += _clientChanged;

            _searchClientCommand = new DelegateCommandAsync<BookingViewModel>(_searchClient, false);
            _newClientCommand = new DelegateCommandAsync<BookingViewModel>(_newClient, false);
            _validateBookingCommand = new DelegateCommandAsync<BookingViewModel>(_validateBooking, false);

            if (prevNode == null)
            {
                _navigation.AddLast(this);
            }
            else
            {
                _navigation.AddAfter(prevNode, this);
            }
        }
예제 #11
0
        protected override void Seed(TradesEmulatorDbContext context)
        {
            var client1 = new ClientEntity {
                Name = "Aaron Wolf", Phone = "(812) 904 33 10", Balance = 10000M, RegistationDateTime = DateTime.Now
            };
            var client2 = new ClientEntity {
                Name = "Betany Stutoff", Phone = "(954) 404 13 11", Balance = 9030M, RegistationDateTime = DateTime.Now
            };
            var client3 = new ClientEntity {
                Name = "Anton Zaycev", Balance = 1076M, RegistationDateTime = DateTime.Now
            };
            var client4 = new ClientEntity {
                Name = "Paul Beat", Phone = "(383) 01 21 312 ", Balance = 51003M, RegistationDateTime = DateTime.Now
            };
            var client5 = new ClientEntity {
                Name = "Victor Powers", Balance = 19200M, RegistationDateTime = DateTime.Now
            };
            var client6 = new ClientEntity {
                Name = "Liam Piam", Phone = "(800) 2000 501", Balance = 22120M, RegistationDateTime = DateTime.Now
            };
            var client7 = new ClientEntity {
                Name = "Varian Wrynn", Balance = 20000M, RegistationDateTime = DateTime.Now
            };
            var client8 = new ClientEntity {
                Name = "Alexander Bely", Balance = 8100M, RegistationDateTime = DateTime.Now
            };

            context.Clients.Add(client1);
            context.Clients.Add(client2);
            context.Clients.Add(client3);
            context.Clients.Add(client4);
            context.Clients.Add(client5);
            context.Clients.Add(client6);
            context.Clients.Add(client7);
            context.Clients.Add(client8);

            var shares1 = new SharesEntity {
                SharesType = "Sbeerbank", Price = 836M
            };
            var shares2 = new SharesEntity {
                SharesType = "MMM", Price = 2874M
            };
            var shares3 = new SharesEntity {
                SharesType = "Motherland", Price = 282M
            };

            context.Shares.Add(shares1);
            context.Shares.Add(shares2);
            context.Shares.Add(shares3);

            var clientShares1 = new ClientSharesEntity {
                Shares = shares1, Quantity = 43, Client = client1
            };
            var clientShares2 = new ClientSharesEntity {
                Shares = shares1, Quantity = 30, Client = client2
            };
            var clientShares3 = new ClientSharesEntity {
                Shares = shares1, Quantity = 12, Client = client3
            };
            var clientShares4 = new ClientSharesEntity {
                Shares = shares1, Quantity = 2, Client = client4
            };
            var clientShares5 = new ClientSharesEntity {
                Shares = shares1, Quantity = 92, Client = client5
            };
            var clientShares6 = new ClientSharesEntity {
                Shares = shares1, Quantity = 122, Client = client6
            };
            var clientShares7 = new ClientSharesEntity {
                Shares = shares1, Quantity = 0, Client = client7
            };
            var clientShares8 = new ClientSharesEntity {
                Shares = shares1, Quantity = 0, Client = client8
            };
            var clientShares9 = new ClientSharesEntity {
                Shares = shares2, Quantity = 2, Client = client1
            };
            var clientShares10 = new ClientSharesEntity {
                Shares = shares2, Quantity = 24, Client = client2
            };
            var clientShares11 = new ClientSharesEntity {
                Shares = shares2, Quantity = 43, Client = client3
            };
            var clientShares12 = new ClientSharesEntity {
                Shares = shares2, Quantity = 21, Client = client4
            };
            var clientShares13 = new ClientSharesEntity {
                Shares = shares2, Quantity = 24, Client = client5
            };
            var clientShares14 = new ClientSharesEntity {
                Shares = shares2, Quantity = 36, Client = client6
            };
            var clientShares15 = new ClientSharesEntity {
                Shares = shares2, Quantity = 1, Client = client7
            };
            var clientShares16 = new ClientSharesEntity {
                Shares = shares2, Quantity = 0, Client = client8
            };
            var clientShares17 = new ClientSharesEntity {
                Shares = shares3, Quantity = 87, Client = client1
            };
            var clientShares18 = new ClientSharesEntity {
                Shares = shares3, Quantity = 11, Client = client2
            };
            var clientShares19 = new ClientSharesEntity {
                Shares = shares3, Quantity = 39, Client = client3
            };
            var clientShares20 = new ClientSharesEntity {
                Shares = shares3, Quantity = 48, Client = client4
            };
            var clientShares21 = new ClientSharesEntity {
                Shares = shares3, Quantity = 101, Client = client5
            };
            var clientShares22 = new ClientSharesEntity {
                Shares = shares3, Quantity = 98, Client = client6
            };
            var clientShares23 = new ClientSharesEntity {
                Shares = shares3, Quantity = 2, Client = client7
            };
            var clientShares24 = new ClientSharesEntity {
                Shares = shares3, Quantity = 34, Client = client8
            };

            context.ClientShares.Add(clientShares1);
            context.ClientShares.Add(clientShares2);
            context.ClientShares.Add(clientShares3);
            context.ClientShares.Add(clientShares4);
            context.ClientShares.Add(clientShares5);
            context.ClientShares.Add(clientShares6);
            context.ClientShares.Add(clientShares7);
            context.ClientShares.Add(clientShares8);
            context.ClientShares.Add(clientShares9);
            context.ClientShares.Add(clientShares10);
            context.ClientShares.Add(clientShares11);
            context.ClientShares.Add(clientShares12);
            context.ClientShares.Add(clientShares13);
            context.ClientShares.Add(clientShares14);
            context.ClientShares.Add(clientShares15);
            context.ClientShares.Add(clientShares16);
            context.ClientShares.Add(clientShares17);
            context.ClientShares.Add(clientShares18);
            context.ClientShares.Add(clientShares19);
            context.ClientShares.Add(clientShares20);
            context.ClientShares.Add(clientShares21);
            context.ClientShares.Add(clientShares22);
            context.ClientShares.Add(clientShares23);
            context.ClientShares.Add(clientShares24);

            context.SaveChanges();
        }
예제 #12
0
        private async Task _searchClient(BookingViewModel bookingVM)
        {
            try
            {
                List<Client> clients = await ClientRepository.GetAllClients();
                List<ClientEntity> clientEntities = new List<ClientEntity>(clients.Count);
                foreach (Client client in clients)
                {
                    ClientEntity clientEntity = new ClientEntity(client);
                    clientEntities.Add(clientEntity);
                }
                SearchClientsViewModel searchClientVM = new SearchClientsViewModel(clientEntities);
                searchClientVM.ClientSelected += _searchClient_clientSelected;
                ViewDriverProvider.ViewDriver.ShowView<SearchClientsViewModel>(searchClientVM);
            }
            catch (Exception ex)
            {

                Logger.Log(ex);
            }
        }
예제 #13
0
 public CustomSessionMessageProcessor(ClientEntity clientEntity, SessionHandlerOptions messageOptions, ILogger logger)
     : base(clientEntity, messageOptions)
 {
     _logger = logger;
 }
예제 #14
0
        public async Task ImportClient_Update()
        {
            var options = TestHelper.GetDbContext("ImportClient_Update");

            var user1 = TestHelper.InsertUserDetailed(options);
            var user2 = TestHelper.InsertUserDetailed(options, user1.Organisation);

            var mem = new ClientEntity
            {
                Id             = Guid.NewGuid(),
                ClientTypeId   = ClientType.CLIENT_TYPE_INDIVIDUAL,
                FirstName      = "FN 1",
                LastName       = "LN 1",
                TaxNumber      = "987654",
                DateOfBirth    = DateTime.Now,
                IdNumber       = "8210035032082",
                OrganisationId = user1.Organisation.Id
            };

            using (var context = new DataContext(options))
            {
                context.Client.Add(mem);

                context.SaveChanges();
            }

            using (var context = new DataContext(options))
            {
                var auditService           = new AuditServiceMock();
                var clientService          = new ClientService(context, auditService);
                var lookupService          = new ClientLookupService(context);
                var directoryLookupService = new DirectoryLookupService(context);
                var service = new ClientImportService(context, clientService, null, null, lookupService, directoryLookupService);

                //When
                var data = new ImportClient()
                {
                    IdNumber    = mem.IdNumber,
                    FirstName   = "FN updated",
                    LastName    = "LN updated",
                    TaxNumber   = "456789",
                    DateOfBirth = DateTime.Now.AddDays(-20),
                };

                var scope = TestHelper.GetScopeOptions(user1);

                var result = await service.ImportClient(scope, data);

                //Then
                Assert.True(result.Success);

                var actual = await context.Client.FirstOrDefaultAsync(m => m.IdNumber == data.IdNumber);

                Assert.Equal(user1.Organisation.Id, actual.OrganisationId);
                Assert.Equal(mem.ClientTypeId, actual.ClientTypeId); //Should not have changed
                Assert.Equal(data.FirstName, actual.FirstName);
                Assert.Equal(data.LastName, actual.LastName);
                Assert.Equal(data.TaxNumber, actual.TaxNumber);
                Assert.Equal(data.DateOfBirth, actual.DateOfBirth);
            }
        }
예제 #15
0
 public bool Update(ClientEntity en)
 {
     return(this.dal.Update(en));
 }
예제 #16
0
 public bool Register(ClientEntity en)
 {
     return(this.dal.Register(en));
 }
예제 #17
0
        public SumUpViewModel(LinkedList<INavigableViewModel> navigation, Booking booking, LinkedListNode<INavigableViewModel> prevNode = null)
        {
            _pcs = new PropertyChangeSupport(this);
            _navigation = navigation;
            _booking = booking;
            _dates = booking.Dates;
            _clientEntity = new ClientEntity(booking.Client);
            _paymentEntity = new PaymentEntity(booking);
            _paymentEntity.PropertyChanged += _payment_changed;
            _hasPayment = _booking.Payment != null && _booking.Payment.Ammount > 0d;
            _hadPayment = _hasPayment;
            _wasInTempState = _booking.State == BookingState.Validated;

            _appliedPackEntities = new List<AppliedPackEntity>();
            _optionChoiceEntities = new List<OptionChoiceEntity>(booking.OptionChoices.Count);

            _updateOptionChoiceEntities(booking);

            _title = $"Réservation de {_clientEntity.FirstName} {_clientEntity.LastName} du {booking.Dates.Start:dd/MM/yyyy}";

            _fillAppliedPacksEntities(booking);


            bool canSave = _booking.State == BookingState.Validated;
            _defineCommands(canSave);
            _definePaymentModes();

            _unlockSaveIfNeeded();
            _unlockEditIfNeeded();




            if ((_booking.State != BookingState.Validated && canSave) ||
                (_booking.State == BookingState.Validated && !canSave)
            )
            {
                _saveBookingCommand.ChangeCanExecute();
            }


            if (prevNode != null)
            {
                _navigation.AddAfter(prevNode, this);
            }
            else
            {
                _navigation.AddLast(this);
            }
        }
예제 #18
0
        public async Task GetClient()
        {
            var options = TestHelper.GetDbContext("GetClient");

            var user1 = TestHelper.InsertUserDetailed(options);
            var user2 = TestHelper.InsertUserDetailed(options);

            //Given
            var mem1 = new ClientEntity
            {
                Id             = Guid.NewGuid(),
                OrganisationId = user1.Organisation.Id
            };

            var mem2 = new ClientEntity
            {
                Id               = Guid.NewGuid(),
                ClientTypeId     = Guid.NewGuid(),
                FirstName        = "FN 1",
                LastName         = "LN 1",
                MaidenName       = "MN 1",
                Initials         = "INI 1",
                PreferredName    = "PN 1",
                IdNumber         = "321654",
                DateOfBirth      = new DateTime(1982, 10, 3),
                OrganisationId   = user2.Organisation.Id,
                TaxNumber        = "889977",
                MarritalStatusId = Guid.NewGuid(),
                MarriageDate     = new DateTime(2009, 11, 13)
            };

            using (var context = new DataContext(options))
            {
                context.Client.Add(mem1);
                context.Client.Add(mem2);

                context.SaveChanges();
            }

            using (var context = new DataContext(options))
            {
                var auditService = new AuditServiceMock();
                var service      = new ClientService(context, auditService);

                //When
                var scope  = TestHelper.GetScopeOptions(user2);
                var actual = await service.GetClient(scope, mem2.Id);

                //Then
                Assert.Equal(mem2.Id, actual.Id);
                Assert.Equal(mem2.ClientTypeId, actual.ClientTypeId);
                Assert.Equal(mem2.FirstName, actual.FirstName);
                Assert.Equal(mem2.LastName, actual.LastName);
                Assert.Equal(mem2.MaidenName, actual.MaidenName);
                Assert.Equal(mem2.Initials, actual.Initials);
                Assert.Equal(mem2.PreferredName, actual.PreferredName);
                Assert.Equal(mem2.IdNumber, actual.IdNumber);
                Assert.Equal(mem2.DateOfBirth, actual.DateOfBirth);
                Assert.Equal(mem2.TaxNumber, actual.TaxNumber);
                Assert.Equal(mem2.MarritalStatusId, actual.MarritalStatusId);
                Assert.Equal(mem2.MarriageDate, actual.MarriageDate);

                //Scope check
                scope  = TestHelper.GetScopeOptions(user1);
                actual = await service.GetClient(scope, mem2.Id);

                Assert.Null(actual);
            }
        }
예제 #19
0
        private void _searchClient_clientSelected(object sender, ClientEntity selectedClientEntity)
        {
            try
            {
                Logger.Log("=Recherche de client=");
                Logger.Log("Recherche de client: client sélectionné");
                (sender as SearchClientsViewModel).ClientSelected -= _searchClient_clientSelected;
                Logger.Log("Recherche de client: Affichage des infos client");
                ClientViewModel clientVM = new ClientViewModel(_navigation, selectedClientEntity);
                _currentEntities.Add(clientVM);
                _currentEntitiesView.MoveCurrentToLast();
            }
            catch (Exception ex)
            {

                Logger.Log(ex);
            }
        }
예제 #20
0
        private void _subClient_selected(object sender, ClientEntity selectedClientEntity)
        {
            bool canExecute = _selectClientCommand.CanExecute(null);
            bool cannotExecute = !canExecute;

            _subClientSelected = selectedClientEntity;
            if(
                (selectedClientEntity != null && cannotExecute) ||
                (selectedClientEntity == null && canExecute)
              )
            {
                _selectClientCommand.ChangeCanExecute();
            }
        }
예제 #21
0
        private void _searchBooking_clientSelected(object sender, ClientEntity selectedClientEntity)
        {
            try
            {
                Logger.Log("=Recherche de réservation=");
                Logger.Log($"Recherche de réservation: client sélectionné: {selectedClientEntity.Id}");
                (sender as SearchClientsViewModel).ClientSelected -= _searchBooking_clientSelected;
                Logger.Log("Recherche de réservation: liste des réservations");
                ClientBookingsViewModel clientBookingsVM = new ClientBookingsViewModel(selectedClientEntity);
                clientBookingsVM.BookingSelected += _clientBookings_bookingSelected;
                ViewDriverProvider.ViewDriver.ShowView<ClientBookingsViewModel>(clientBookingsVM);
            }
            catch (Exception ex)
            {

                Logger.Log(ex);
            }
        }
예제 #22
0
        private void _addClient(object ignore)
        {
            try
            {
                Logger.Log("=Ajout d'un nouveau client=");
                Client newClient = new Client();
                ClientEntity newClientEntity = new ClientEntity(newClient);
                Logger.Log("Ajout d'un nouveau client: Affichage de la fiche client");
                ClientViewModel clientVM = new ClientViewModel(_navigation, newClientEntity);
                _currentEntities.Add(clientVM);
                _currentEntitiesView.MoveCurrentToLast();
            }
            catch (Exception ex)
            {

                Logger.Log(ex);
            }
        }
예제 #23
0
 public ServerPollResult(ClientEntity[] players, string message, int[] removedAppleIds)
 {
     Players = players;
     Message = message;
     RemovedAppleIdsInLastFiveSeconds = removedAppleIds;
 }
예제 #24
0
 public GetGameStateResult(ClientEntity[] apples)
 {
     Apples = apples;
 }
예제 #25
0
        public async Task GetClientPreview()
        {
            var options = TestHelper.GetDbContext("GetClientPreview");

            var user1 = TestHelper.InsertUserDetailed(options);

            //Given
            var mem1 = new ClientEntity
            {
                Id             = Guid.NewGuid(),
                OrganisationId = user1.Organisation.Id
            };

            var mem2 = new ClientEntity
            {
                Id             = Guid.NewGuid(),
                ClientTypeId   = Guid.NewGuid(),
                FirstName      = "FN 1",
                LastName       = "LN 1",
                IdNumber       = "321654",
                DateOfBirth    = new DateTime(1982, 10, 3),
                OrganisationId = user1.Organisation.Id
            };

            var policy1 = new PolicyEntity
            {
                Id       = Guid.NewGuid(),
                ClientId = mem2.Id,
                UserId   = user1.User.Id
            };

            var policy2 = new PolicyEntity
            {
                Id       = Guid.NewGuid(),
                ClientId = mem2.Id,
                UserId   = user1.User.Id
            };

            var contact1 = new ContactEntity
            {
                Id            = Guid.NewGuid(),
                ClientId      = mem2.Id,
                ContactTypeId = ContactType.CONTACT_TYPE_EMAIL,
                Value         = "*****@*****.**"
            };

            using (var context = new DataContext(options))
            {
                context.Client.Add(mem1);
                context.Client.Add(mem2);

                context.Policy.Add(policy1);
                context.Policy.Add(policy2);

                context.Contact.Add(contact1);

                context.SaveChanges();
            }

            using (var context = new DataContext(options))
            {
                var auditService = new AuditServiceMock();
                var service      = new ClientService(context, auditService);

                //When
                var scopeOptions = TestHelper.GetScopeOptions(user1);
                var actual       = await service.GetClientPreview(scopeOptions, mem2.Id);

                //Then
                Assert.Equal(mem2.Id, actual.Id);
                Assert.Equal(mem2.ClientTypeId, actual.ClientTypeId);
                Assert.Equal(mem2.FirstName, actual.FirstName);
                Assert.Equal(mem2.LastName, actual.LastName);
                Assert.Equal(mem2.IdNumber, actual.IdNumber);
                Assert.Equal(mem2.DateOfBirth, actual.DateOfBirth);

                Assert.Equal(2, actual.PolicyCount);
                Assert.Equal(1, actual.ContactCount);
            }
        }
예제 #26
0
 public DataTable GetByID(ClientEntity en)
 {
     return(this.dal.GetByID(en));
 }
예제 #27
0
        public async Task UpdateClient()
        {
            var options = TestHelper.GetDbContext("UpdateClient");

            var user1 = TestHelper.InsertUserDetailed(options);
            var user2 = TestHelper.InsertUserDetailed(options);

            //Given
            var mem1 = new ClientEntity {
                Id = Guid.NewGuid(), FirstName = "FN 1", LastName = "LN 1", OrganisationId = user1.Organisation.Id
            };
            var mem2 = new ClientEntity
            {
                Id               = Guid.NewGuid(),
                ClientTypeId     = ClientType.CLIENT_TYPE_INDIVIDUAL,
                FirstName        = "FN 1",
                LastName         = "LN 1",
                MaidenName       = "MN 1",
                Initials         = "INI 1",
                PreferredName    = "PN 1",
                IdNumber         = "8210035032082",
                DateOfBirth      = new DateTime(1982, 10, 3),
                OrganisationId   = user2.Organisation.Id,
                TaxNumber        = "889977",
                MarritalStatusId = Guid.NewGuid(),
                MarriageDate     = new DateTime(2009, 11, 13)
            };

            using (var context = new DataContext(options))
            {
                context.Client.Add(mem1);
                context.Client.Add(mem2);

                context.SaveChanges();
            }

            var client = new ClientEdit()
            {
                Id               = mem2.Id,
                ClientTypeId     = ClientType.CLIENT_TYPE_INDIVIDUAL,
                FirstName        = "FN 1 updated",
                LastName         = "LN 1 updated",
                MaidenName       = "MN 1 updated",
                Initials         = "INI 1 updated",
                PreferredName    = "PN 1 updated",
                IdNumber         = "8206090118089",
                DateOfBirth      = new DateTime(1983, 10, 3),
                TaxNumber        = "445566",
                MarritalStatusId = Guid.NewGuid(),
                MarriageDate     = new DateTime(2010, 11, 13)
            };

            using (var context = new DataContext(options))
            {
                var auditService = new AuditServiceMock();
                var service      = new ClientService(context, auditService);

                //When
                var scope  = TestHelper.GetScopeOptions(user2);
                var result = await service.UpdateClient(scope, client);

                //Then
                Assert.True(result.Success);

                var actual = await context.Client.FindAsync(client.Id);

                Assert.Equal(client.Id, actual.Id);
                Assert.Equal(client.ClientTypeId, actual.ClientTypeId);
                Assert.Equal(user2.Organisation.Id, actual.OrganisationId);
                Assert.Equal(client.FirstName, actual.FirstName);
                Assert.Equal(client.LastName, actual.LastName);
                Assert.Equal(client.MaidenName, actual.MaidenName);
                Assert.Equal(client.Initials, actual.Initials);
                Assert.Equal(client.PreferredName, actual.PreferredName);
                Assert.Equal(client.IdNumber, actual.IdNumber);
                Assert.Equal(client.DateOfBirth, actual.DateOfBirth);
                Assert.Equal(client.TaxNumber, actual.TaxNumber);
                Assert.Equal(client.MarritalStatusId, actual.MarritalStatusId);
                Assert.Equal(client.MarriageDate, actual.MarriageDate);

                //Scope check
                scope  = TestHelper.GetScopeOptions(user1);
                result = await service.UpdateClient(scope, client);

                //Then
                Assert.False(result.Success);
            }
        }
예제 #28
0
 public bool Add(ClientEntity en)
 {
     return(this.dal.Add(en));
 }
예제 #29
0
    public void SyncEntityInfoToServer(ClientEntity entity)
    {
        Transform transform = entity.transform;

        gameClient.SyncEntityInfoToServer(entity.ID, transform.position.x, transform.position.y, transform.position.z, entity.GetYaw());
    }
예제 #30
0
    private void EntityEvent(ClientEntity cEntity, Vector3 position)
    {
        EntityState     es  = cEntity.currentState;
        EntityEventType evt = (EntityEventType)((int)es.eventID & ~CConstVar.EVENT_BITS);

        if (evt == 0)
        {
            return;
        }
        int idx = es.clientNum;

        if (idx < 0 || idx >= CConstVar.MAX_CLIENTS)
        {
            idx = 0;
        }
        // clieni
        var ci = clientInfos[idx];

        switch (evt)
        {
        case EntityEventType.FOOTSTEP:
            break;

        case EntityEventType.FOOTWADE:
            break;

        case EntityEventType.SWIM:
            break;

        case EntityEventType.STEP_4:
            break;

        case EntityEventType.STEP_8:
            break;

        case EntityEventType.STEP_12:
            break;

        case EntityEventType.STEP_16:
            break;

        case EntityEventType.FALL_SHORT:
            break;

        case EntityEventType.FALL_MEDIUM:
            break;

        case EntityEventType.FALL_FAR:
            break;

        case EntityEventType.JUMP_PAD:
            break;

        case EntityEventType.JUMP:
            break;

        case EntityEventType.ITEM_PICKUP:
            break;

        case EntityEventType.GLOBAL_ITEM_PICKUP:
            break;

        case EntityEventType.CAST_SKILL_0:
            break;

        case EntityEventType.CAST_SKILL_1:
            break;

        case EntityEventType.CAST_SKILL_2:
            break;

        case EntityEventType.CAST_SKILL_3:
            break;

        case EntityEventType.CAST_SKILL_4:
            break;

        case EntityEventType.CAST_SKILL_5:
            break;

        case EntityEventType.CAST_SKILL_6:
            break;

        case EntityEventType.CAST_SKILL_7:
            break;

        case EntityEventType.USE_ITEM_0:
            break;

        case EntityEventType.USE_ITEM_1:
            break;

        case EntityEventType.USE_ITEM_2:
            break;

        case EntityEventType.USE_ITEM_3:
            break;

        case EntityEventType.USE_ITEM_4:
            break;

        case EntityEventType.USE_ITEM_5:
            break;

        case EntityEventType.USE_ITEM_6:
            break;

        case EntityEventType.USE_ITEM_7:
            break;

        case EntityEventType.USE_ITEM_8:
            break;

        case EntityEventType.USE_ITEM_9:
            break;

        case EntityEventType.ITEM_RESPAWN:
            break;

        case EntityEventType.ITEM_POP:
            break;

        case EntityEventType.PLAYER_TELEPORT_IN:
            break;

        case EntityEventType.PLAYER_TELEPORT_OUT:
            break;

        case EntityEventType.GENERAL_SOUND:
            break;

        case EntityEventType.GLOBAL_SOUND:
            break;

        case EntityEventType.GLOBAL_ITEM_SOUND:
            break;

        case EntityEventType.MISSILE_HIT:
            break;

        case EntityEventType.MISSILE_MISS:
            break;

        case EntityEventType.HEALTH_REGEN:
            break;

        case EntityEventType.MANA_REGEN:
            break;

        case EntityEventType.DEBUG_LINE:
            break;
        }
    }
예제 #31
0
 public void Update(ClientEntity client)
 {
     _clientRepository.Update(client);
 }
예제 #32
0
 public void Remove(ClientEntity entity)
 {
     dbContext.Client.Remove(entity);
 }
예제 #33
0
 public void OnDirection(ClientEntity entity, Vec2 value)
 {
     transform.localEulerAngles = CUtils.DirectionToRotation(value);
 }
예제 #34
0
        public async Task ImportClient_Update_WithContacts()
        {
            var options = TestHelper.GetDbContext("ImportClient_Update_WithContacts");

            var user1 = TestHelper.InsertUserDetailed(options);

            var mem = new ClientEntity
            {
                Id             = Guid.NewGuid(),
                ClientTypeId   = ClientType.CLIENT_TYPE_INDIVIDUAL,
                IdNumber       = "8210035032082",
                OrganisationId = user1.Organisation.Id
            };

            var contact1 = new ContactEntity
            {
                ClientId      = mem.Id,
                ContactTypeId = ContactType.CONTACT_TYPE_EMAIL,
                Value         = "*****@*****.**"
            };

            var contact2 = new ContactEntity
            {
                ClientId      = mem.Id,
                ContactTypeId = ContactType.CONTACT_TYPE_CELLPHONE,
                Value         = "0825728997"
            };

            using (var context = new DataContext(options))
            {
                context.Client.Add(mem);
                context.Contact.Add(contact1);
                context.Contact.Add(contact2);

                context.SaveChanges();
            }

            using (var context = new DataContext(options))
            {
                var auditService           = new AuditServiceMock();
                var clientService          = new ClientService(context, auditService);
                var contactService         = new ContactService(context, auditService);
                var lookupService          = new ClientLookupService(context);
                var directoryLookupService = new DirectoryLookupService(context);
                var service = new ClientImportService(context, clientService, null, contactService, lookupService, directoryLookupService);

                //When
                var data = new ImportClient()
                {
                    IdNumber  = "8210035032082",
                    Email     = contact1.Value,
                    Cellphone = "082 572-8997"
                };

                var scope = TestHelper.GetScopeOptions(user1);

                var result = await service.ImportClient(scope, data);

                //Then
                Assert.True(result.Success);

                var client = await context.Client.FirstOrDefaultAsync(m => m.IdNumber == data.IdNumber);

                var contacts = await context.Contact.Where(c => c.ClientId == client.Id).ToListAsync();

                Assert.Equal(2, contacts.Count);
                var actual = contacts.First();
                Assert.Equal(data.Email, actual.Value);
                Assert.Equal(ContactType.CONTACT_TYPE_EMAIL, actual.ContactTypeId);

                actual = contacts.Last();
                Assert.Equal(contact2.Value, actual.Value);
                Assert.Equal(ContactType.CONTACT_TYPE_CELLPHONE, actual.ContactTypeId);
            }
        }
예제 #35
0
 private void _computeTitle(ClientEntity clientEntity)
 {
     string clientDesc = null;
     if (clientEntity.FirstName != null || clientEntity.LastName != null)
     {
         clientDesc = string.Format("{0} {1}", clientEntity.FirstName, clientEntity.LastName);
     }
     _title = string.Format("Réservation: {0}{1:HH mm ss}", clientDesc, clientDesc == null ? (DateTime?)_booking.CreationDate : null);
 }
예제 #36
0
 public void Create(ClientEntity client)
 {
     _clientRepository.Create(client);
 }
예제 #37
0
        private async void _searchClient_clientSelected(object sender, ClientEntity selectedClientEntity)
        {
            try
            {
                (sender as SearchClientsViewModel).ClientSelected -= _searchClient_clientSelected;
                _booking.Client = selectedClientEntity.Client;
                await _roomChoices.AssignRoomsCommand.ExecuteAsync(_booking);

                LinkedListNode<INavigableViewModel> prevNode = _navigation.Find(this);
                SumUpViewModel sumUpVM = new SumUpViewModel(_navigation, _booking, prevNode);
                NextCalled?.Invoke(null, this);
            }
            catch (Exception ex)
            {

                Logger.Log(ex);
            }
        }
예제 #38
0
 public virtual void OnPosition(ClientEntity entity, Vec2 value)
 {
     transform.localPosition = new Vector3(value.x, 0, value.y);
 }
예제 #39
0
 public virtual void Send(ClientEntity sender, string package)
 {
     _callback._client_sender.Handle(sender, Encoding.UTF8.GetBytes(package));
 }
예제 #40
0
 public virtual void OnDestroyed(ClientEntity entity)
 {
     DoDestroy();
 }
예제 #41
0
 public ClientEntity Create(ClientEntity clientEntity)
 {
     _db.Add(clientEntity);
     _db.SaveChanges();
     return(clientEntity);
 }
예제 #42
0
 public ClientInterestArea(ClientEntity attachedEntity) : base(attachedEntity)
 {
     m_PositionFilter  = FilterFactory.CreatePositionFilter(attachedEntity);
     m_EnterExitFilter = EnterExitFilterFactory.CreateEnterExitFilter(attachedEntity);
     m_SubscriptionManagementFiber.Start();
 }
예제 #43
0
 public void UpdateClient(ClientEntity client)
 {
     clientsRepository.Update(client);
     clientsRepository.SaveChanges();
 }
 public SessionMessageProcessor(ClientEntity clientEntity, SessionHandlerOptions sessionHandlerOptions)
 {
     ClientEntity          = clientEntity ?? throw new ArgumentNullException(nameof(clientEntity));
     SessionHandlerOptions = sessionHandlerOptions ?? throw new ArgumentNullException(nameof(sessionHandlerOptions));
 }
예제 #45
0
        public ActionResult Create(ClientViewModel collection)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ClientEntity clientEntity = new ClientEntity()
                    {
                        AbsoluteRefreshTokenLifetime = collection.AbsoluteRefreshTokenLifetime,
                        AccessTokenLifetime          = collection.AccessTokenLifetime,
                        AccessTokenType             = collection.AccessTokenType,
                        AllowAccessTokensViaBrowser = collection.AllowAccessTokensViaBrowser,
                        AllowedCorsOrigins          = collection.AllowedCorsOrigins,
                        AllowedGrantTypes           = collection.AllowedGrantTypes,
                        AllowedScopes                    = collection.AllowedScopes,
                        AllowOfflineAccess               = collection.AllowOfflineAccess,
                        AllowPlainTextPkce               = collection.AllowPlainTextPkce,
                        AllowRememberConsent             = collection.AllowRememberConsent,
                        AlwaysIncludeUserClaimsInIdToken = collection.AlwaysIncludeUserClaimsInIdToken,
                        AlwaysSendClientClaims           = collection.AlwaysSendClientClaims,
                        AuthorizationCodeLifetime        = collection.AuthorizationCodeLifetime,
                        BackChannelLogoutSessionRequired = collection.BackChannelLogoutSessionRequired,
                        BackChannelLogoutUri             = collection.BackChannelLogoutUri,
                        Claims             = collection.Claims,
                        ClientClaimsPrefix = collection.ClientClaimsPrefix,
                        ClientId           = collection.ClientId,
                        ClientName         = collection.ClientName,
                        ClientSecrets      = collection.ClientSecrets,
                        ClientUri          = collection.ClientUri,
                        ConsentLifetime    = collection.ConsentLifetime,
                        Enabled            = collection.Enabled,
                        EnableLocalLogin   = collection.EnableLocalLogin,
                        FrontChannelLogoutSessionRequired = collection.FrontChannelLogoutSessionRequired,
                        FrontChannelLogoutUri             = collection.FrontChannelLogoutUri,
                        IdentityProviderRestrictions      = collection.IdentityProviderRestrictions,
                        IdentityTokenLifetime             = collection.IdentityTokenLifetime,
                        IncludeJwtId                     = collection.IncludeJwtId,
                        LogoUri                          = collection.LogoUri,
                        PairWiseSubjectSalt              = collection.PairWiseSubjectSalt,
                        PostLogoutRedirectUris           = collection.PostLogoutRedirectUris,
                        Properties                       = collection.Properties,
                        ProtocolType                     = collection.ProtocolType,
                        RedirectUris                     = collection.RedirectUris,
                        RefreshTokenExpiration           = collection.RefreshTokenExpiration,
                        RefreshTokenUsage                = collection.RefreshTokenUsage,
                        RequireClientSecret              = collection.RequireClientSecret,
                        RequireConsent                   = collection.RequireConsent,
                        RequirePkce                      = collection.RequirePkce,
                        SlidingRefreshTokenLifetime      = collection.SlidingRefreshTokenLifetime,
                        UpdateAccessTokenClaimsOnRefresh = collection.UpdateAccessTokenClaimsOnRefresh
                    };

                    _clientStore.CreateClient(clientEntity);

                    return(RedirectToAction(nameof(Index)));
                }

                return(View(collection));
            }
            catch
            {
                return(View());
            }
        }
예제 #46
0
 public void Add(ClientEntity entity)
 {
     dbContext.Client.Add(entity);
 }
예제 #47
0
 public bool Validate_Login(ClientEntity en)
 {
     return(this.dal.Validate_Login(en));
 }
예제 #48
0
 public ClientEntity Update(ClientEntity clientEntity)
 {
     _db.Attach(clientEntity);
     _db.SaveChanges();
     return(clientEntity);
 }
예제 #49
0
 public DataTable select(ClientEntity en)
 {
     return(this.dal.select(en));
 }
예제 #50
0
        //void ExecuteData(object objval)
        public void ExecuteDataTest( string receiveString)
        {
            try
               {
               if (receiveString.Length >= 8)
               {
                   //心跳
                   if (receiveString.Substring(0, 8).Equals("2183FF00") == true || receiveString.Substring(0, 8).Equals("21848500") == true || receiveString.Substring(0, 8).Equals("21838500") == true)
                   {
                       //LogHelper.Instance.AddLog("日志", "服务端(ExecuteData)", string.Format("心跳:" + _ClientSocket.RemoteEndPoint.ToString() + receiveString));
                       String strCode = "";
                       if (receiveString.Substring(0, 8).Equals("2183FF00") == true)
                           strCode = ArConvert.Convert16ToInt(receiveString.Substring(8, 4)).ToString();
                       else
                           strCode = ArConvert.Convert16ToInt(receiveString.Substring(14, 4)).ToString();
                       if (this.priClientList.Any(m => m.Code.Equals(strCode) == true) == false) //新增
                       {
                           //this.priClientList.Add(new ClientEntity(strCode, _ClientSocket, DateTime.Now) { RemoteEndPoint = _ClientSocket.RemoteEndPoint.ToString() });
                           //LogHelper.Instance.AddLog("日志", "Sql1", "  update SRTE_Device set Updatetiem=[$Updatetiem$] where Code=[$Code$]___________ " + DateTime.Now + strCode);

                           DataBaseHelper.Instance.Helper.ExecuteNonQuery(System.Data.CommandType.Text, "  update SRTE_Device set Updatetiem=[$Updatetiem$] where Code=[$Code$] "
                              , new DataParameter("Updatetiem", DateTime.Now), new DataParameter("Code", strCode)
                               );
                       }
                       else //修改
                       {
                           ClientEntity clientEnt = this.priClientList.FirstOrDefault(m => m.Code.Equals(strCode) == true);
                           //if (clientEnt.RemoteEndPoint.Equals(_ClientSocket.RemoteEndPoint.ToString()) == false)
                           {
                               clientEnt.RefreshTime = DateTime.Now;

                               //LogHelper.Instance.AddLog("日志", "Sql2", "  update SRTE_Device set Updatetiem=[$Updatetiem$] where Code=[$Code$]___________ " + DateTime.Now + strCode);

                               DataBaseHelper.Instance.Helper.ExecuteNonQuery(System.Data.CommandType.Text, "  update SRTE_Device set Updatetiem=[$Updatetiem$] where Code=[$Code$] "
                              , new DataParameter("Updatetiem", DateTime.Now), new DataParameter("Code", strCode)
                               );
                           }
                       }
                   }
                   if (receiveString.Substring(0, 8).Equals("2183FF00") == false)
                   {
                       //if (this.priClientList.Any(m => m.RemoteEndPoint.Equals(_ClientSocket.RemoteEndPoint.ToString()) == true) == true) //有效设备
                       {
                           ClientEntity clientEnt = new ClientEntity(); //this.priClientList.FirstOrDefault(m => m.RemoteEndPoint.Equals(_ClientSocket.RemoteEndPoint.ToString()) == true);
                           clientEnt.RefreshTime = DateTime.Now;

                           String strsql = "delete from SRTE_DeviceCMD where addtime<DateAdd(day,-5,getdate());update SRTE_Device set Updatetiem=getdate() where Code=(select top 1 SRTE_DeviceCode from SRTE_DeviceCMD where Code=[$Code$]); update SRTE_DeviceCMD set State=1,ReturnCMD='" + receiveString + "' where Code=[$Code$]; ";
                           if (receiveString.Substring(0, 8).Equals("2183A900") == true) //信号机报警
                           {
                               //receiveString
                               String strDe = "";
                               //Int32 ipid = -1;
                               string strejz = ArConvert.Convert16To2(receiveString.Substring(10, 2), 8);
                               Int32 ixw1 = ArConvert.Convert16ToInt(receiveString.Substring(12, 2));
                               Int32 ixw2 = ArConvert.Convert16ToInt(receiveString.Substring(14, 2));
                               if (strejz.Substring(0, 1) == "1" && ixw1 > 0)
                                   strDe += "相位" + ixw1 + "红绿灯同亮;";
                               if (strejz.Substring(1, 1) == "1" && ixw1 > 0)
                                   strDe += "相位" + ixw1 + "红灯故障;";
                               if (strejz.Substring(2, 1) == "1" && ixw1 > 0 && ixw2 > 0)
                                   strDe += "相位" + ixw1 + "、" + ixw2 + "绿冲突;";
                               if (strejz.Substring(3, 1) == "1")
                                   strDe += "通信故障;";
                               if (strejz.Substring(4, 1) == "1")
                                   strDe += "其它故障;";
                               if (strejz.Substring(5, 1) == "1")
                                   strDe += "液晶屏故障;";
                               if (strejz.Substring(6, 1) == "1")
                                   strDe += "存储器故障;";
                               if (strejz.Substring(6, 1) == "1")
                                   strDe += "时钟故障;";
                               if (strejz.Equals("00000000") == true)
                                   strDe += "故障解除;";
                               strDe = strDe.TrimEnd(';');
                               strsql += " insert into SR_Systemrecord(Pid,Title,Description,Adddate,Ltype) values(1,[$Code$],'" + strDe + "',GETDATE(),'事件');";
                           }
                           else if (receiveString.Substring(0, 8).Equals("2183A100") == true) //检测器数据表
                           {
                               //insert into SRTE_Flow values('',GETDATE(),1,1);
                               for (int i = 1; i < 49; i++)
                               {
                                   strsql += String.Format(" insert into SRTE_Flow values([$Code$],GETDATE(),{0},{1}); ",
                                           i,
                                           ArConvert.Convert16ToInt(receiveString.Substring(10 + (i - 1) * 14 + 2, 2))
                                       );
                               }
                           }
                           DataBaseHelper.Instance.Helper.ExecuteNonQuery(CommandType.Text, strsql, new DataParameter("Code", clientEnt.MsgCode));
                           clientEnt.MsgCode = "";
                           clientEnt.CMD = "";
                       }
                   }
               }
               }
               catch (Exception ex)
               {
               Console.WriteLine(String.Format("{0}_方法:{1}_数据包:{2}_异常内容:{3}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "ExecuteData", receiveString, ex.Message));
               LogHelper.Instance.AddLog("日志", "异常", String.Format("{0}_方法:{1}_数据包:{2}_异常内容:{3}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "ExecuteData", receiveString, ex.Message));
               //LogHelper.Instance.AddLog("异常", "服务端(ExecuteData)", ex.Message);
               }
        }
예제 #51
0
 public void Asp(GridView gv, AspNetPager pager, ClientEntity en)
 {
     this.dal.Asp(gv, pager, en);
 }