private bool search(PartManager partManager, SoegInputType1 soegObject, BatchLine batchLine, SourceUsageOrder SourceUsageOrder) { var searchResult = partManager.SearchList( BrokerContext.Current.UserToken, BrokerContext.Current.ApplicationToken, soegObject, SourceUsageOrder); if (StandardReturType.IsSucceeded(searchResult.StandardRetur)) { if (batchLine.FillFrom(searchResult)) { return(true); } else { batchLine.Error = "Person not found"; return(false); } } else { batchLine.Error = string.Format("{0}-{1}", searchResult.StandardRetur.StatusKode, searchResult.StandardRetur.FejlbeskedTekst); return(false); } }
public static StandardReturType Validate <TOutput, TItem>(FacadeMethodInfo <TOutput, TItem> facade) where TOutput : class, IBasicOutput <TItem>, new() { // Initialize context try { BrokerContext.Initialize(facade.ApplicationToken, facade.UserToken); } catch (Exception ex) { return(StandardReturType.InvalidApplicationToken(facade.ApplicationToken)); } // Validate StandardReturType validationRet = facade.ValidateInput(); if (!StandardReturType.IsSucceeded(validationRet)) { Local.Admin.AddNewLog(TraceEventType.Error, BrokerContext.Current.WebMethodMessageName, TextMessages.InvalidInput, null, null); if (validationRet == null) { validationRet = StandardReturType.UnspecifiedError("Validation failed"); } return(validationRet); } return(StandardReturType.OK()); }
public override StandardReturType ValidateInput() { var channelValidationResult = ValidateChannel(NotificationChannel); if (!StandardReturType.IsSucceeded(channelValidationResult)) { return(channelValidationResult); } return(StandardReturType.OK()); }
public static Guid CprToUuid(string cprNumber) { var uuid = PartManager.GetUuid(BrokerContext.Current.UserToken, BrokerContext.Current.ApplicationToken, cprNumber); if (StandardReturType.IsSucceeded(uuid.StandardRetur)) { return(new Guid(uuid.UUID)); } else { throw new Exception(string.Format("Could not find UUID of person <{0}>", cprNumber)); } }
/// <summary> /// Gets the result for an array of input items /// </summary> /// <typeparam name="TOutput"></typeparam> /// <param name="header">Header tokens</param> /// <param name="input">Array of input items</param> /// <returns>Composite result for the operation</returns> public TOutput GetBatch <TOutput>(MethodHeader header, TInputElement[] input) where TOutput : IBasicOutput <TOutputElement[]>, new() { try { // Validate var ret = BaseValidate <TOutput>(header, input); if (!StandardReturType.IsSucceeded(ret)) { return new TOutput() { StandardRetur = ret } } ; // Data providers IEnumerable <TInterface> dataProviders; // TODO: Create an execution plan here var providerMethod = new ProviderMethod <TInputElement, TOutputElement, Element, object, TInterface>(); ret = CreateDataProviders(providerMethod, out dataProviders); if (!StandardReturType.IsSucceeded(ret)) { return new TOutput() { StandardRetur = ret } } ; // Call data providers var allElements = providerMethod.CallDataProviders(dataProviders, input); // Aggregate return(Aggregate <TOutput>(allElements)); } catch (Exception ex) { Local.Admin.LogException(ex); return(new TOutput() { StandardRetur = StandardReturType.UnspecifiedError() }); } }
protected void applicationsLinqDataSource_Inserting(object sender, LinqDataSourceInsertEventArgs e) { e.Cancel = true; CprBroker.Data.Applications.Application newApp = e.NewObject as CprBroker.Data.Applications.Application; var result = Manager.Admin.RequestAppRegistration(Constants.UserToken, Constants.BaseApplicationToken.ToString(), newApp.Name); Master.AppendErrorIfPossible(result); if (StandardReturType.IsSucceeded(result.StandardRetur)) { if (newApp.IsApproved) { var approveResult = Manager.Admin.ApproveAppRegistration(Constants.UserToken, Constants.BaseApplicationToken.ToString(), result.Item.Token); Master.AppendErrorIfPossible(approveResult); } } applicationsGridView.DataBind(); newApplicationDetailsView.DataBind(); }
public static TOutput GetMethodOutput <TOutput, TItem>(FacadeMethodInfo <TOutput, TItem> facade) where TOutput : class, IBasicOutput <TItem>, new() { try { StandardReturType standardRetur; SubMethodRunState[] subMethodRunStates; standardRetur = Validate <TOutput, TItem>(facade); if (!StandardReturType.IsSucceeded(standardRetur)) { return(new TOutput() { StandardRetur = standardRetur }); } standardRetur = Initialize <TOutput, TItem>(facade, out subMethodRunStates); if (!StandardReturType.IsSucceeded(standardRetur)) { return(new TOutput() { StandardRetur = standardRetur }); } RunThreads <TOutput, TItem>(facade, subMethodRunStates); return(AggregateResults <TOutput, TItem>(facade, subMethodRunStates)); } catch (Exception ex) { Local.Admin.LogException(ex); return(new TOutput() { StandardRetur = StandardReturType.UnspecifiedError() }); } }
public static TOutput GetBatchMethodOutput <TInterface, TOutput, TSingleInputItem, TSingleOutputItem>(BatchFacadeMethodInfo <TInterface, TOutput, TSingleInputItem, TSingleOutputItem> facade) where TInterface : class, IDataProvider where TOutput : class, IBasicOutput <TSingleOutputItem[]>, new() { try { StandardReturType standardRetur; SubMethodRunState[] subMethodRunStates; standardRetur = Validate <TOutput, TSingleOutputItem[]>(facade); if (!StandardReturType.IsSucceeded(standardRetur)) { return(new TOutput() { StandardRetur = standardRetur }); } standardRetur = Initialize <TOutput, TSingleOutputItem[]>(facade, out subMethodRunStates); if (!StandardReturType.IsSucceeded(standardRetur)) { return(new TOutput() { StandardRetur = standardRetur }); } return(facade.Run(subMethodRunStates)); } catch (Exception ex) { Local.Admin.LogException(ex); return(new TOutput() { StandardRetur = StandardReturType.UnspecifiedError() }); } }
public override StandardReturType ValidateInput() { var channelValidationResult = SubscribeFacadeMethod.ValidateChannel(NotificationChannel); if (!StandardReturType.IsSucceeded(channelValidationResult)) { return(channelValidationResult); } if (Years.HasValue) { if (Years.Value < 0 || Years.Value > 200) { return(StandardReturType.ValueOutOfRange("Years", Years.Value)); } } if (PriorDays < 0 || PriorDays > 365) { return(StandardReturType.ValueOutOfRange("PriorDays", Years.Value)); } return(StandardReturType.OK()); }
public override StandardReturType ValidateInput() { /* * Do the validation here */ if (Criterion == null) { return(StandardReturType.NullInput("SoegObjekt")); } if (Criterion.SoegAttributListe == null) { return(StandardReturType.NullInput("SoegObjekt.SoegAttributListe")); } else { if (Criterion.SoegAttributListe.SoegRegisterOplysning == null) { return(StandardReturType.NullInput("SoegObjekt.SoegAttributListe.SoegRegisterOplysning")); } else { int index = 0; foreach (var prop in Criterion.SoegAttributListe.SoegRegisterOplysning) { if (prop == null) { return(StandardReturType.NullInput("SoegObjekt.SoegAttributListe.SoegRegisterOplysning[" + index + "]")); } else { if (prop.Item == null) { return(StandardReturType.NullInput("SoegObjekt.SoegAttributListe.SoegRegisterOplysning[" + index + "].CprBorger")); } else { CprBroker.Schemas.Part.CprBorgerType cprBorger = (CprBroker.Schemas.Part.CprBorgerType)prop.Item; CprBroker.Schemas.Part.DanskAdresseType danskAdresse = (CprBroker.Schemas.Part.DanskAdresseType)cprBorger.FolkeregisterAdresse.Item; if (danskAdresse == null) { return(StandardReturType.NullInput("SoegObjekt.SoegAttributListe.SoegRegisterOplysning[" + index + "].CprBorger.DanskAdresse")); } else { if (String.IsNullOrEmpty(danskAdresse.AddressComplete.AddressAccess.MunicipalityCode)) { return(StandardReturType.NullInput("SoegObjekt.SoegAttributListe.SoegRegisterOplysning[" + index + "].CprBorger.DanskAdresse.AddressComplete.AddressAccess.MunicipalityCode")); } } } } index++; } } } var channelValidationResult = ValidateChannel(NotificationChannel); if (!StandardReturType.IsSucceeded(channelValidationResult)) { return(channelValidationResult); } return(StandardReturType.OK()); }