예제 #1
0
        public void AddServiceToAccountType(int accountTypeId, int serviceTypeId)
        {
            var accountType = AccountTypeRepository.GetAccountType(accountTypeId);

            if (accountType == null)
            {
                throw new ArgumentException("accountTypeId");
            }

            var serviceType = AccountTypeRepository.GetServiceType(serviceTypeId);

            if (serviceType == null)
            {
                throw new ArgumentException("serviceTypeId");
            }

            var newService = new Data.Graph.AccountTypeService();

            newService.ServiceType          = serviceType;
            newService.DefaultEstimatedTime = 0;
            newService.DefaultRate          = 0;
            newService.IsActive             = true;
            accountType.AddService(newService);

            AccountTypeRepository.SaveAccountType(accountType);
        }
예제 #2
0
        public void UpdateServiceType(int id, string description)
        {
            var existing = AccountTypeRepository.GetServiceType(id);

            if (null == existing)
            {
                throw new ArgumentException(string.Format("{0} is not a valid service type id", id));
            }
            //TODO: validate description
            existing.Description = description;
            AccountTypeRepository.SaveServiceType(existing);
        }