public SearchPageController(
     FindService findService,
     SearchService searchService)
 {
     _findService   = findService;
     _searchService = searchService;
 }
Example #2
0
        public async Task <IActionResult> GetById(Guid id)
        {
            var query  = new FindService(id);
            var result = await _mediator.Send(query);

            return(this.OkOrNotFound(result));
        }
Example #3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            // Session["UserID"] = 1;
            if (IsValid)
            {
                try
                {
                    Find us = new Find();
                    us.UserID = Int32.Parse(Session["UserID"].ToString());

                    us.FindAdd       = TbFindAdd.Text.Trim();
                    us.FindTime      = DateTime.Parse(TbFindTime.Text.Trim());
                    us.FindUserPhone = TbFindUserPhone.Text.Trim();
                    us.FindStatus    = TbFindStatus.Text.Trim();
                    us.FindPetPhoto  = TbFindPetPhoto.Text.Trim();
                    us.FindContent   = TbFindContent.Text.Trim();

                    int i = FindService.insert(us);
                    if (i >= 1)
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "true", "<script>alert('提交成功!');location='zhaoling.aspx'</script>");
                    }
                }
                catch (Exception ex)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "true", "<script>alert('提交失败!失败原因如下:" + ex.Message + "');</script>");
                    Response.Write("错误原因:" + ex);
                }
            }
        }
Example #4
0
        protected override void OnSearch(object sender, string query)
        {
            if (null == query)
            {
                return;
            }

            query = query.Trim();

            if (0 == query.Length)
            {
                return;
            }

            base.OnSearch(sender, query);

            if (query.IndexOf("%") < 0)
            {
                query += "%";
            }

            FindService find = new FindService();

            find.Names.Add(null, query);

            ServiceList list = find.Find();

            grid.DataSource = list.ServiceInfos;
            grid.DataBind();

            count.Text = String.Format(
                Localization.GetString("TEXT_QUERY_COUNT"),
                list.ServiceInfos.Count);
        }
