public AccelaOpenPermitAdapter(OpenPermitContext context) { this.agencyAppId = ConfigurationManager.AppSettings["OP.Accela.App.Id"]; this.agencyAppSecret = ConfigurationManager.AppSettings["OP.Accela.App.Secret"]; if (this.agencyAppId == null || this.agencyAppSecret == null) { throw new ConfigurationErrorsException("OP.Accela.App.Id and OP.Accela.App.Secret are required configuration settings."); } this.context = context; // TODO see if it makes sense to provide a default config, otherwise make sure the AccelaConfig is provided this.config = JsonConvert.DeserializeObject<AgencyConfiguration>(context.Agency.Configuration); // TODO using agency app only, should we change this to citizen app? this.recApi = new RecordHandler(this.agencyAppId, this.agencyAppSecret, ApplicationType.Agency, string.Empty, appConfig); this.inspectionApi = new InspectionHandler(this.agencyAppId, this.agencyAppSecret, ApplicationType.Agency, string.Empty, appConfig); this.documentApi = new DocumentHandler(this.agencyAppId, this.agencyAppSecret, ApplicationType.Agency, string.Empty, appConfig); this.connection = HttpUtility.ParseQueryString(context.Agency.ConnectionString); this.recApi.AgencyId = this.connection["id"]; this.recApi.Environment = this.connection["env"]; this.inspectionApi.AgencyId = this.connection["id"]; this.inspectionApi.Environment = this.connection["env"]; this.documentApi.AgencyId = this.connection["id"]; this.documentApi.Environment = this.connection["env"]; }
public IOpenPermitAdapter GetOpenPermitAdapter(OpenPermitContext context = null) { if (context == null) { context = new OpenPermitContext(); } context.Agency = this.agency; var adapter = (IOpenPermitAdapter)Activator.CreateInstance(this.adapterType, new object[] { context }); return adapter; }
public IOpenPermitAdapter GetOpenPermitAdapter(OpenPermitContext context = null) { if (context == null) { context = new OpenPermitContext(); } context.Agency = this.agency; var adapter = (IOpenPermitAdapter)Activator.CreateInstance(this.adapterType, new object[] { context }); return(adapter); }