本文整理汇总了C#中Dev2.DataList.Contract.ErrorResultTO.MakeDisplayReady方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorResultTO.MakeDisplayReady方法的具体用法?C# ErrorResultTO.MakeDisplayReady怎么用?C# ErrorResultTO.MakeDisplayReady使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dev2.DataList.Contract.ErrorResultTO
的用法示例。
在下文中一共展示了ErrorResultTO.MakeDisplayReady方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DispatchDebugErrors
// BUG 9706 - 2013.06.22 - TWR : refactored
void DispatchDebugErrors(ErrorResultTO errors, IDSFDataObject dataObject, StateType stateType)
{
if(errors.HasErrors() && dataObject.IsDebugMode())
{
Guid parentInstanceId;
Guid.TryParse(dataObject.ParentInstanceID, out parentInstanceId);
var debugState = new DebugState
{
ID = dataObject.DataListID,
ParentID = parentInstanceId,
WorkspaceID = dataObject.WorkspaceID,
StateType = stateType,
StartTime = DateTime.Now,
EndTime = DateTime.Now,
ActivityType = ActivityType.Workflow,
DisplayName = dataObject.ServiceName,
IsSimulation = dataObject.IsOnDemandSimulation,
ServerID = dataObject.ServerID,
OriginatingResourceID = dataObject.ResourceID,
OriginalInstanceID = dataObject.OriginalInstanceID,
SessionID = dataObject.DebugSessionID,
EnvironmentID = dataObject.EnvironmentID,
ClientID = dataObject.ClientID,
Server = string.Empty,
Version = string.Empty,
Name = GetType().Name,
HasError = errors.HasErrors(),
ErrorMessage = errors.MakeDisplayReady()
};
DebugDispatcher.Instance.Write(debugState, dataObject.RemoteInvoke, dataObject.RemoteInvokerID);
}
}
示例2: ExtractKeyValuePairs
static string ExtractKeyValuePairs(NameValueCollection pairs, NameValueCollection boundVariables)
{
// Extract request keys ;)
foreach(var key in pairs.AllKeys)
{
if(key == "wid") //Don't add the Workspace ID to DataList
{
continue;
}
if(key.IsXml() || key.IsJSON())
{
return key; //We have a workspace id and XML DataList
}
boundVariables.Add(key,pairs[key]);
}
ErrorResultTO errors = new ErrorResultTO();
Dev2Logger.Log.Error(errors.MakeDisplayReady());
return string.Empty;
}
示例3: Invoke
/// <summary>
/// Invokes the specified service as per the dataObject against theHost
/// </summary>
/// <param name="dataObject">The data object.</param>
/// <param name="errors">The errors.</param>
/// <returns></returns>
/// <exception cref="System.Exception">Can only execute workflows from web browser</exception>
public Guid Invoke(IDSFDataObject dataObject, out ErrorResultTO errors)
{
var result = GlobalConstants.NullDataListID;
var time = new Stopwatch();
time.Start();
errors = new ErrorResultTO();
int update = 0;
// BUG 9706 - 2013.06.22 - TWR : added pre debug dispatch
if(dataObject.Environment.HasErrors())
{
errors.AddError(dataObject.Environment.FetchErrors());
DispatchDebugErrors(errors, dataObject, StateType.Before);
}
errors.ClearErrors();
try
{
var serviceId = dataObject.ResourceID;
// we need to get better at getting this ;)
var serviceName = dataObject.ServiceName;
if(serviceId == Guid.Empty && string.IsNullOrEmpty(serviceName))
{
errors.AddError(Resources.DynamicServiceError_ServiceNotSpecified);
}
else
{
try
{
var sl = new ServiceLocator();
Dev2Logger.Log.Debug("Finding service");
var theService = serviceId == Guid.Empty ? sl.FindService(serviceName, _workspace.ID) : sl.FindService(serviceId, _workspace.ID);
if(theService == null)
{
errors.AddError("Service [ " + serviceName + " ] not found.");
}
else if(theService.Actions.Count <= 1)
{
#region Execute ESB container
var theStart = theService.Actions.FirstOrDefault();
if(theStart != null && theStart.ActionType != Common.Interfaces.Core.DynamicServices.enActionType.InvokeManagementDynamicService && theStart.ActionType != Common.Interfaces.Core.DynamicServices.enActionType.Workflow && dataObject.IsFromWebServer)
{
throw new Exception("Can only execute workflows from web browser");
}
Dev2Logger.Log.Debug("Mapping Action Dependencies");
MapServiceActionDependencies(theStart, sl);
// Invoke based upon type ;)
if(theStart != null)
{
theStart.DataListSpecification = theService.DataListSpecification;
Dev2Logger.Log.Debug("Getting container");
var container = GenerateContainer(theStart, dataObject, _workspace);
ErrorResultTO invokeErrors;
result = container.Execute(out invokeErrors, update);
errors.MergeErrors(invokeErrors);
}
#endregion
}
else
{
errors.AddError("Malformed Service [ " + serviceId + " ] it contains multiple actions");
}
}
catch(Exception e)
{
errors.AddError(e.Message);
}
finally
{
if (dataObject.Environment.HasErrors())
{
var errorString = dataObject.Environment.FetchErrors();
var executionErrors = ErrorResultTO.MakeErrorResultFromDataListString(errorString);
errors.MergeErrors(executionErrors);
}
dataObject.Environment.AddError(errors.MakeDataListReady());
if(errors.HasErrors())
{
Dev2Logger.Log.Error(errors.MakeDisplayReady());
}
}
}
}
finally
{
time.Stop();
ServerStats.IncrementTotalRequests();
//.........这里部分代码省略.........
示例4: AddErrorsToDataList
private void AddErrorsToDataList(ErrorResultTO errors, Guid dataListID)
{
// Upsert any errors that might have occured into the datalist
IBinaryDataListEntry be = Dev2BinaryDataListFactory.CreateEntry(enSystemTag.Error.ToString(), string.Empty);
string error;
be.TryPutScalar(Dev2BinaryDataListFactory.CreateBinaryItem(errors.MakeDataListReady(), enSystemTag.Error.ToString()), out error);
if (!string.IsNullOrWhiteSpace(error))
{
//At this point there was an error while trying to handle errors so we throw an exception
throw new Exception(string.Format("The error '{0}' occured while creating the error entry for the following errors: {1}", error, errors.MakeDisplayReady()));
}
var upsertErrors = new ErrorResultTO();
SvrCompiler.Upsert(null, dataListID, DataListUtil.BuildSystemTagForDataList(enSystemTag.Error, true), be, out upsertErrors);
if (upsertErrors.HasErrors())
{
//At this point there was an error while trying to handle errors so we throw an exception
throw new Exception(string.Format("The error '{0}' occured while upserting the following errors to the datalist: {1}", errors.MakeDisplayReady(), errors.MakeDisplayReady()));
}
}
示例5: DispatchDebugState
/// <summary>
/// Dispatches the error state to the client
/// </summary>
/// <param name="xmlRequest">The XML request.</param>
/// <param name="dataListId">The data list id.</param>
/// <param name="allErrors">All errors.</param>
/// <author>Jurie.smit</author>
/// <date>2013/02/18</date>
private void DispatchDebugState(dynamic xmlRequest, Guid dataListId, ErrorResultTO allErrors)
{
var debugState = new DebugState()
{
StartTime = DateTime.Now,
EndTime = DateTime.Now,
IsSimulation = false,
Server = string.Empty,
Version = string.Empty,
Name = GetType().Name,
HasError = true,
ActivityType = ActivityType.Service,
StateType = StateType.All,
ServerID = HostSecurityProvider.Instance.ServerID
};
try
{
var xmlReader = XmlReader.Create(new StringReader(xmlRequest.XmlString));
var xmlDoc = XDocument.Load(xmlReader);
var workSpaceID = (from n in xmlDoc.Descendants("wid")
select n).FirstOrDefault();
var invokedService = (from n in xmlDoc.Descendants("Service")
select n).FirstOrDefault();
if (workSpaceID != null)
{
debugState.WorkspaceID = Guid.Parse(workSpaceID.Value);
}
if (invokedService != null)
{
debugState.DisplayName = invokedService.Value;
}
//ParentID = dataObject.ParentInstanceID
}
catch (Exception exception)
{
//TODO what if not an xmlRequest ? IDSFDataObject dataObject = new DsfDataObject(xmlRequest, dataListId);
throw;
}
debugState.ErrorMessage = XmlHelper.MakeErrorsUserReadable(allErrors.MakeDisplayReady());
DebugDispatcher.Instance.Write(debugState);
}
示例6: Invoke
//.........这里部分代码省略.........
{
sai.Value = !string.IsNullOrEmpty(sai.DefaultValue) ? sai.DefaultValue : string.Empty;
}
}
//if (service.Mode == enDynamicServiceMode.ValidationOnly)
//{
// xmlRequest.ValidationOnly.Result = true;
// return xmlRequest;
//}
if(serviceAction.ActionType == enActionType.Switch)
{
if(!string.IsNullOrEmpty(serviceAction.Cases.DataElementName))
{
////Assigning the input the value from the callers request data
//if (serviceAction.Cases.CascadeSource)
//{
//This is a cascaded input so retrieve the value from the
//previous actions response
//sai.Value = actionResponse.GetValue(sai.Name);
//serviceAction.Cases.DataElementValue = forwardResult.GetValue(serviceAction.Cases.DataElementName);
//}
//else
//{
serviceAction.Cases.DataElementValue = xmlRequest.GetValue(serviceAction.Cases.DataElementName);
//}
}
}
//
//Juries - This is a dirty hack, naughty naughty.
//Hijacked current functionality to enable erros to be added to an item after its already been added to the tree
//
if(allErrors.HasErrors())
{
DebugDispatcher.Instance.Write(new DebugState()
{
ParentID = dataObject.ParentInstanceID,
WorkspaceID = dataObject.WorkspaceID,
StartTime = DateTime.Now,
EndTime = DateTime.Now,
IsSimulation = false,
ServerID = dataObject.ServerID,
Server = string.Empty,
Version = string.Empty,
Name = GetType().Name,
HasError = true,
ErrorMessage = allErrors.MakeDisplayReady(),
ActivityType = ActivityType.Workflow,
StateType = StateType.Append
});
}
// TODO : properly build up DataList prior to this....
result = Invoke(serviceAction, dataObject, dataList);
// Remember to clean up ;)
if(dataListId != GlobalConstants.NullDataListID)
{
// Merge the execution DL into the mainDL ;)
Guid mergeId = SvrCompiler.Merge(null, dataListId, serviceDataId, enDataListMergeTypes.Union,
enTranslationDepth.Data, false, out errors);
SvrCompiler.DeleteDataListByID(serviceDataId, true);
// Now reset the DataListID on DataObject ;)
if(result != serviceDataId)
{
throw new Exception("FATAL ERROR : DataList Execution Mis-Match!");
}
dataObject.DataListID = mergeId;
result = mergeId;
}
else
{
SvrCompiler.ConditionalMerge(null,
DataListMergeFrequency.Always | DataListMergeFrequency.OnCompletion,
dataObject.DatalistOutMergeID, dataObject.DataListID,
dataObject.DatalistOutMergeFrequency, dataObject.DatalistOutMergeType,
dataObject.DatalistOutMergeDepth);
} // else we want to keep the DL around until we end execution
#region Terminate the service if this Service Action is marked to terminate on fault
//If this action should immediately terminate the execution of this service
//then stop here and return the results thus far
if(serviceAction.TerminateServiceOnFault && errors.HasErrors())
{
result = GlobalConstants.NullDataListID;
}
#endregion
}
return result;
}
示例7: ConfigureSwitchCaseExpression
// Travis.Frisinger : 25.01.2013 - Amended to be like decision
internal void ConfigureSwitchCaseExpression(Tuple<ModelItem, IEnvironmentModel> payload)
{
IEnvironmentModel environment = payload.Item2;
ModelItem switchCase = payload.Item1;
string modelData = JsonConvert.SerializeObject(DataListConstants.DefaultCase);
ErrorResultTO errors = new ErrorResultTO();
Guid dataListID = GlobalConstants.NullDataListID;
if (errors.HasErrors()) //BUG 8796, Added this if to handle errors
{
// Bad things happened... Tell the user
PopupProvider.Show(errors.MakeDisplayReady(), GlobalConstants.SwitchWizardErrorHeading,
MessageBoxButton.OK, MessageBoxImage.Error);
// Stop configuring!!!
return;
}
// now invoke the wizard ;)
Uri requestUri;
if (Uri.TryCreate((environment.WebServerAddress + GlobalConstants.SwitchDragWizardLocation), UriKind.Absolute, out requestUri))
{
string uriString = Browser.FormatUrl(requestUri.AbsoluteUri, dataListID);
//var callBackHandler = new Dev2DecisionCallbackHandler();
//callBackHandler.Owner = new WebPropertyEditorWindow(callBackHandler, uriString) { Width = 580, Height = 270 };
//callBackHandler.Owner.ShowDialog();
_callBackHandler.ModelData = modelData;
WebSites.ShowWebPageDialog(uriString, _callBackHandler, 470, 285);
// Wizard finished...
// Now Fetch from DL and push the model data into the workflow
try
{
Dev2Switch ds = JsonConvert.DeserializeObject<Dev2Switch>(callBackHandler.ModelData);
if (ds != null)
{
ModelProperty keyProperty = switchCase.Properties["Key"];
if (keyProperty != null)
{
keyProperty.SetValue(ds.SwitchVariable);
}
}
}
catch
{
// Bad things happened... Tell the user
PopupProvider.Buttons = MessageBoxButton.OK;
PopupProvider.Description = GlobalConstants.SwitchWizardErrorString;
PopupProvider.Header = GlobalConstants.SwitchWizardErrorHeading;
PopupProvider.ImageType = MessageBoxImage.Error;
PopupProvider.Show();
}
}
}
示例8: ConfigureSwitchExpression
internal void ConfigureSwitchExpression(Tuple<ModelItem, IEnvironmentModel> wrapper)
{
IEnvironmentModel environment = wrapper.Item2;
ModelItem switchActivity = wrapper.Item1;
ModelProperty switchProperty = switchActivity.Properties[GlobalConstants.SwitchExpressionPropertyText];
if (switchProperty != null)
{
ModelItem activity = switchProperty.Value;
if (activity != null)
{
IDataListCompiler compiler = DataListFactory.CreateDataListCompiler(environment.DataListChannel);
ModelProperty activityExpression =
activity.Properties[GlobalConstants.SwitchExpressionTextPropertyText];
ErrorResultTO errors = new ErrorResultTO();
Guid dataListID = GlobalConstants.NullDataListID;
if (errors.HasErrors()) //BUG 8796, Added this if to handle errors
{
// Bad things happened... Tell the user
PopupProvider.Show(errors.MakeDisplayReady(), GlobalConstants.SwitchWizardErrorHeading,
MessageBoxButton.OK, MessageBoxImage.Error);
// Stop configuring!!!
return;
}
string webModel = JsonConvert.SerializeObject(DataListConstants.DefaultSwitch);
if (activityExpression != null && activityExpression.Value == null)
{
// Its all new, push the default model
//compiler.PushSystemModelToDataList(dataListID, DataListConstants.DefaultSwitch, out errors);
}
else
{
if (activityExpression != null)
{
if (activityExpression.Value != null)
{
string val = activityExpression.Value.ToString();
if (val.IndexOf(GlobalConstants.InjectedSwitchDataFetch, StringComparison.Ordinal) >= 0)
{
// Time to extract the data
int start = val.IndexOf("(", StringComparison.Ordinal);
if (start > 0)
{
int end = val.IndexOf(@""",AmbientData", StringComparison.Ordinal);
if (end > start)
{
start += 2;
val = val.Substring(start, (end - start));
// Convert back for usage ;)
val = Dev2DecisionStack.FromVBPersitableModelToJSON(val);
if (!string.IsNullOrEmpty(val))
{
var ds = new Dev2Switch { SwitchVariable = val };
webModel = JsonConvert.SerializeObject(ds);
}
}
}
}
}
}
}
// now invoke the wizard ;)
Uri requestUri;
if (Uri.TryCreate((environment.WebServerAddress + GlobalConstants.SwitchDropWizardLocation), UriKind.Absolute, out requestUri))
{
string uriString = Browser.FormatUrl(requestUri.AbsoluteUri, dataListID);
callBackHandler.ModelData = webModel;
WebSites.ShowWebPageDialog(uriString, callBackHandler, 470, 285);
// Wizard finished...
// Now Fetch from DL and push the model data into the workflow
try
{
Dev2Switch ds = JsonConvert.DeserializeObject<Dev2Switch>(_callBackHandler.ModelData);
if (ds != null)
{
// FetchSwitchData
string expressionToInject = string.Join("", GlobalConstants.InjectedSwitchDataFetch, "(\"", ds.SwitchVariable, "\",", GlobalConstants.InjectedDecisionDataListVariable, ")");
if (activityExpression != null)
{
activityExpression.SetValue(expressionToInject);
}
//.........这里部分代码省略.........
示例9: ConfigureDecisionExpression
/// <summary>
/// Configures the decision expression.
/// Travis.Frisinger - Developed for new Decision Wizard
/// </summary>
/// <param name="wrapper">The wrapper.</param>
internal void ConfigureDecisionExpression(Tuple<ModelItem, IEnvironmentModel> wrapper)
{
IEnvironmentModel environment = wrapper.Item2;
ModelItem decisionActivity = wrapper.Item1;
ModelProperty conditionProperty = decisionActivity.Properties[GlobalConstants.ConditionPropertyText];
if (conditionProperty == null) return;
var activity = conditionProperty.Value;
if (activity != null)
{
string val = JsonConvert.SerializeObject(DataListConstants.DefaultStack);
ModelProperty activityExpression = activity.Properties[GlobalConstants.ExpressionPropertyText];
ErrorResultTO errors = new ErrorResultTO();
if (errors.HasErrors()) //BUG 8796, Added this if to handle errors
{
// Bad things happened... Tell the user
PopupProvider.Show(errors.MakeDisplayReady(), GlobalConstants.DecisionWizardErrorHeading, MessageBoxButton.OK, MessageBoxImage.Error);
// Stop configuring!!!
return;
}
// Push the correct data to the server ;)
if (activityExpression != null && activityExpression.Value == null)
{
// Its all new, push the empty model
//compiler.PushSystemModelToDataList(dataListID, DataListConstants.DefaultStack, out errors);
}
else if (activityExpression != null && activityExpression.Value != null)
{
//we got a model, push it in to the Model region ;)
// but first, strip and extract the model data ;)
val = Dev2DecisionStack.ExtractModelFromWorkflowPersistedData(activityExpression.Value.ToString());
if (string.IsNullOrEmpty(val))
{
val = JsonConvert.SerializeObject(DataListConstants.DefaultStack);
}
}
// Now invoke the Wizard ;)
Uri requestUri;
if (Uri.TryCreate((environment.WebServerAddress + GlobalConstants.DecisionWizardLocation), UriKind.Absolute, out requestUri))
{
string uriString = Browser.FormatUrl(requestUri.AbsoluteUri, GlobalConstants.NullDataListID);
_callBackHandler.ModelData = val; // set the model data
//callBackHandler.Owner = new WebPropertyEditorWindow(callBackHandler, uriString);
//callBackHandler.Owner.ShowDialog();
WebSites.ShowWebPageDialog(uriString, _callBackHandler, 824, 508);
WebSites.ShowWebPageDialog(uriString, callBackHandler, 824, 508);
// Wizard finished...
try
{
// Remove naughty chars...
var tmp = callBackHandler.ModelData;
// remove the silly Choose... from the string
tmp = Dev2DecisionStack.RemoveDummyOptionsFromModel(tmp);
// remove [[]], &, !
tmp = Dev2DecisionStack.RemoveNaughtyCharsFromModel(tmp);
Dev2DecisionStack dds = JsonConvert.DeserializeObject<Dev2DecisionStack>(tmp);
if (dds != null)
{
// Empty check the arms ;)
if (string.IsNullOrEmpty(dds.TrueArmText.Trim()))
{
dds.TrueArmText = GlobalConstants.DefaultTrueArmText;
}
if (string.IsNullOrEmpty(dds.FalseArmText.Trim()))
{
dds.FalseArmText = GlobalConstants.DefaultFalseArmText;
}
// Update the decision node on the workflow ;)
string modelData = dds.ToVBPersistableModel();
// build up our injected expression handler ;)
string expressionToInject = string.Join("", GlobalConstants.InjectedDecisionHandler, "(\"", modelData, "\",", GlobalConstants.InjectedDecisionDataListVariable, ")");
if (activityExpression != null)
{
activityExpression.SetValue(expressionToInject);
}
//.........这里部分代码省略.........
示例10: EditSwitchCaseExpression
// 28.01.2013 - Travis.Frisinger : Added for Case Edits
internal void EditSwitchCaseExpression(Tuple<ModelProperty, IEnvironmentModel> payload)
{
IEnvironmentModel environment = payload.Item2;
ModelProperty switchCaseValue = payload.Item1;
string modelData = JsonConvert.SerializeObject(DataListConstants.DefaultCase);
ErrorResultTO errors = new ErrorResultTO();
IDataListCompiler compiler = DataListFactory.CreateDataListCompiler(environment.DataListChannel);
Guid dataListID = GlobalConstants.NullDataListID;
if (errors.HasErrors()) //BUG 8796, Added this if to handle errors
{
// Bad things happened... Tell the user
PopupProvider.Show(errors.MakeDisplayReady(), GlobalConstants.SwitchWizardErrorHeading,
MessageBoxButton.OK, MessageBoxImage.Error);
// Stop configuring!!!
return;
}
// Extract existing value ;)
if (switchCaseValue != null)
{
string val = switchCaseValue.ComputedValue.ToString();
modelData = JsonConvert.SerializeObject(new Dev2Switch() { SwitchVariable = val });
}
else
{
// Problems, push empty model ;)
compiler.PushSystemModelToDataList(dataListID, DataListConstants.DefaultCase, out errors);
}
// now invoke the wizard ;)
Uri requestUri;
if (Uri.TryCreate((environment.WebServerAddress + GlobalConstants.SwitchDragWizardLocation),
UriKind.Absolute, out requestUri))
{
string uriString = Browser.FormatUrl(requestUri.AbsoluteUri, dataListID);
//var callBackHandler = new Dev2DecisionCallbackHandler();
//callBackHandler.Owner = new WebPropertyEditorWindow(callBackHandler, uriString) { Width = 580, Height = 270 };
//callBackHandler.Owner.ShowDialog();
_callBackHandler.ModelData = modelData;
WebSites.ShowWebPageDialog(uriString, _callBackHandler, 470, 285);
// Wizard finished...
// Now Fetch from DL and push the model data into the workflow
try
{
var ds = compiler.FetchSystemModelFromDataList<Dev2Switch>(dataListID, out errors);
if (ds != null)
{
// ReSharper disable PossibleNullReferenceException
switchCaseValue.SetValue(ds.SwitchVariable);
// ReSharper restore PossibleNullReferenceException
}
}
catch
{
// Bad things happened... Tell the user
PopupProvider.Buttons = MessageBoxButton.OK;
PopupProvider.Description = GlobalConstants.SwitchWizardErrorString;
PopupProvider.Header = GlobalConstants.SwitchWizardErrorHeading;
PopupProvider.ImageType = MessageBoxImage.Error;
PopupProvider.Show();
}
}
}