本文整理汇总了C#中IUServiceContext类的典型用法代码示例。如果您正苦于以下问题:C# IUServiceContext类的具体用法?C# IUServiceContext怎么用?C# IUServiceContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IUServiceContext类属于命名空间,在下文中一共展示了IUServiceContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetArgumentListFromArgumentInfoContext
/// <summary>
/// Obtains the ArgumentsList contained in a IUServiceContext.
/// </summary>
/// <param name="context">Context the list is obtained from.</param>
/// <returns>ArgumentsList contained in the context.</returns>
private static ArgumentsList GetArgumentListFromArgumentInfoContext(IUServiceContext context)
{
Dictionary<string, ModelType> largumentTypes = null;
ArgumentsList lResult = null;
largumentTypes = Logics.Logic.GetInboundArgumentTypes(context.ClassName, context.ContainerName);
if (largumentTypes != null)
{
lResult = GetArgumentListFromArgumentInfoContext(context.InputFields, largumentTypes);
}
largumentTypes = Logics.Logic.GetOutboundArgumentTypes(context.ClassName, context.ContainerName);
if (largumentTypes != null)
{
if (context.OutputFields != null && context.OutputFields.Count > 0)
{
foreach (KeyValuePair<string, ModelType> largumentType in largumentTypes)
{
object argumentInfo = context.OutputFields[largumentType.Key];
if (argumentInfo != null)
{
if (largumentType.Value == ModelType.Oid)
{
List<Oid> lOids = argumentInfo as List<Oid>;
if (lOids != null && lOids.Count == 1)
{
lResult.Add(largumentType.Key, largumentType.Value, lOids[0], lOids[0].ClassName);
}
}
else
{
if (argumentInfo != null)
{
lResult.Add(largumentType.Key, largumentType.Value, argumentInfo, string.Empty);
}
}
}
}
}
}
if (lResult != null)
{
return lResult;
}
return null;
}
示例2: ExecuteLoadFromContext
/// <summary>
/// Initialize the inbound arguments based in the context information.
/// </summary>
/// <param name="context">Current service context.</param>
public static void ExecuteLoadFromContext(IUServiceContext context)
{
int depRulesCounter = Properties.Settings.Default.DependencyRulesCounter;
DependencyRulesCache depRulesCache = new DependencyRulesCache();
// If Exchange information does not exist, none initialization can be done.
if (context == null || context.ExchangeInformation == null)
{
return;
}
// Argument previous value. Common for all of them.
object previousValue;
#region Aggregation relationships initializations
// Obtain data from the last navigation, in order to initialize object-valued arguments that represent aggregation relationships.
string lLastNavigationRole = context.ExchangeInformation.GetLastNavigationRole();
if (lLastNavigationRole != "")
{
}
#endregion Aggregation relationships initializations
#region Manual initializations
// Search in context for initializations done by programmers, in order to achieve special behaviours.
foreach(KeyValuePair<string,object> argument in context.ExchangeInformation.CustomData)
{
previousValue = context.GetInputFieldValue(argument.Key);
object lCustomArgumentValue = argument.Value;
context.SetInputFieldValue(argument.Key, lCustomArgumentValue);
// Check SetValue dependency rules
context.SelectedInputField = argument.Key;
ExecuteDependencyRules(context, previousValue, DependencyRulesEventLogic.SetValue, DependencyRulesAgentLogic.Internal, ref depRulesCounter, depRulesCache);
context.SelectedInputField = string.Empty;
}
#endregion Manual initializations
#region Arguments initializations taking into account context information
#endregion Arguments initializations taking into account context information
}
示例3: ExecuteValidateValue
/// <summary>
/// Solves the validation of inbound arguments of 'create_instance' service.
/// </summary>
/// <param name="context">Current context.</param>
public static void ExecuteValidateValue(IUServiceContext context)
{
switch (context.SelectedInputField)
{
case "p_atrid_NaveNodriza":
ExecuteValidateValuep_atrid_NaveNodriza(context.Agent, context.GetInputFieldValue("p_atrid_NaveNodriza") as int?);
break;
case "p_atrNombre_NaveNodriza":
ExecuteValidateValuep_atrNombre_NaveNodriza(context.Agent, context.GetInputFieldValue("p_atrNombre_NaveNodriza") as string);
break;
default:
break;
}
}
示例4: ExecuteDependencyRules
/// <summary>
/// Solves the dependency rules of 'edit_instance' inbound arguments, updating the context received as parameter.
/// </summary>
/// <param name="context">Current context.</param>
/// <param name="oldValue">Old value of the modified argument.</param>
/// <param name="dependencyRulesEvent">Event that has been thrown (SetValue, SetEnabled).</param>
/// <param name="dependencyRulesAgent">Agent that has thrown the event (User, Internal).</param>
public static void ExecuteDependencyRules(IUServiceContext context, object oldValue, DependencyRulesEventLogic dependencyRulesEvent, DependencyRulesAgentLogic dependencyRulesAgent)
{
int lDependencyRulesCounter = Properties.Settings.Default.DependencyRulesCounter;
DependencyRulesCache depRulesCache = new DependencyRulesCache();
ExecuteDependencyRules(context, oldValue, dependencyRulesEvent, dependencyRulesAgent, ref lDependencyRulesCounter, depRulesCache);
}
示例5: ExecuteConditionalNavigation
/// <summary>
/// Solve the conditional navigation of 'edit_instance' service.
/// </summary>
/// <param name="context">Current context.</param>
/// <returns>A ExchangeInfoConditionalNavigation object indicating the target scenario and its initializations.</returns>
public static ExchangeInfoConditionalNavigation ExecuteConditionalNavigation(IUServiceContext context)
{
return null; // No conditional navigations are defined for this service IU.
}
示例6: ExecuteValidateValue
/// <summary>
/// Solves the validation of inbound arguments of 'edit_instance' service.
/// </summary>
/// <param name="context">Current context.</param>
public static void ExecuteValidateValue(IUServiceContext context)
{
switch (context.SelectedInputField)
{
case "p_thisPasajero":
ExecuteValidateValuep_thisPasajero(context.Agent, context.GetInputFieldValue("p_thisPasajero") as List<Oid>);
break;
default:
break;
}
}
示例7: GetServiceEffectType
/// <summary>
/// Gets the effect type of 'create_instance' service.
/// </summary>
/// <param name="context">Current context.</param>
/// <returns>Effect type of the service (Creation, Destruction, Modification).</returns>
public static ServiceEffectType GetServiceEffectType(IUServiceContext context)
{
// ServiceType = C.
return ServiceEffectType.Creation;
}
示例8: ExecuteConditionalNavigation
/// <summary>
/// Solve the conditional navigation of a service.
/// </summary>
/// <param name="context">Current context.</param>
/// <returns>A ExchangeInfo object indicating the target scenario and its initializations.</returns>
public static ExchangeInfoConditionalNavigation ExecuteConditionalNavigation(IUServiceContext context)
{
// Parameter values.
object[] lParameters = new object[1];
lParameters[0] = context;
// Parameter types.
Type[] lTypes = new Type[1];
lTypes[0] = typeof(IUServiceContext);
return ExecuteMethod(GetServiceTypeName(context.ClassName, context.ServiceName), "ExecuteConditionalNavigation", lTypes, lParameters) as ExchangeInfoConditionalNavigation;
}
示例9: ProcessExecuteServiceTriggered
/// <summary>
/// Process the Display Service execute event
/// </summary>
protected virtual void ProcessExecuteServiceTriggered(object sender, TriggerEventArgs e)
{
// Before executing the DisplaySet Service it is needed to check for pending changes in associated Service IU.
IUQueryController queryController = Parent as IUQueryController;
if (queryController != null && !queryController.CheckPendingChanges(false, true))
{
return;
}
if (CurrentDisplaySet.ServiceInfo == null)
{
return;
}
// Gets modified rows from the viewer
DataTable modifiedRows = Viewer.GetModifiedRows();
if (modifiedRows == null)
{
return;
}
// Validate the modified data
if (!ValidateModifiedRows(modifiedRows))
{
return;
}
// Error datatable
DataTable errorReport = new DataTable();
// Column for the OID
string instanceColumnsName = CurrentDisplaySet.ServiceInfo.SelectedInstanceArgumentAlias;
errorReport.Columns.Add(instanceColumnsName);
// Column for the error message
string lReportMessage = CultureManager.TranslateString(LanguageConstantKeys.L_MULTIEXE_EXECUTION, LanguageConstantValues.L_MULTIEXE_EXECUTION);
errorReport.Columns.Add(lReportMessage);
IUServiceContext lServiceContext = null;
// For every modified row do...
foreach (DataRow rowValues in modifiedRows.Rows)
{
// Create new IUServiceContext.
lServiceContext = new IUServiceContext(null, CurrentDisplaySet.ServiceInfo.ClassServiceName, CurrentDisplaySet.ServiceInfo.ServiceName, null);
// Add argunment this to the service context.
List<Oid> instanceOIDs = new List<Oid>();
Oid instanceOID = Adaptor.ServerConnection.GetOid(modifiedRows, rowValues);
instanceOIDs.Add(instanceOID);
lServiceContext.InputFields.Add(CurrentDisplaySet.ServiceInfo.SelectedInstanceArgumentName, new IUContextArgumentInfo(CurrentDisplaySet.ServiceInfo.SelectedInstanceArgumentName, instanceOIDs, true, null));
// Fill the collections for the other inbound arguments.
foreach (DisplaySetServiceArgumentInfo argumentInfo in CurrentDisplaySet.ServiceInfo.ArgumentDisplaySetPairs.Values)
{
object value = rowValues[argumentInfo.DSElementName];
if (value.GetType() == typeof(System.DBNull))
{
value = null;
}
//Add input arguments with context.
lServiceContext.InputFields.Add(argumentInfo.Name, new IUContextArgumentInfo(argumentInfo.Name, value, true, null));
}
try
{
// Execute service.
Logic.ExecuteService(lServiceContext);
}
catch (Exception exc)
{
string lAlternateKeyName = CurrentDisplaySet.ServiceInfo.SelectedInstanceArgumentAlternateKeyName;
if (lAlternateKeyName != string.Empty)
{
instanceOID = Logic.GetAlternateKeyFromOid(instanceOID, lAlternateKeyName);
}
// Add a new row in the error datatable.
DataRow newReportRow = errorReport.NewRow();
newReportRow[lReportMessage] = exc.Message;
newReportRow[instanceColumnsName] = UtilFunctions.OidFieldsToString(instanceOID, ' ');
errorReport.Rows.Add(newReportRow);
}
}
// If errors have been found, show them
if (errorReport.Rows.Count > 0)
{
// Show error message to the user
ScenarioManager.LaunchMultiExecutionReportScenario(errorReport, CurrentDisplaySet.ServiceInfo.ServiceAlias, null, null);
}
// Remove the Pending changes mark
PendingChanges = false;
// Refresh the data
OnExecuteCommand(new ExecuteCommandRefreshEventArgs(null));
}
示例10: ExecuteValidateValue
/// <summary>
/// Solves the validation of inbound arguments of 'create_instance' service.
/// </summary>
/// <param name="context">Current context.</param>
public static void ExecuteValidateValue(IUServiceContext context)
{
switch (context.SelectedInputField)
{
case "p_agrPasajeroAeronave":
ExecuteValidateValuep_agrPasajeroAeronave(context.Agent, context.GetInputFieldValue("p_agrPasajeroAeronave") as List<Oid>);
break;
case "p_agrRevision":
ExecuteValidateValuep_agrRevision(context.Agent, context.GetInputFieldValue("p_agrRevision") as List<Oid>);
break;
case "p_atrid_RevisionPasajero":
ExecuteValidateValuep_atrid_RevisionPasajero(context.Agent, context.GetInputFieldValue("p_atrid_RevisionPasajero") as int?);
break;
default:
break;
}
}
示例11: ExecuteService
/// <summary>
/// Method that solves the execution of 'create_instance' service.
/// </summary>
/// <param name="context">Current context.</param>
public static void ExecuteService(IUServiceContext context)
{
context.OutputFields = ExecuteService(context.Agent, context.GetInputFieldValue("p_agrPasajeroAeronave") as List<Oid>, context.GetInputFieldValue("p_agrRevision") as List<Oid>, context.GetInputFieldValue("p_atrid_RevisionPasajero") as int?);
}
示例12: ExecuteService
/// <summary>
/// Method that solves the execution of 'create_instance' service.
/// </summary>
/// <param name="context">Current context.</param>
public static void ExecuteService(IUServiceContext context)
{
context.OutputFields = ExecuteService(context.Agent, context.GetInputFieldValue("p_agrAeronave") as List<Oid>, context.GetInputFieldValue("p_agrPasajero") as List<Oid>, context.GetInputFieldValue("p_atrid_PasajeroAeronave") as int?, context.GetInputFieldValue("p_atrNombreAeronave") as string, context.GetInputFieldValue("p_atrNombrePasajero") as string);
}
示例13: ExecuteService
/// <summary>
/// Method that solves the execution of 'create_instance' service.
/// </summary>
/// <param name="context">Current context.</param>
public static void ExecuteService(IUServiceContext context)
{
context.OutputFields = ExecuteService(context.Agent, context.GetInputFieldValue("p_agrPasajeroAeronave") as List<Oid>, context.GetInputFieldValue("p_atrid_Aeronave") as int?, context.GetInputFieldValue("p_atrNombre") as string, context.GetInputFieldValue("p_atrMaximoPasajeros") as int?, context.GetInputFieldValue("p_atrOrigen") as string, context.GetInputFieldValue("p_atrDestino") as string);
}
示例14: ExecuteDependencyRules
/// <summary>
/// Solves the dependency rules of a service.
/// </summary>
/// <param name="context">Current context.</param>
/// <param name="lastValue">Old value of the modified argument.</param>
/// <param name="dependencyRulesEvent">Event that has been thrown (SetValue, SetEnabled).</param>
/// <param name="dependencyRulesAgent">Agent that has thrown the event (User, Internal).</param>
public static void ExecuteDependencyRules(IUServiceContext context, object lastValue, DependencyRulesEventLogic dependencyRulesEvent, DependencyRulesAgentLogic dependencyRulesAgent)
{
// Parameter values.
object[] lParameters = new object[4];
lParameters[0] = context;
lParameters[1] = lastValue;
lParameters[2] = dependencyRulesEvent;
lParameters[3] = dependencyRulesAgent;
// Parameter types.
Type[] lTypes = new Type[4];
lTypes[0] = typeof(IUServiceContext);
lTypes[1] = typeof(object);
lTypes[2] = typeof(DependencyRulesEventLogic);
lTypes[3] = typeof(DependencyRulesAgentLogic);
ExecuteMethod(GetServiceTypeName(context.ClassName, context.ServiceName), "ExecuteDependencyRules", lTypes, lParameters);
}
示例15: ExecuteValidateValue
/// <summary>
/// Solves the validation of inbound arguments of 'create_instance' service.
/// </summary>
/// <param name="context">Current context.</param>
public static void ExecuteValidateValue(IUServiceContext context)
{
switch (context.SelectedInputField)
{
case "p_agrPasajeroAeronave":
ExecuteValidateValuep_agrPasajeroAeronave(context.Agent, context.GetInputFieldValue("p_agrPasajeroAeronave") as List<Oid>);
break;
case "p_atrid_Aeronave":
ExecuteValidateValuep_atrid_Aeronave(context.Agent, context.GetInputFieldValue("p_atrid_Aeronave") as int?);
break;
case "p_atrNombre":
ExecuteValidateValuep_atrNombre(context.Agent, context.GetInputFieldValue("p_atrNombre") as string);
break;
case "p_atrMaximoPasajeros":
ExecuteValidateValuep_atrMaximoPasajeros(context.Agent, context.GetInputFieldValue("p_atrMaximoPasajeros") as int?);
break;
case "p_atrOrigen":
ExecuteValidateValuep_atrOrigen(context.Agent, context.GetInputFieldValue("p_atrOrigen") as string);
break;
case "p_atrDestino":
ExecuteValidateValuep_atrDestino(context.Agent, context.GetInputFieldValue("p_atrDestino") as string);
break;
default:
break;
}
}