• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Communication.ExecuteMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Dev2.Communication.ExecuteMessage的典型用法代码示例。如果您正苦于以下问题:C# ExecuteMessage类的具体用法?C# ExecuteMessage怎么用?C# ExecuteMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ExecuteMessage类属于Dev2.Communication命名空间,在下文中一共展示了ExecuteMessage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Execute

 /// <summary>
 /// Executes the service
 /// </summary>
 /// <param name="values">The values.</param>
 /// <param name="theWorkspace">The workspace.</param>
 /// <returns></returns>
 public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
 {
     Dev2JsonSerializer serializer = new Dev2JsonSerializer();
     var execMessage = new ExecuteMessage { HasError = false };
     if(!values.ContainsKey("resourceId"))
     {
         Dev2Logger.Log.Info("Delete Version. Invalid Resource Id");
         execMessage.HasError = true;
         execMessage.Message = new StringBuilder( "No resourceId sent to server");
     }
     else if(!values.ContainsKey("versionNumber") )
     {
         Dev2Logger.Log.Info("Delete Version. Invalid Version number");
         execMessage.HasError = true;
         execMessage.Message = new StringBuilder("No versionNumber sent to server");
     }
     else
     {
         try
         {
             var guid = Guid.Parse(values["resourceId"].ToString());
             var version = values["versionNumber"].ToString();
             Dev2Logger.Log.Info(String.Format("Delete Version. ResourceId:{0} VersionNumber{1}",guid,version));
             var res = ServerVersionRepo.DeleteVersion(guid,version);
             execMessage.Message = serializer.SerializeToBuilder(res); 
         }
         catch (Exception e)
         {
             Dev2Logger.Log.Error(String.Format("Delete Version Error."),e);
             execMessage.HasError = true;
             execMessage.Message = new StringBuilder( e.Message);
         }
     }
     return serializer.SerializeToBuilder(execMessage);
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:41,代码来源:DeleteVersion.cs


示例2: Execute

        public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
        {
            var result = new ExecuteMessage { HasError = false };

            Dev2Logger.Log.Info("Find Log Directory");
            try
            {
                var logdir = WorkflowLoggger.GetDirectoryPath(SettingsProvider.Instance.Configuration.Logging);
                var cleanedDir = CleanUp(logdir);
                result.Message.Append("<JSON>");
                result.Message.Append(@"{""PathToSerialize"":""");
                result.Message.Append(cleanedDir);
                result.Message.Append(@"""}");
                result.Message.Append("</JSON>");    
            }
            catch (Exception ex)
            {
                Dev2Logger.Log.Error(ex);
                result.Message.Append(ex.Message);
                result.HasError = true;
            }

            Dev2JsonSerializer serializer = new Dev2JsonSerializer();
            return serializer.SerializeToBuilder(result);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:25,代码来源:FindLogDirectory.cs


示例3: Execute

        public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
        {
            var result = new ExecuteMessage { HasError = false };
            Dev2Logger.Log.Info("Delete Scheduled Resource Service");
            StringBuilder tmp;
            values.TryGetValue("Resource", out tmp);
            var serializer = new Dev2JsonSerializer();

            if (tmp != null)
            {
                var res = serializer.Deserialize<IScheduledResource>(tmp);
                Dev2Logger.Log.Info("Delete Scheduled Resource Service." +res);
                using(var model = SchedulerFactory.CreateModel(GlobalConstants.SchedulerFolderId, SecurityWrapper))
                {
                    model.DeleteSchedule(res);
                }
            }
            else
            {
                Dev2Logger.Log.Info("Delete Scheduled Resource Service. No Resource Selected");
                result.Message.Append("No Resource Selected");
                result.HasError = true;
            }
            return serializer.SerializeToBuilder(result);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:25,代码来源:DeleteScheduledResource.cs


示例4: Execute

        public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
        {
            try
            {

                Dev2Logger.Log.Info("Fetch Server Log Started");
                var result = new ExecuteMessage { HasError = false };
                if (File.Exists(_serverLogPath))
                {
                    var fileStream = File.Open(_serverLogPath, FileMode.Open, FileAccess.Read,FileShare.Read);
                    using (var streamReader = new StreamReader(fileStream))
                    {
                        while(!streamReader.EndOfStream)
                        {
                            result.Message.Append(streamReader.ReadLine());    
                        }
                    }
                }
                Dev2JsonSerializer serializer = new Dev2JsonSerializer();
                return serializer.SerializeToBuilder(result);
            }
            catch (Exception err)
            {
                Dev2Logger.Log.Error("Fetch Server Log Error", err);
                throw;
            }
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:27,代码来源:FetchCurrentServerLog.cs


示例5: Execute

        public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
        {
            string type = null;
            Dev2JsonSerializer serializer = new Dev2JsonSerializer();
            StringBuilder tmp;
            values.TryGetValue("ResourceID", out tmp);
            Guid resourceId = Guid.Empty;
            if(tmp != null)
            {
                if(!Guid.TryParse(tmp.ToString(), out resourceId))
                {
                    Dev2Logger.Log.Info("Delete Resource Service. Invalid Parameter Guid:");
                    var failureResult = new ExecuteMessage { HasError = true };
                    failureResult.SetMessage("Invalid guid passed for ResourceID");
                    return serializer.SerializeToBuilder(failureResult);
                }
            }
            values.TryGetValue("ResourceType", out tmp);
            if(tmp != null)
            {
                type = tmp.ToString();
            }

            Dev2Logger.Log.Info("Delete Resource Service. Resource:" + resourceId);
            // BUG 7850 - TWR - 2013.03.11 - ResourceCatalog refactor
            var msg = ResourceCatalog.Instance.DeleteResource(theWorkspace.ID, resourceId, type);

            var result = new ExecuteMessage { HasError = false };
            result.SetMessage(msg.Message);
            result.HasError = msg.Status != ExecStatus.Success;
            return serializer.SerializeToBuilder(result);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:32,代码来源:DeleteResource.cs


示例6: WorkspaceItemRepositoryWorkspaceItemsExpectedInvokesReadFirstTime

        public void WorkspaceItemRepositoryWorkspaceItemsExpectedInvokesReadFirstTime()
        {
            string resourceName;
            Guid workspaceID;
            Guid serverID;

            var mockConn = new Mock<IEnvironmentConnection>();
            mockConn.Setup(c => c.IsConnected).Returns(true);
            ExecuteMessage msg = new ExecuteMessage { HasError = false };
            msg.SetMessage("Workspace item updated");

            var payload = JsonConvert.SerializeObject(msg);
            mockConn.Setup(c => c.ExecuteCommand(It.IsAny<StringBuilder>(), It.IsAny<Guid>())).Returns(new StringBuilder(payload)).Verifiable();

            var model = CreateModel(ResourceType.Service, mockConn, out resourceName, out workspaceID, out serverID);

            var repositoryPath = GetUniqueRepositoryPath();

            // Create repository file with one item in it
            var repository = new WorkspaceItemRepository(repositoryPath);
            repository.AddWorkspaceItem(model.Object);

            // Now create a new repository from the previous file
            repository = new WorkspaceItemRepository(repositoryPath);

            // Access items for the first time
            var items = repository.WorkspaceItems;

            Assert.AreEqual(1, items.Count);
            Assert.AreEqual(workspaceID, items[0].WorkspaceID);
            Assert.AreEqual(serverID, items[0].ServerID);
            Assert.AreEqual(resourceName, items[0].ServiceName);
            Assert.AreEqual(WorkspaceItem.ServiceServiceType, items[0].ServiceType);
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:34,代码来源:WorkspaceItemRepositoryTests.cs


示例7: Execute

        /// <summary>
        /// Executes the service
        /// </summary>
        /// <param name="values">The values.</param>
        /// <param name="theWorkspace">The workspace.</param>
        /// <returns></returns>
        public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
        {
            var serializer = new Dev2JsonSerializer();
            try
            {
                var res = new ExecuteMessage { HasError = false };
                if (values == null)
                {
                    throw new ArgumentNullException("values");
                }
                if (!values.ContainsKey("versionInfo"))
                {
// ReSharper disable NotResolvedInText
                    throw new ArgumentNullException("No resourceId was found in the incoming data");
// ReSharper restore NotResolvedInText
                }
               
                var version = serializer.Deserialize<IVersionInfo>(values["versionInfo"]);
                Dev2Logger.Log.Info("Get Version. " + version);
                var result = ServerVersionRepo.GetVersion(version);
                res.Message.Append(result);
                Dev2XamlCleaner dev2XamlCleaner = new Dev2XamlCleaner();
                res.Message = dev2XamlCleaner.StripNaughtyNamespaces(res.Message);


                return serializer.SerializeToBuilder(res);

            }
            catch (Exception e)
            {
                Dev2Logger.Log.Error(e);
                IExplorerRepositoryResult error = new ExplorerRepositoryResult(ExecStatus.Fail, e.Message);
                return serializer.SerializeToBuilder(error);
            }
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:41,代码来源:GetVersion.cs


示例8: JsonSerializer_Deserializer_WhenUsingStream_ExpectValidObject

        public void JsonSerializer_Deserializer_WhenUsingStream_ExpectValidObject()
        {
            //------------Setup for test--------------------------
            var theMessage =
                @"Much evil soon high in hope do view. Out may few northward believing attempted. Yet timed being songs marry one defer men our. Although finished blessing do of. Consider speaking me prospect whatever if. Ten nearer rather hunted six parish indeed number. Allowance repulsive sex may contained can set suspected abilities cordially. Do part am he high rest that. So fruit to ready it being views match. 

Knowledge nay estimable questions repulsive daughters boy. Solicitude gay way unaffected expression for. His mistress ladyship required off horrible disposed rejoiced. Unpleasing pianoforte unreserved as oh he unpleasant no inquietude insipidity. Advantages can discretion possession add favourable cultivated admiration far. Why rather assure how esteem end hunted nearer and before. By an truth after heard going early given he. Charmed to it excited females whether at examine. Him abilities suffering may are yet dependent. 

Why end might ask civil again spoil.";

            ExecuteMessage msg = new ExecuteMessage { HasError = false };
            msg.SetMessage(theMessage);

            StringBuilder buffer = new StringBuilder(JsonConvert.SerializeObject(msg));

            //------------Execute Test---------------------------

            Dev2JsonSerializer js = new Dev2JsonSerializer();

            var result = js.Deserialize<ExecuteMessage>(buffer);

            //------------Assert Results-------------------------

            Assert.AreEqual(theMessage, result.Message.ToString());
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:25,代码来源:JsonSerializerTest.cs


示例9: MakeMessage

        public static ExecuteMessage MakeMessage(string msg)
        {
            var result = new ExecuteMessage { HasError = false };
            result.SetMessage(msg);

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


示例10: Execute

        public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
        {
            if(values == null)
            {
                throw new InvalidDataException("Empty values passed.");
            }

            StringBuilder settingsJson;
            values.TryGetValue("Settings", out settingsJson);
            if(settingsJson == null || settingsJson.Length == 0)
            {
                throw new InvalidDataException("Error: Unable to parse values.");
            }
            var serializer = new Dev2JsonSerializer();
            var result = new ExecuteMessage { HasError = false, Message = new StringBuilder() };
            try
            {
                var settings = serializer.Deserialize<Settings>(settingsJson.ToString());
                WriteSecuritySettings(theWorkspace, settings, result);
                WriteLoggingSettings(theWorkspace, settings, result);
            }
            catch (Exception ex)
            {
                Dev2Logger.Log.Error("Error writing settings.", ex);
                result.HasError = true;
                result.Message.AppendLine("Error writing settings.");
            }
            return serializer.SerializeToBuilder(result);
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:29,代码来源:SettingsWrite.cs


示例11: Execute

        public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
        {
            string domain = null;
            string username = null;
            string password = null;

            StringBuilder tmp;
            values.TryGetValue("Domain", out tmp);
            if(tmp != null)
            {
                domain = tmp.ToString();
            }

            values.TryGetValue("Username", out tmp);

            if(tmp != null)
            {
                username = tmp.ToString();
            }

            values.TryGetValue("Password", out tmp);

            if(tmp != null)
            {
                password = tmp.ToString();
            }


            if(string.IsNullOrEmpty(domain) || string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                throw new InvalidDataContractException("Domain or Username or Password is missing");
            }

            var result = new ExecuteMessage { HasError = false };

            try
            {
                if(domain.Equals("."))
                {
                    domain = Environment.UserDomainName;
                }
                bool isValid;
                using(var context = new PrincipalContext(ContextType.Domain, domain))
                {
                    isValid = context.ValidateCredentials(username, password);

                    context.Dispose();
                }
                result.SetMessage(isValid ? "<result>Connection successful!</result>" : "<result>Connection failed. Ensure your username and password are valid</result>");
            }
            catch
            {
                result.SetMessage("<result>Connection failed. Ensure your username and password are valid</result>");
            }

            Dev2JsonSerializer serializer = new Dev2JsonSerializer();

            return serializer.SerializeToBuilder(result);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:59,代码来源:CheckCredentials.cs


示例12: Execute

        public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
        {
            try
            {

     
            Dev2Logger.Log.Info("Find Dependencies");
            var result = new ExecuteMessage { HasError = false };

            string resourceId = null;
            string dependsOnMeString = null;
            bool dependsOnMe = false;
            StringBuilder tmp;
            values.TryGetValue("ResourceId", out tmp);
            if(tmp != null)
            {
                resourceId = tmp.ToString();
            }
            values.TryGetValue("GetDependsOnMe", out tmp);
            if(tmp != null)
            {
                dependsOnMeString = tmp.ToString();
            }
            if (string.IsNullOrEmpty(resourceId))
            {
                throw new InvalidDataContractException("ResourceName is empty or null");
            }
            var resource= ResourceCatalog.Instance.GetResource(theWorkspace.ID, Guid.Parse(resourceId));
            var resourceName = resource.ResourcePath;
            if(!string.IsNullOrEmpty(dependsOnMeString))
            {
                if(!bool.TryParse(dependsOnMeString, out dependsOnMe))
                {
                    dependsOnMe = false;
                }
            }

            if(dependsOnMe)
            {
                result.Message.Append(string.Format("<graph title=\"Local Dependants Graph: {0}\">", resourceName));
                result.Message.Append(FindWhatDependsOnMe(resource, theWorkspace.ID));
                result.Message.Append("</graph>");
            }
            else
            {
                result.Message.Append(string.Format("<graph title=\"Dependency Graph Of {0}\">", resourceName));
                result.Message.Append(FindDependenciesRecursive(resource.ResourceID, theWorkspace.ID));
                result.Message.Append("</graph>");
            }

            Dev2JsonSerializer serializer = new Dev2JsonSerializer();
            return serializer.SerializeToBuilder(result);
            }
            catch (Exception e)
            {
                Dev2Logger.Log.Error(e);
                throw;
            }
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:59,代码来源:FindDependencies.cs


示例13: Execute

        public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
        {
            string serviceId = null;
            string workspaceId = null;

            Dev2JsonSerializer serializer = new Dev2JsonSerializer();
            var result = new ExecuteMessage { HasError = false };

            StringBuilder tmp;
            values.TryGetValue("ServiceID", out tmp);
            if(tmp != null)
            {
                serviceId = tmp.ToString();
            }
            values.TryGetValue("WorkspaceID", out tmp);
            if(tmp != null)
            {
                workspaceId = tmp.ToString();
            }
            values.TryGetValue("FilterList", out tmp);
            if(tmp != null)
            {
            }

            if(string.IsNullOrEmpty(serviceId) || string.IsNullOrEmpty(workspaceId))
            {
                throw new InvalidDataContractException("Null or empty ServiceID or WorkspaceID");
            }

            Guid wGuid;
            Guid sGuid;

            Guid.TryParse(workspaceId, out wGuid);
            Guid.TryParse(serviceId, out sGuid);


            var thisService = ResourceCatalog.Instance.GetResource(wGuid, sGuid);

            if(thisService != null)
            {
                var deps = thisService.Dependencies;

                CompileMessageType[] filters = null; // TODO : Convert string list to enum array ;)

                // ReSharper disable ExpressionIsAlwaysNull
                CompileMessageList msgs = CompileMessageRepo.Instance.FetchMessages(wGuid, sGuid, deps, filters);
                // ReSharper restore ExpressionIsAlwaysNull

                result.Message.Append(serializer.SerializeToBuilder(msgs));
            }
            else
            {
                result.Message.Append("Could not locate service with ID [ " + sGuid + " ]");
                result.HasError = true;
            }

            return serializer.SerializeToBuilder(result);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:58,代码来源:FetchCompileMessages.cs


示例14: Execute

        public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
        {
            ExecuteMessage msg = new ExecuteMessage { HasError = false };

            msg.SetMessage(values["payload"].ToString());

            Dev2JsonSerializer serializer = new Dev2JsonSerializer();

            return serializer.SerializeToBuilder(msg);
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:10,代码来源:TestNetworkService.cs


示例15: ExecuteMessage_Constructor_WhenSettingMessage_ExpectMessageWithNoErrors

        public void ExecuteMessage_Constructor_WhenSettingMessage_ExpectMessageWithNoErrors()
        {
            //------------Setup for test--------------------------
            var executeMessage = new ExecuteMessage { HasError = false};
            executeMessage.SetMessage("the message");
 
            //------------Assert Results-------------------------

            Assert.AreEqual("the message", executeMessage.Message.ToString());
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:10,代码来源:ExecuteMessageTest.cs


示例16: ExecuteMessage_Constructor_WhenSettingHasErrors_ExpectHasErrorsTrue

        public void ExecuteMessage_Constructor_WhenSettingHasErrors_ExpectHasErrorsTrue()
        {
            //------------Setup for test--------------------------
            var executeMessage = new ExecuteMessage { HasError = true};
            executeMessage.SetMessage("the message");

            //------------Assert Results-------------------------

            Assert.IsTrue(executeMessage.HasError);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:10,代码来源:ExecuteMessageTest.cs


示例17: Execute

        public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
        {
            ExecuteMessage msg = new ExecuteMessage {HasError = false};

            msg.SetMessage("Pong @ " + Now.Invoke().ToString("yyyy-MM-dd hh:mm:ss.fff"));

            Dev2JsonSerializer serializer = new Dev2JsonSerializer();

            return serializer.SerializeToBuilder(msg);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:10,代码来源:Ping.cs


示例18: Execute

        public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
        {

            StringBuilder itemXml;
            string isLocal = string.Empty;

            StringBuilder tmp;
            values.TryGetValue("ItemXml", out itemXml);
            values.TryGetValue("IsLocalSave", out tmp);
            if (tmp != null)
            {
                isLocal = tmp.ToString();
            }

            bool isLocalSave;

            bool.TryParse(isLocal, out isLocalSave);

            var res = new ExecuteMessage { HasError = false};

            if(itemXml == null || itemXml.Length == 0)
            {
                res.SetMessage("Invalid workspace item definition " + DateTime.Now);
                res.HasError = true;
            }
            else
            {
                try
                {
                    XElement xe = itemXml.ToXElement();

                    var workspaceItem = new WorkspaceItem(xe);
                    if (workspaceItem.WorkspaceID != theWorkspace.ID)
                    {
                        res.SetMessage("Cannot update a workspace item from another workspace " + DateTime.Now);
                        res.HasError = true;
                    }
                    else
                    {
                        theWorkspace.Update(workspaceItem, isLocalSave);
                        res.SetMessage("Workspace item updated " + DateTime.Now);
                    }
                }
                catch(Exception ex)
                {
                    res.SetMessage("Error updating workspace item " + DateTime.Now);
                    res.SetMessage(ex.Message);
                    res.SetMessage(ex.StackTrace);
                    res.HasError = true;
                }
            }

            Dev2JsonSerializer serializer = new Dev2JsonSerializer();
            return serializer.SerializeToBuilder(res);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:55,代码来源:UpdateWorkspaceItem.cs


示例19: Execute

        public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
        {
            var result = new ExecuteMessage { HasError = false };
            StringBuilder tmp;
            values.TryGetValue("Resource", out tmp);
            var serializer = new Dev2JsonSerializer();
            try
            {
                if(tmp != null)
                {

                    var res = serializer.Deserialize<IScheduledResource>(tmp);
                    Dev2Logger.Log.Info("Save Scheduled Resource. Scheduled Resource:" +res);
                    using(var model = SchedulerFactory.CreateModel(GlobalConstants.SchedulerFolderId, SecurityWrapper))
                    {
                        StringBuilder userName;
                        StringBuilder password;

                        values.TryGetValue("UserName", out userName);
                        values.TryGetValue("Password", out password);
                        if(userName == null || password == null)
                        {
                            result.Message.Append("No UserName or password provided");
                            result.HasError = true;
                        }
                        else
                        {
                            StringBuilder previousTask;
                            values.TryGetValue("PreviousResource", out previousTask);

                            model.Save(res, userName.ToString(), password.ToString());
                            if(previousTask != null && !String.IsNullOrEmpty(previousTask.ToString()) && previousTask.ToString() != res.Name)
                            {
                                model.DeleteSchedule(new ScheduledResource(previousTask.ToString(), SchedulerStatus.Disabled, DateTime.MaxValue, null, null));
                            }
                        }
                    }
                }
                else
                {
                    result.Message.Append("No Resource Selected");
                    result.HasError = true;
                }
            }
            catch(Exception e)
            {
                Dev2Logger.Log.Error(e);
                result.Message.Append(string.Format("Error while saving: {0}", e.Message.Remove(e.Message.IndexOf('.'))));
                result.HasError = true;
            }
            return serializer.SerializeToBuilder(result);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:52,代码来源:SaveScheduledResource.cs


示例20: Execute

        public StringBuilder Execute(Dictionary<string, StringBuilder> values, IWorkspace theWorkspace)
        {

            
            string oldCategory = null;
            string newCategory = null;
            string resourceType = null;
            if(values == null)
            {
                throw new InvalidDataContractException("No parameter values provided.");
            }
            StringBuilder tmp;
            values.TryGetValue("OldCategory", out tmp);
            if(tmp != null)
            {
                oldCategory = tmp.ToString();
            }
            values.TryGetValue("NewCategory", out tmp);
            if(tmp != null)
            {
                newCategory = tmp.ToString();
            }
            values.TryGetValue("ResourceType", out tmp);
            if(tmp != null)
            {
                resourceType = tmp.ToString();
            }

            if(oldCategory == null)
            {
                
                throw new InvalidDataContractException("No value provided for OldCategory parameter.");
            }
            if(String.IsNullOrEmpty(newCategory))
            {
                throw new InvalidDataContractException("No value provided for NewCategory parameter.");
            }
            if(String.IsNullOrEmpty(resourceType))
            {
                throw new InvalidDataContractException("No value provided for ResourceType parameter.");
            }
            Dev2Logger.Log.Info(String.Format( "Rename Category. Old {0} New {1} Type{2}",oldCategory,newCategory,resourceType));
            var saveResult = ResourceCatalog.Instance.RenameCategory(Guid.Empty, oldCategory, newCategory);

            ExecuteMessage msg = new ExecuteMessage { HasError = false };
            msg.SetMessage(saveResult.Message);
            Dev2JsonSerializer serializer = new Dev2JsonSerializer();
            return serializer.SerializeToBuilder(msg);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:49,代码来源:RenameCategoryResource.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Environments.TestEnvironmentRespository类代码示例发布时间:2022-05-24
下一篇:
C# Repositories.StudioResourceRepository类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap