当前位置: 首页>>代码示例>>C#>>正文


C# ErrorResultTO.HasErrors方法代码示例

本文整理汇总了C#中Dev2.DataList.Contract.ErrorResultTO.HasErrors方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorResultTO.HasErrors方法的具体用法?C# ErrorResultTO.HasErrors怎么用?C# ErrorResultTO.HasErrors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dev2.DataList.Contract.ErrorResultTO的用法示例。


在下文中一共展示了ErrorResultTO.HasErrors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExecutionImpl

        protected override Guid ExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out ErrorResultTO tmpErrors)
        {
            tmpErrors = new ErrorResultTO();
            var webserviceExecution = GetNewWebserviceExecution(dataObject);


            if(webserviceExecution != null && !tmpErrors.HasErrors())
            {
                webserviceExecution.InstanceOutputDefintions = outputs; // set the output mapping for the instance ;)
                webserviceExecution.InstanceInputDefinitions = inputs;
                ErrorResultTO invokeErrors;
                var result = webserviceExecution.Execute(out invokeErrors);
                dataObject.Environment.AddError(invokeErrors.MakeDataListReady());
                return result;
            }
            return Guid.NewGuid();
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:17,代码来源:DsfWebserviceActivity.cs

示例2: DsfPluginActivity_DsfPluginActivityUnitTest_ExecutePluginService_ServiceExecuted

        // ReSharper disable InconsistentNaming
        public void DsfPluginActivity_DsfPluginActivityUnitTest_ExecutePluginService_ServiceExecuted()
        // ReSharper restore InconsistentNaming
        {
            //init
            var pluginActivity = new MockDsfPluginActivity();
            var errors = new ErrorResultTO();
            var mockContainer = new Mock<PluginServiceExecution>(new DsfDataObject(It.IsAny<string>(), It.IsAny<Guid>()), It.IsAny<bool>());
            mockContainer.Setup(c => c.Execute(out errors, 0)).Verifiable();

            //exe
            pluginActivity.MockExecutePluginService(mockContainer.Object);

            //assert
            Assert.IsFalse(errors.HasErrors(), "Errors where thrown while executing a plugin service");
            mockContainer.Verify(c => c.Execute(out errors, 0), Times.Once());
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:17,代码来源:DsfPluginActivityTests.cs

示例3: ExecuteConcreteAction

        protected override IList<OutputTO> ExecuteConcreteAction(IDSFDataObject dataObject, out ErrorResultTO allErrors, int update)
        {
            IList<OutputTO> outputs = new List<OutputTO>();

            allErrors = new ErrorResultTO();
            var colItr = new WarewolfListIterator();

            //get all the possible paths for all the string variables
            var inputItr = new WarewolfIterator(dataObject.Environment.Eval(OutputPath, update));
            colItr.AddVariableToIterateOn(inputItr);

            var unameItr = new WarewolfIterator(dataObject.Environment.Eval(Username, update));
            colItr.AddVariableToIterateOn(unameItr);

            var passItr = new WarewolfIterator(dataObject.Environment.Eval(DecryptedPassword,update));
            colItr.AddVariableToIterateOn(passItr);

            var privateKeyItr = new WarewolfIterator(dataObject.Environment.Eval(PrivateKeyFile, update));
            colItr.AddVariableToIterateOn(privateKeyItr);

            var contentItr =new WarewolfIterator(dataObject.Environment.Eval(FileContents, update));
            colItr.AddVariableToIterateOn(contentItr);

            outputs.Add(DataListFactory.CreateOutputTO(Result));


            if(dataObject.IsDebugMode())
            {
                AddDebugInputItem(OutputPath, "Output Path", dataObject.Environment, update);
                AddDebugInputItem(new DebugItemStaticDataParams(GetMethod(), "Method"));
                AddDebugInputItemUserNamePassword(dataObject.Environment, update);
                if (!string.IsNullOrEmpty(PrivateKeyFile))
                {
                    AddDebugInputItem(PrivateKeyFile, "Private Key File", dataObject.Environment, update);
                }
                AddDebugInputItem(FileContents, "File Contents", dataObject.Environment, update);
            }

            while(colItr.HasMoreData())
            {
                IActivityOperationsBroker broker = ActivityIOFactory.CreateOperationsBroker();
                var writeType = GetCorrectWriteType();
                Dev2PutRawOperationTO putTo = ActivityIOFactory.CreatePutRawOperationTO(writeType, TextUtils.ReplaceWorkflowNewLinesWithEnvironmentNewLines(colItr.FetchNextValue(contentItr)));
                IActivityIOPath opath = ActivityIOFactory.CreatePathFromString(colItr.FetchNextValue(inputItr),
                                                                                colItr.FetchNextValue(unameItr),
                                                                                colItr.FetchNextValue(passItr),
                                                                                true, colItr.FetchNextValue(privateKeyItr));
                IActivityIOOperationsEndPoint endPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(opath);

                try
                {
                    if(allErrors.HasErrors())
                    {
                        outputs[0].OutputStrings.Add(null);
                    }
                    else
                    {
                        string result = broker.PutRaw(endPoint, putTo);
                        outputs[0].OutputStrings.Add(result);
                    }
                }
                catch(Exception e)
                {
                    outputs[0].OutputStrings.Add(null);
                    allErrors.AddError(e.Message);
                    break;
                }
            }

            return outputs;
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:71,代码来源:DsfFileWrite.cs

示例4: 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);
            }
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:35,代码来源:EsbServiceInvoker.cs

示例5: 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();
//.........这里部分代码省略.........
开发者ID:Robin--,项目名称:Warewolf,代码行数:101,代码来源:EsbServiceInvoker.cs

示例6: CreateBinaryDataListFromXmlData

        /// <summary>
        ///     Creates a binary data list from XML data.
        /// </summary>
        /// <param name="xmlDataList">The XML data list.</param>
        /// <param name="errors">The errors.</param>
        /// <returns></returns>
        private IBinaryDataList CreateBinaryDataListFromXmlData(string xmlDataList, out ErrorResultTO errors)
        {
            IDataListCompiler compiler = DataListFactory.CreateDataListCompiler();
            IBinaryDataList result = null;
            var allErrors = new ErrorResultTO();
            Guid dlGuid = compiler.ConvertTo(
                DataListFormat.CreateFormat(GlobalConstants._Studio_XML), xmlDataList.ToStringBuilder(), xmlDataList.ToStringBuilder(), out errors);

            if(!errors.HasErrors())
            {
                result = compiler.FetchBinaryDataList(dlGuid, out errors);
                if(errors.HasErrors())
                {
                    allErrors.MergeErrors(errors);
                }
            }

            compiler.ForceDeleteDataListByID(dlGuid);
            return result;
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:26,代码来源:DataListViewModel.cs

示例7: MergeErrors

        /// <summary>
        /// Merges the errors.
        /// </summary>
        /// <param name="toMerge">To merge.</param>
        public void MergeErrors(ErrorResultTO toMerge)
        {
            if (toMerge != null && toMerge.HasErrors())
            {
                // Flipping Union does not appear to work
                foreach (string wtf in toMerge.FetchErrors())
                {
                    _errorList.Add(wtf);
                }

                toMerge.ClearErrors();
            }
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:17,代码来源:ErrorResultTO.cs

示例8: 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()));
            }
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:20,代码来源:DynamicServicesInvoker.cs

