Esempio n. 1
0
        private PointSystemConfiguration BuildConfigurationFromDTO(PointSystemConfigurationDTO configurationDTO)
        {
            PointSystemConfiguration configuration = new PointSystemConfiguration();

            configuration.PropertyName  = configurationDTO.PropertyName;
            configuration.PropertyValue = configurationDTO.PropertyValue;
            return(configuration);
        }
Esempio n. 2
0
        private void UpdateUserPoints(Cart currentCart, string userId)
        {
            PointSystemConfiguration pointSystemConfiguration = configurationRepository.GetByPropertyName(ESportUtils.LOYALTY_PROPERTY_NAME);
            int  totalPoints = CalculateLoyaltyPoints(Convert.ToDouble(pointSystemConfiguration.PropertyValue), currentCart.Items);
            User currentUser = GetCurrentUser(userId);

            currentUser.Points += totalPoints;
            userRepository.UpdateEntity(currentUser);
        }
Esempio n. 3
0
 public void UpdateConfiguration(PointSystemConfigurationDTO configurationDTO)
 {
     try
     {
         PointSystemConfiguration configurationToUpdate = pointSystemConfiguration.GetByPropertyName(configurationDTO.PropertyName);
         configurationToUpdate.PropertyValue = configurationDTO.PropertyValue;
         pointSystemConfiguration.UpdateEntity(configurationToUpdate);
     }
     catch (RepositoryException e)
     {
         throw new OperationException(e.Message, e);
     }
 }
Esempio n. 4
0
        public void RemoveConfiguration(PointSystemConfigurationDTO configurationDTO)
        {
            PointSystemConfiguration configurationToRemove = pointSystemConfiguration.GetByPropertyName(configurationDTO.PropertyName);

            pointSystemConfiguration.RemoveEntity(configurationToRemove);
        }