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 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"]; }
/// <summary> /// When the user decides to create the inspection, this method will be called. /// Here we call the handler to create a new inspection, /// we refresh the catalog of inspections /// and we navigate back to the SelectedSculpture Page. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void AcceptButton_OnClick(object sender, RoutedEventArgs e) { ViewModel.NewInspection.Sculpture_ID = ViewModel.Sculpture.ID; InspectionHandler.CreateInspection(ViewModel.NewInspection); InspectionCatalogSingleton.Instance.Inspections = await new Persistancy.PersistenceFacade().GetAllInspections(); Frame.Navigate(typeof(SelectedSculptureView), ViewModel.Sculpture); }
/// <summary> /// Through this method we send a delete request to the Web Service. /// </summary> private async void DeleteInspectionButton_OnClick(object sender, RoutedEventArgs e) { InspectionHandler.DeleteInspection(ViewModel.SelectedInspection.ID); var sculpture = SculptureCatalogSingleton.Instance.Sculptures.First(s => s.ID == ViewModel.SelectedInspection.Sculpture_ID); InspectionCatalogSingleton.Instance.Inspections = await new Persistancy.PersistenceFacade().GetAllInspections(); Frame.Navigate(typeof(SelectedSculptureView), sculpture); }
public SelectedInspectionViewModel() { InspectionCatalogSingleton = InspectionCatalogSingleton.Instance; InspectionHandler = new InspectionHandler(SelectedSculptureViewModel); }