/// <summary> /// Default constructor of the DI connection mockup. /// </summary> public DiConnectionMockup(DiConnectionModel connection, string passwordPath) { if (!File.Exists(passwordPath)) { throw new ArgumentException("The password file does not exist."); } // Unprotect the SAP DI user password given its encrypted binary file path. var passProtector = new PasswordProtector(); var password = passProtector.Unprotect(passwordPath); MessageBox.Show($"Server: {connection.Server}, Company: {connection.Company}, User: {connection.Username}, Password: {password}"); }
/// <summary> /// Constructor of the DI connection controller; /// initializes the company object based on a given /// DI connection model. /// </summary> /// <param name="connection">The given model represents the DI connection details.</param> public DiConnectionController(DiConnectionModel connection, string passwordPath) { if (!File.Exists(passwordPath)) { throw new ArgumentException("The password file does not exist."); } // Unprotect the SAP DI user password given its encrypted binary file path. var passProtector = new PasswordProtector(); var password = passProtector.Unprotect(passwordPath); Company = new Company { Server = connection.Server, DbServerType = BoDataServerTypes.dst_MSSQL2014, CompanyDB = connection.Company, UserName = connection.Username, Password = password, language = BoSuppLangs.ln_English }; }