public static Customer ConverttoEntity(CustomerModel incustomer) { Customer customer = null; try { EngineerRepository erepo = new EngineerRepository(); InstallationRepository irepo = new InstallationRepository(); customer = new Customer(); customer.customerid = incustomer.customerid; customer.firstname = incustomer.firstname; customer.lastname = incustomer.lastname; customer.username = incustomer.username; customer.password = incustomer.password; customer.engineerid = incustomer.engineerid; customer.email = incustomer.email; customer.Engineer = ConvertEngineer.ConverttoEntity(erepo.GetById(customer.engineerid)); foreach (var item in incustomer.Installation) { customer.Installation.Add(ConvertInstallation.ConverttoEntity(irepo.GetById(item))); } log.Info("CustomerModel wurde konvertiert."); } catch (Exception exp) { log.Error("CustomerModel konnte nicht konvertiert werden."); throw new DalException("CustomerModel konnte nicht konvertiert werden.", exp); } return customer; }
private void SetWorkingFolder(string path) { using (_lock.Lock()) { try { _factorio = InstallationRepository.Create(Path.Combine(path, "game")); Installations = new ReactiveBindingList <InstallationSpec>(_factorio.EnumerateInstallations()); } catch (ArgumentException) { Error = "I don't like that directory path :("; } catch (UnauthorizedAccessException) { Error = "Can not access the directory."; } catch (SecurityException) { Error = "Missing the required permission to access the folder."; } catch (PathTooLongException) { Error = "Directory path too long."; } catch (NotSupportedException) { Error = "File IO not supported on this system."; } catch (IOException) { Error = "The directory is actually a file or could not access the directory."; } } }
public async Task <IAppInstallation> Create() { try { var crmService = StartupHelper.CreateCrmService(); IInstallationRepository installationRepository = new InstallationRepository(); IInstallationService installationService = new InstallationService(crmService, installationRepository); IAppInstallation app = new AppInstallation(installationService); return(app); } catch (Exception ex) { throw ex; } }