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 RemoveLaborFromAccountType(int accountTypeId, int accountTypeServiceId, int accountTypeLaborId) { 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 labor = service.LaborTypeList.Where(l => l.Id == accountTypeLaborId).FirstOrDefault(); if (labor == null) { throw new ArgumentException("accountTypeLaborId"); } service.LaborTypeList.Remove(labor); AccountTypeRepository.SaveAccountType(accountType); }
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); }