示例#1
0
        public void StorePlayerDetailsChanges(Person player, Contract contract, HealthCheckEvidention healthCheck, Organization organization)
        {
            StorePlayerChanges(player);

            if (contract.Id == 0)
            {
                contract.Person       = player;
                contract.Organization = organization;
                StoreNewContract(contract);
            }
            else
            {
                StoreContractChanges(contract);
            }

            if (healthCheck.Id == 0)
            {
                healthCheck.Player = player;
                StoreNewHealthCheck(healthCheck);
            }
            else
            {
                StoreHealthCheckChanges(healthCheck);
            }
        }
示例#2
0
        public void UpdateHealthCheck(HealthCheckEvidention healthCheck)
        {
            var clas = new Class1();

            using (var session = clas.OpenSession())
            {
                using (var transaction = session.BeginTransaction())
                {
                    session.SaveOrUpdate(healthCheck);
                    transaction.Commit();
                }
            }
        }
示例#3
0
        public HealthCheckEvidention GetHealthCheck(int healthCheckId)
        {
            var result = new HealthCheckEvidention();
            var clas   = new Class1();

            using (var session = clas.OpenSession())
            {
                using (var transaction = session.BeginTransaction())
                {
                    result = (HealthCheckEvidention)session.QueryOver <HealthCheckEvidention>().Where(x => x.Id == healthCheckId).List().First();
                    transaction.Commit();
                }
            }
            return(result);
        }
示例#4
0
        public void Validate_RetrieveHealthCheck()
        {
            int id = 1;
            HealthCheckEvidention health = new HealthCheckEvidention();

            var repository = new Mock <IPlayerRepository>();

            repository.Setup(x => x.GetHealthCheck(id)).Returns(health);

            PlayerProcessor processor = new PlayerProcessor();

            processor.Repository = (IPlayerRepository)repository.Object;

            var res = processor.RetrieveHealthCheck(id);

            repository.Verify(x => x.GetHealthCheck(id), Times.Exactly(1));
        }
示例#5
0
        public void StoreHealthCheckChanges(HealthCheckEvidention healthCheck)
        {
            var _healthCheck = new HealthCheckEvidention();

            if (healthCheck.Id != 0)
            {
                _healthCheck = RetrieveHealthCheck(healthCheck.Id);

                _healthCheck.FromDate = healthCheck.FromDate;
                _healthCheck.ToDate   = healthCheck.ToDate;
                _healthCheck.Remark   = healthCheck.Remark;
            }
            else
            {
                _healthCheck = healthCheck;
            }

            _playerRepository.UpdateHealthCheck(_healthCheck);
        }
示例#6
0
        public void Validate_StorePlayerDetailsChanges()
        {
            HealthCheckEvidention health = new HealthCheckEvidention();
            Person       player          = new Person();
            Contract     contract        = new Contract();
            Organization org             = new Organization();

            var repository = new Mock <IPlayerRepository>();

            repository.Setup(x => x.UpdatePlayer(player));
            repository.Setup(x => x.UpdateContract(contract));
            repository.Setup(x => x.UpdateHealthCheck(health));

            PlayerProcessor processor = new PlayerProcessor();

            processor.Repository = (IPlayerRepository)repository.Object;

            processor.StoreHealthCheckChanges(health);
            processor.StoreContractChanges(contract);

            repository.Verify(x => x.UpdateHealthCheck(health), Times.Exactly(1));
            repository.Verify(x => x.UpdateContract(contract), Times.Exactly(1));
        }
示例#7
0
        public HealthCheckEvidention RetrieveHealthCheck(int healthCheckId)
        {
            HealthCheckEvidention healthCheck = _playerRepository.GetHealthCheck(healthCheckId);

            return(healthCheck);
        }
示例#8
0
        public void StoreNewHealthCheck(HealthCheckEvidention healthCheck)
        {
            var _healthCheck = new HealthCheckEvidention(healthCheck);

            _playerRepository.UpdateHealthCheck(_healthCheck);
        }