Example #5
0
        public ServiceList FindService(FindService fs)
        {
            Debug.Enter();
            ServiceList sl = null;

            try
            {
                sl = fs.Find();

                //
                // Maybe we could filter service projections out earlier, but this seems to be the
                // most readable place to do it.
                //
                if (1 == Context.ApiVersionMajor)
                {
                    sl.ServiceInfos = FilterServiceProjections(sl.ServiceInfos, fs.BusinessKey);
                }
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(sl);
        }
Example #6
0
        public async Task should_not_return_null_when_service_has_no_active_endpoints()
        {
            var service = new Mongo.Infrastructure.Entities.Service()
            {
                Id        = Guid.NewGuid(),
                Name      = "lorem",
                Endpoints = new[]
                {
                    new Mongo.Infrastructure.Entities.ServiceEndpoint()
                    {
                        Id      = Guid.NewGuid(),
                        Active  = false,
                        Address = "localhost"
                    }
                }
            };
            var mockRepo = RepositoryUtils.MockRepository(service);

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var query = new FindService(service.Id);

            var sut    = new FindServiceHandler(mockDbContext.Object);
            var result = await sut.Handle(query);

            result.Should().NotBeNull();
            result.Name.ShouldBeEquivalentTo(service.Name);
            result.Endpoints.Should().NotBeNullOrEmpty();
        }
Example #7
0
        public UsbController(string certName)
        {
            _certName = certName;
            _keyboard = new KeyboardDevice();
            _mouse    = new MouseDevice();

            _findService        = new FindService(this);
            _findService.Found += _findService_Found;
        }
Example #8
0
        /// <summary>
        /// Gets the service key from service name.
        /// </summary>
        /// <param name="UDDIConnection">The UDDI connection.</param>
        /// <param name="sName">Name of the service.</param>
        /// <returns></returns>
        public static string GetServiceKey(UddiConnection UDDIConnection, string sName)
        {
            FindService findService = new FindService(sName);
            ServiceList bList       = findService.Send(UDDIConnection);

            if (bList.ServiceInfos.Count > 0)
            {
                return(bList.ServiceInfos[0].ServiceKey);
            }
            return(String.Empty);
        }
Example #9
0
        private void BindFindID()
        {
            int       id = Convert.ToInt32(Request.QueryString["id"]);
            DataTable dt = FindService.SelectFindID(id);

            if (dt != null && dt.Rows.Count > 0)
            {
                LvText.DataSource = dt;
                LvText.DataBind();
            }
        }
        public IEnumerable <Dictionary <string, object> > GetPhraseCoordinates(string phrase)
        {
            var tessDataPath    = HttpContext.Current.Server.MapPath(@"~\tessdata");
            var englishLanguage = @"eng";

            var blogPostImage = HttpContext.Current.Server.MapPath(@"~\Images\2.png");
            var service       = new FindService(blogPostImage, tessDataPath, englishLanguage);
            var coords        = service.GettCoordinates(phrase);

            return(coords);
        }
Example #11
0
        public async Task should_return_null_when_service_not_existing()
        {
            var mockRepo = RepositoryUtils.MockRepository <Mongo.Infrastructure.Entities.Service>();

            var mockDbContext = new Mock <IDbContext>();

            mockDbContext.Setup(db => db.Services).Returns(mockRepo.Object);

            var query = new FindService(Guid.NewGuid());

            var sut    = new FindServiceHandler(mockDbContext.Object);
            var result = await sut.Handle(query);

            result.Should().BeNull();
        }
Example #12
0
        public async Task <IActionResult> PostRefresh([FromBody] Models.RefreshService request)
        {
            if (null == request)
            {
                throw new ArgumentNullException(nameof(request));
            }

            var command = new Core.Commands.RefreshServiceStatus(request.Id, 10);

            await _mediator.Publish(command);

            var query  = new FindService(request.Id);
            var result = await _mediator.Send(query);

            return(this.Ok(result));
        }
        private AppServiceFactory()
        {
            var searchEngine = new SearchEngine();

            SearchEngine = searchEngine;

            var findServiceContract = new FindService();

            FindServiceContract = findServiceContract;

            var loadFindFolderService = new LoadFindFolderFromXMLService("FindPoint.xml");

            LoadFindFolderService = loadFindFolderService;

            var logger = new NLogLogger("FindDirectory");

            Logger = logger;
        }
 public Api(ApiKeys apiKeys, HttpClient httpClient = null)
 {
     Security            = new Security(apiKeys, httpClient: httpClient);
     findService         = new FindService(apiKeys.AddressLookupKey, httpClient: httpClient);
     autocompleteService = new AutocompleteService(apiKeys.AddressLookupKey, httpClient: httpClient);
     getService          = new GetService(apiKeys.AddressLookupKey, httpClient: httpClient);
     typeaheadService    = new TypeaheadService(apiKeys.AddressLookupKey, httpClient: httpClient);
     EmailNotifications  = new EmailNotifications(apiKeys.AdministrationKey, httpClient: httpClient);
     usageService        = new UsageService(apiKeys.AdministrationKey, httpClient: httpClient);
     distanceService     = new DistanceService(apiKeys.AddressLookupKey, httpClient: httpClient);
     Subscription        = new SubscriptionService(apiKeys.AdministrationKey, httpClient: httpClient);
     Plans          = new PlansService(apiKeys.AdministrationKey, httpClient: httpClient);
     Webhooks       = new Webhooks(apiKeys.AdministrationKey, httpClient: httpClient);
     Account        = new Account(apiKeys.AdministrationKey, httpClient: httpClient);
     Invoice        = new InvoiceService(apiKeys.AdministrationKey, httpClient: httpClient);
     PrivateAddress = new PrivateAddressService(apiKeys.AdministrationKey, httpClient: httpClient);
     DirectDebt     = new DirectDebtService(apiKeys.AdministrationKey, httpClient: httpClient);
 }
Example #15
0
        /// <summary>
        ///   Publica serviciul cu informatiile specificate in campurile corespunzatoare (daca nu exista deja).
        /// </summary>
        public void performPublish()
        {
            String businessName = txbBusinessName.Text.Trim();
            String serviceName  = txbServiceName.Text.Trim();
            String accessPoint  = txbAccessPoint.Text.Trim();

            if (businessName == String.Empty || serviceName == String.Empty || accessPoint == String.Empty) {

                MessageBox.Show("All values must be set", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try {

                FindBusiness findBusiness = new FindBusiness(businessName);

                findBusiness.FindQualifiers.Add(FindQualifier.ExactNameMatch);

                BusinessList businessList = findBusiness.Send(uddiConnection);

                if (0 == businessList.BusinessInfos.Count) {

                    BusinessEntity newBusinessEntity   = new BusinessEntity(businessName);

                    BusinessService newBusinessService = new BusinessService(serviceName);

                    newBusinessEntity.BusinessServices.Add(newBusinessService);

                    BindingTemplate newBindingTemplate = new BindingTemplate();

                    newBindingTemplate.AccessPoint.Text    = accessPoint;
                    newBindingTemplate.AccessPoint.UrlType = UrlType.Http;

                    selectOntologyForNewBindingTemplate(newBindingTemplate);

                    newBusinessService.BindingTemplates.Add(newBindingTemplate);

                    SaveBusiness saveNewBusiness = new SaveBusiness(newBusinessEntity);

                    saveNewBusiness.Send(uddiConnection);
                }
                else {

                    MessageBox.Show("Business already exists");

                    GetBusinessDetail getBusinessDetail = new GetBusinessDetail(businessList.BusinessInfos[0].BusinessKey);

                    BusinessDetail businessDetail    = getBusinessDetail.Send(uddiConnection);

                    BusinessEntity oldBusinessEntity = businessDetail.BusinessEntities[0];

                    FindService findService = new FindService(serviceName);

                    findService.FindQualifiers.Add(FindQualifier.ExactNameMatch);

                    findService.BusinessKey = businessDetail.BusinessEntities[0].BusinessKey;

                    ServiceList serviceList = findService.Send(uddiConnection);

                    if (0 == serviceList.ServiceInfos.Count) {

                        BusinessService newBusinessService     = new BusinessService(serviceName);

                        oldBusinessEntity.BusinessServices.Add(newBusinessService);

                        BindingTemplate newBindingTemplate     = new BindingTemplate();

                        newBindingTemplate.AccessPoint.Text    = accessPoint;
                        newBindingTemplate.AccessPoint.UrlType = UrlType.Http;

                        selectOntologyForNewBindingTemplate(newBindingTemplate);

                        newBusinessService.BindingTemplates.Add(newBindingTemplate);

                        SaveBusiness saveOldBusiness = new SaveBusiness(oldBusinessEntity);

                        saveOldBusiness.Send(uddiConnection);
                    }
                    else {

                        MessageBox.Show("Service already exists");

                        GetServiceDetail getServiceDetail  = new GetServiceDetail(serviceList.ServiceInfos[0].ServiceKey);

                        ServiceDetail serviceDetail        = getServiceDetail.Send(uddiConnection);

                        BusinessService oldBusinessService = serviceDetail.BusinessServices[0];

                        foreach (BindingTemplate bindingTemplate in oldBusinessService.BindingTemplates) {

                            if (bindingTemplate.AccessPoint.Text == accessPoint) {

                                MessageBox.Show("Binding already exists");
                                return;
                            }
                        }

                        BindingTemplate newBindingTemplate     = new BindingTemplate();

                        newBindingTemplate.AccessPoint.Text    = accessPoint;
                        newBindingTemplate.AccessPoint.UrlType = UrlType.Http;

                        selectOntologyForNewBindingTemplate(newBindingTemplate);

                        oldBusinessService.BindingTemplates.Add(newBindingTemplate);

                        SaveService saveOldService = new SaveService(oldBusinessService);

                        saveOldService.Send(uddiConnection);
                    }
                }

                MessageBox.Show("Publish successful", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (UddiException e) {

                MessageBox.Show("Uddi error: "+ e.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception e){

                MessageBox.Show("General exception: " + e.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #16
0
 public void SetUp()
 {
     service = new FindService();
 }
Example #17
0
        public ServiceList FindService([XmlElement(Namespace = Microsoft.Uddi.VersionSupport.UddiVersionSupport.CurrentNamespace, IsNullable = false)] FindService findService)
        {
            object[] results = InvokeWebMethod("FindService", new object[] { findService });

            return((ServiceList)results[0]);
        }
Example #18
0
 public ServiceList Send(FindService findService)
 {
     return(soapClient.FindService(findService));
 }
Example #19
0
        /// <summary>
        ///   Cauta servicii pe baza informatiilor specificate pornind de la BusinessEntity.
        /// </summary>
        /// <param name="businessKey">Cheia BusinessEntity-ului in care se face cautarea</param>
        private List<WSInfo> findServices(string businessKey)
        {
            FindService findService = new FindService(serviceName);

            if (businessKey != String.Empty) {

                findService.BusinessKey = businessKey;
            }

            if (exactMatch){

                findService.FindQualifiers.Add(FindQualifier.ExactNameMatch);
            }

            if (caseSensitive){

                findService.FindQualifiers.Add(FindQualifier.CaseSensitiveMatch);
            }

            ServiceList serviceList =  findService.Send(uddiConnection);

             if (0 == serviceList.ServiceInfos.Count) {

                return null;
             }

            List<WSInfo> list = new List<WSInfo>();

            exploreServices(list,serviceList);

             if (list.Count != 0) {

                return list;
            }
            else {

                return null;
            }
        }
        /// <summary>
        ///     Face un update al serviciilor retinute.
        /// </summary>
        /// <param name="UDDIAddress">Adresa serverului UDDI (inquire)</param> 
        /// <param name="functionalitiesData">Informatii esentiale despre toate functionalitatile existente, pe baza carora se face cautarea de servicii.</param>
        public void updateServices(string UDDIAddress, string[] functionalitiesData)
        {
            if (functionalitiesData != null)
            {

                try
                {

                    this.services = new Hashtable();

                    UddiConnection uddiConnection = new UddiConnection(UDDIAddress);

                    FindService findService = new FindService("%");

                    ServiceList serviceList = findService.Send(uddiConnection);

                    foreach (ServiceInfo serviceInfo in serviceList.ServiceInfos)
                    {

                        GetServiceDetail getServiceDetail = new GetServiceDetail(serviceInfo.ServiceKey);

                        ServiceDetail serviceDetail = getServiceDetail.Send(uddiConnection);

                        foreach (BindingTemplate bindingTemplate in serviceDetail.BusinessServices[0].BindingTemplates)
                        {

                            Boolean stop = false;

                            for (int k = 0; k < functionalitiesData.Length && !stop; k = k + 3)
                            {

                                for (int j = 0; j < bindingTemplate.TModelInstanceInfos.Count && !stop; ++j)
                                {

                                    if (bindingTemplate.TModelInstanceInfos[j].TModelKey == functionalitiesData[k])
                                    {

                                        stop = true;

                                        string functionalityName = functionalitiesData[k + 1];

                                        string accessPoint = string.Empty;

                                        if (bindingTemplate.AccessPoint.Text.ToLower().EndsWith("asmx"))
                                        {

                                            accessPoint = bindingTemplate.AccessPoint.Text + "?wsdl";
                                        }

                                        if (bindingTemplate.AccessPoint.Text.ToLower().EndsWith("wsdl"))
                                        {

                                            accessPoint = bindingTemplate.AccessPoint.Text;
                                        }

                                        if (accessPoint != string.Empty)
                                        {

                                            XMLElement root = XMLParser.parse(accessPoint);

                                            if (root != null)
                                            {

                                                if (root.containsElements("wsdl:service"))
                                                {

                                                    XMLElement service = root.getElements("wsdl:service")[0];

                                                    if (service.containsAttribute("name"))
                                                    {

                                                        string serviceName = service.getAttribute("name");

                                                        string ontologyPath = functionalitiesData[k + 2];

                                                        if (service.containsAttribute("sawsdl:modelReference"))
                                                        {

                                                            string annotationPath = service.getAttribute("sawsdl:modelReference");

                                                            //specificAnnotationSAWSDL
                                                            this.addSpecificService(serviceName, accessPoint, functionalityName, ontologyPath, annotationPath);
                                                        }
                                                        else
                                                        {

                                                            //defaultAnnotationFromOntology
                                                            this.addDefaultService(serviceName, accessPoint, functionalityName, ontologyPath);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }

                    this._lastError = null;
                }
                catch (UddiException e)
                {

                    this._lastError = "Uddi error: " + e.Message;
                }
                catch (Exception e)
                {

                    this._lastError = "General exception:" + e.Message;
                }
            }
            else
            {

                this._lastError = "There are no functionalities. Try a functionalities update.";
            }
        }