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


C# Connect.GetServiceRequestResources方法代码示例

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


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

示例1: Convert

            /// <summary>
            /// Converts the service request database instance to IService instance
            /// </summary>
            /// <param name="service">ServiceRequest instance</param>
            /// <returns>IService instance</returns>
            /// <exception cref="Siminov.Connect.Exception.ServiceException">ServiceException If any exception occur while converting the instance</exception>
		    public IService Convert(Connect.Model.ServiceRequest service) 
            {
			
			    IService iService = (IService) ClassUtils.CreateClassInstance(service.GetInstanceOf());
			    iService.SetRequestId(service.GetRequestId());
			    iService.SetService(service.GetService());
			    iService.SetRequest(service.GetRequest());
			
			    IEnumerator<ServiceRequestResource> serviceRequestResources = service.GetServiceRequestResources();
			    while(serviceRequestResources.MoveNext()) 
                {
				    ServiceRequestResource serviceResource = serviceRequestResources.Current;
				    iService.AddResource(serviceResource.GetName(), serviceResource.GetValue());
			    }

			    ServiceDescriptor serviceDescriptor = resourceManager.RequiredServiceDescriptorBasedOnName(service.GetService());
			    iService.SetServiceDescriptor(serviceDescriptor);
			
			    ResourceUtils.Resolve(iService);

			    return iService;
		    }
开发者ID:gitter-badger,项目名称:connect-1,代码行数:28,代码来源:AsyncServiceWorker.cs

示例2: ContainService

		    /**
		     * Check whether it contains the requested service or not
		     * @param service Service
		     * @return (true/false) TRUE: If service request already exists | FALSE: If service does not exists
		     * @throws ServiceException If there is any exception while checking for request
		     */
		    public bool ContainService(Connect.Model.ServiceRequest service) 
            {
			
			    Connect.Model.ServiceRequest[] services = null;
			    try 
                {
                    services = (Connect.Model.ServiceRequest[]) new Connect.Model.ServiceRequest().Select().Execute();
			    } 
                catch(DatabaseException de) 
                {
				    Log.Error(typeof(AsyncServiceWorker).Name, "ContainService", "DatabaseException caught while getting services from database, " + de.GetMessage());
				    throw new ServiceException(typeof(AsyncServiceWorker).Name, "ContainService", de.GetMessage());
			    }
			
			
			    if(services == null || services.Length <= 0) 
                {
				    return false;
			    }
			
			    for(int i = 0;i < services.Length;i++) 
                {
				
				    Connect.Model.ServiceRequest savedService = services[i];
				    if(service.GetService().Equals(savedService.GetService(), StringComparison.OrdinalIgnoreCase)) 
                    {
					
					    if(service.GetRequest().Equals(savedService.GetRequest(), StringComparison.OrdinalIgnoreCase)) 
                        {
						
						    bool contain = true;
						
						    IEnumerator<ServiceRequestResource> serviceRequestResources = service.GetServiceRequestResources();
						    while(serviceRequestResources.MoveNext()) 
                            {
							
							    ServiceRequestResource serviceResource = serviceRequestResources.Current;
							    ServiceRequestResource savedRequestResource = savedService.GetServiceRequestResource(serviceResource.GetName());
							
							    if(savedRequestResource == null) 
                                {
								    contain = false;
								    break;
							    }
							
							    if(!serviceResource.GetName().Equals(savedRequestResource.GetName(), StringComparison.OrdinalIgnoreCase)) 
                                {
								    contain = false;
								    break;
							    } 
                                else if(!serviceResource.GetValue().Equals(savedRequestResource.GetValue(), StringComparison.OrdinalIgnoreCase)) 
                                {
								    contain = false;
								    break;
							    }
						    }
						
						    if(contain) 
                            {
							    return true;
						    }
					    }
				    } 
			    }
			
			
			    return false;
		    }
开发者ID:gitter-badger,项目名称:connect-1,代码行数:74,代码来源:AsyncServiceWorker.cs


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