示例9: CreateListsOfIDataListItemModelToBindTo

        /// <summary>
        ///     Creates the list of data list item view model to bind to.
        /// </summary>
        /// <param name="errorString">The error string.</param>
        /// <returns></returns>
        public void CreateListsOfIDataListItemModelToBindTo(out string errorString)
        {
            errorString = string.Empty;
            IDataListCompiler compiler = DataListFactory.CreateDataListCompiler();
            if(!string.IsNullOrEmpty(Resource.DataList))
            {
                ErrorResultTO errors = new ErrorResultTO();
                try
                {
                    IBinaryDataList binarnyDl = CreateBinaryDataListFromXmlData(Resource.DataList, out errors);
                    if (!errors.HasErrors())
                    {
                        ConvertBinaryDataListToListOfIDataListItemModels(binarnyDl, out errorString);
                    }
                    else
                    {
                        string errorMessage = errors.FetchErrors().Aggregate(string.Empty, (current, error) => current + error);
                        throw new Exception(errorMessage);
                    }
                    if (binarnyDl != null)
                        compiler.ForceDeleteDataListByID(binarnyDl.UID);
                }
                catch(Exception)
                {
                    errors.AddError("Invalid variable list. Please insure that your variable list has valid entries");
                }
               

            }
            else
            {
                RecsetCollection.Clear();
                AddRecordSet();
                ScalarCollection.Clear();
            }

            BaseCollection = new OptomizedObservableCollection<DataListHeaderItemModel>();

            DataListHeaderItemModel varNode = DataListItemModelFactory.CreateDataListHeaderItem("Variable");
            if(ScalarCollection.Count == 0)
            {
                var dataListItemModel = DataListItemModelFactory.CreateDataListModel(string.Empty);
                ScalarCollection.Add(dataListItemModel);
            }
            varNode.Children = ScalarCollection;
            BaseCollection.Add(varNode);

            //AddRecordsetNamesIfMissing();

            DataListHeaderItemModel recordsetsNode = DataListItemModelFactory.CreateDataListHeaderItem("Recordset");
            if(RecsetCollection.Count == 0)
            {
                AddRecordSet();
            }
            recordsetsNode.Children = RecsetCollection;
            BaseCollection.Add(recordsetsNode);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:62,代码来源:DataListViewModel.cs

示例10: Invoke

        /// <summary>
        ///     Responsible for the processing of all inbound requests
        ///     This method is reentrant and will call itself to
        ///     for every invocation required in every generation
        ///     of nesting. e.g services made up of services
        /// </summary>
        /// <param name="resourceDirectory">The singleton instance of the service library that contains all the logical services</param>
        /// <param name="xmlRequest">The actual client request message</param>
        /// <param name="dataListId">The id of the data list</param>
        /// <param name="errors">Errors resulting from this invoke</param>
        /// <returns></returns>
        public Guid Invoke(IDynamicServicesHost resourceDirectory, dynamic xmlRequest, Guid dataListId,
                           out ErrorResultTO errors)
        {
            // Host = resourceDirectory

            #region Async processing of client request - queue the work item asynchronously

            //Get an UnlimitedObject from the xml string provided by the caller
            //TraceWriter.WriteTraceIf(_managementChannel != null && _loggingEnabled, "Inspecting inbound data request", Resources.TraceMessageType_Message);
            Guid result = GlobalConstants.NullDataListID;

            var allErrors = new ErrorResultTO();
            errors = new ErrorResultTO();

            if(xmlRequest.Async is string)
            {
                //TraceWriter.WriteTrace(_managementChannel, "Caller requested async execution");
                bool isAsync;

                bool.TryParse(xmlRequest.Async, out isAsync);

                if(isAsync)
                {
                    ThreadPool.QueueUserWorkItem(delegate
                    {
                        ErrorResultTO tmpErrors;
                        //TraceWriter.WriteTrace(_managementChannel, "Queuing Asynchronous work", Resources.TraceMessageType_Message);
                        xmlRequest.RemoveElementByTagName("Async");
                        IDynamicServicesInvoker invoker = new DynamicServicesInvoker(_dsfChannel, _managementChannel);
                        result = invoker.Invoke(resourceDirectory, xmlRequest, dataListId, out tmpErrors);
                        if(tmpErrors.HasErrors())
                        {
                            allErrors.MergeErrors(tmpErrors);
                        }
                        //TraceWriter.WriteTrace(result.XmlString);
                        if(result != GlobalConstants.NullDataListID)
                        {
                            // PBI : 5376
                            SvrCompiler.DeleteDataListByID(result, true); //TODO: Clean it up ;)
                        }
                    });
                    dynamic returnData = new UnlimitedObject();
                    returnData.Load(string.Format("<ServiceResponse>{0} Work Item Queued..</ServiceResponse>",
                                                  DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.fff")));
                    return returnData;
                }
            }

            #endregion

            #region Get a handle on the service that is being requested from the service directory

            string serviceName = string.Empty;

            //Set the service name as this is a complex message
            //with multiple services requests embedded in the inbound data
            //This will allow us to 
            if(xmlRequest.Service is IEnumerable<UnlimitedObject>)
            {
                IEnumerable<UnlimitedObject> services = xmlRequest.Service;
                dynamic serviceData = services.First();
                if(serviceData.Service is string)
                {
                    serviceName = serviceData.Service;
                }
            }


            //If there is only a single service request then get the service name
            if(xmlRequest.Service is string)
            {
                serviceName = xmlRequest.Service;
            }

            //If the service name does not exist return an error to the caller
            if(string.IsNullOrEmpty(serviceName))
            {
                xmlRequest.Error = Resources.DynamicServiceError_ServiceNotSpecified;
            }

            //Try to retrieve the service from the service directory

            IEnumerable<DynamicService> service;
            Host.LockServices();

            try
            {
                service = from c in resourceDirectory.Services
                          where serviceName != null
//.........这里部分代码省略.........
开发者ID:Robin--,项目名称:Warewolf,代码行数:101,代码来源:DynamicServicesInvoker.cs

示例11: ManagementDynamicService

        /// <summary>
        /// Invoke a management method which is a statically coded method in the service implementation for service engine administrators
        /// </summary>
        /// <param name="serviceAction">Action of type InvokeManagementDynamicService</param>
        /// <param name="xmlRequest">The XML request.</param>
        /// <returns>
        /// UnlimitedObject
        /// </returns>
        public Guid  ManagementDynamicService(ServiceAction serviceAction, IDSFDataObject xmlRequest)
        {
            var errors = new ErrorResultTO();
            var allErrors = new ErrorResultTO();
            Guid result = GlobalConstants.NullDataListID;

            try
            {
                object[] parameterValues = null;
                //Instantiate a Endpoint object that contains all static management methods
                object o = this;
                //Activator.CreateInstance(typeof(Unlimited.Framework.DynamicServices.DynamicServicesEndpoint), new object[] {string.Empty});

                //Get the management method
                MethodInfo m = o.GetType().GetMethod(serviceAction.SourceMethod);
                //Infer the parameters of the management method
                ParameterInfo[] parameters = m.GetParameters();
                //If there are parameters then retrieve them from the service action input values
                if(parameters.Count() > 0)
                {
                    IEnumerable<object> parameterData = from c in serviceAction.ServiceActionInputs
                                                        select c.Value;

                    parameterValues = parameterData.ToArray();
                }
                //Invoke the management method and store the return value
                string val = m.Invoke(o, parameterValues).ToString();

                result = ClientCompiler.UpsertSystemTag(xmlRequest.DataListID, enSystemTag.ManagmentServicePayload, val,
                                                         out errors);

                //_clientCompiler.Upsert(xmlRequest.DataListID, DataListUtil.BuildSystemTagForDataList(enSystemTag.ManagmentServicePayload, true), val, out errors);
                allErrors.MergeErrors(errors);

                //returnval = new UnlimitedObject(GetXElement(val));
            }
            catch(Exception ex)
            {
                allErrors.AddError(ex.Message);
            }
            finally
            {
                // handle any errors that might have occured

                if(allErrors.HasErrors())
                {
                    IBinaryDataListEntry be = Dev2BinaryDataListFactory.CreateEntry(enSystemTag.Error.ToString(),
                                                                                    string.Empty);
                    string error;
                    be.TryPutScalar(
                        Dev2BinaryDataListFactory.CreateBinaryItem(allErrors.MakeDataListReady(),
                                                                   enSystemTag.Error.ToString()), out error);
                    if(error != string.Empty)
                    {
                        errors.AddError(error);
                    }
                }

                // No cleanup to happen ;)
            }

            return result;
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:71,代码来源:DynamicServicesInvoker.cs

示例12: 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();
                }
            }
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:60,代码来源:UserInterfaceLayoutProvider.cs

示例13: 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);
                                }
//.........这里部分代码省略.........
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:101,代码来源:UserInterfaceLayoutProvider.cs

示例14: 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);
                            }
//.........这里部分代码省略.........
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:101,代码来源:UserInterfaceLayoutProvider.cs

示例15: 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();
                }
            }
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:73,代码来源:UserInterfaceLayoutProvider.cs


注:本文中的Dev2.DataList.Contract.ErrorResultTO.HasErrors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。