public void AddLaborToAccountType(int accountTypeId, int accountTypeServiceId, int laborTypeId) { var accountType = AccountTypeRepository.GetAccountType(accountTypeId); if (accountType == null) { throw new ArgumentException("accountTypeId"); } var service = accountType.ServiceTypeList.Where(s => s.Id == accountTypeServiceId).FirstOrDefault(); if (service == null) { throw new ArgumentException("accountTypeServiceId"); } var laborType = AccountTypeRepository.GetLaborType(laborTypeId); if (laborType == null) { throw new ArgumentException("laborTypeId"); } var newLabor = new AccountTypeLabor(); newLabor.DefaultRate = 0; newLabor.DefaultRateType = "F"; newLabor.LaborType = laborType; service.AddLabor(newLabor); AccountTypeRepository.SaveAccountType(accountType); }
public void UpdateLaborType(int id, string description) { var existing = AccountTypeRepository.GetLaborType(id); if (null == existing) { throw new ArgumentException(string.Format("{0} is not a valid labor type id", id)); } //TODO: validate description existing.Description = description; AccountTypeRepository.SaveLaborType(existing); }