コード例 #1
0
        protected override void Execute(CodeActivityContext context)
        {
            Initialize(context);
            Intermediary intermediary = new Intermediary(name, email, routingOrder);

            AddRecipient(context, intermediary);
        }
コード例 #2
0
        public override JsonElement Apply(JsonElement data)
        {
            var input       = _input.Apply(data);
            var accumulator = _initial.Apply(data);

            if (input.ValueKind == JsonValueKind.Null)
            {
                return(accumulator);
            }
            if (input.ValueKind != JsonValueKind.Array)
            {
                throw new JsonLogicException($"Cannot reduce on {input.ValueKind}.");
            }

            foreach (var element in input.EnumerateArray())
            {
                var intermediary = new Intermediary
                {
                    Current     = element,
                    Accumulator = accumulator
                };
                using var doc = JsonDocument.Parse(JsonSerializer.Serialize(intermediary, _options));
                var item = doc.RootElement.Clone();

                accumulator = _rule.Apply(item);
            }

            return(accumulator);
        }
 public IActionResult Post([FromBody] Intermediary intermediary)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest());
     }
     return(Ok(_unitOfWork.Intermediary.Insert(intermediary)));
 }
 public IActionResult Put([FromBody] Intermediary intermediary)
 {
     if (ModelState.IsValid && _unitOfWork.Intermediary.Update(intermediary))
     {
         return(Ok(new { Message = "El intermediario se ha actualizado" }));
     }
     else
     {
         return(BadRequest());
     }
 }
コード例 #5
0
        public void Test9()
        {
            var          config      = InitConfiguration();
            Provider     provider    = Provider.FilmWorld;
            string       id          = "-1op,l;";
            CinemaWorld  cinemaWorld = new CinemaWorld(config.GetSection("CinemaWorldApi").Value, config.GetSection("CinemaWorldAccessToken").Value);
            FilmWorld    filmWorld   = new FilmWorld(config.GetSection("FilmWorldApi").Value, config.GetSection("FilmWorldAccessToken").Value);
            Intermediary im          = new Intermediary(cinemaWorld, filmWorld);
            Decimal      price       = im.MoviePrice(provider, id).Result;

            Assert.AreEqual(-1, price);
        }
コード例 #6
0
    static void Main(string[] args)
    {
        string        xml = @"<root><ordinal>1</ordinal><postal>02345</postal></root>";
        XmlSerializer xs  = new XmlSerializer(typeof(Intermediary));

        using (TextReader reader = new StringReader(xml))
        {
            Intermediary obj  = (Intermediary)xs.Deserialize(reader);
            string       json = JsonConvert.SerializeObject(obj, Formatting.Indented);
            Console.WriteLine(json);
        }
    }
 public IActionResult Delete([FromBody] Intermediary intermediary)
 {
     if (intermediary.Id > 0)
     {
         return(Ok(_unitOfWork.Intermediary.Delete(intermediary
                                                   )));
     }
     else
     {
         return(BadRequest());
     }
 }
コード例 #8
0
        public void DoWork()
        {
            //Task.Run(() =>
            //{
            Producer     yxpProducer     = new Producer("优信拍列表页", listConQueue, this);
            Intermediary yxpMiddleWorker = new Intermediary("优信拍详情页", listConQueue, detailConQueue, this);
            Consumer     yxpStrorer      = new Consumer("优信拍存储", detailConQueue, new DataStorer());

            yxpProducer.Thread.Start();
            yxpMiddleWorker.Thread.Start();
            yxpStrorer.Start();
            //});
        }
コード例 #9
0
ファイル: AllMovies.cs プロジェクト: gitpraj/WebJetAPI
        public void Test3()
        {
            var config = InitConfiguration();
            IEnumerable <MovieSummary> movies;
            CinemaWorld  cinemaWorld = new CinemaWorld(config.GetSection("CinemaWorldApi").Value, config.GetSection("CinemaWorldAccessToken").Value);
            FilmWorld    filmWorld   = new FilmWorld(config.GetSection("FilmWorldApi").Value, config.GetSection("FilmWorldAccessToken").Value);
            Intermediary im          = new Intermediary(cinemaWorld, filmWorld);

            movies = im.FindMovies("new hope").Result;

            List <MovieSummary> movieList = movies.ToList();
            int count = movieList.Count();

            Assert.AreEqual(2, count);
        }
コード例 #10
0
ファイル: AllMovies.cs プロジェクト: gitpraj/WebJetAPI
        public void Test5()
        {
            var config = InitConfiguration();
            IEnumerable <MovieSummary> movies;
            CinemaWorld  cinemaWorld = new CinemaWorld(config.GetSection("CinemaWorldApi").Value, config.GetSection("CinemaWorldAccessToken").Value);
            FilmWorld    filmWorld   = new FilmWorld(config.GetSection("FilmWorldApi").Value, config.GetSection("FilmWorldAccessToken").Value);
            Intermediary im          = new Intermediary(cinemaWorld, filmWorld);

            movies = im.FindMovies("John wick").Result;

            List <MovieSummary> movieList = movies.ToList();
            var ret   = movieList.Where(m => m.Title.ToLower().Contains("John Wick".ToLower(), StringComparison.OrdinalIgnoreCase)).ToList();
            int count = ret.Count();

            Assert.AreEqual(0, count);
        }
コード例 #11
0
        /// <summary>
        /// Renders a target intermediary.
        /// </summary>
        /// <param name="containerNode">The HTML container to render into.</param>
        /// <param name="intermediary">The target intermediary.</param>
        private static void RenderTargetScenarioIntermediary(HtmlNode containerNode, Intermediary intermediary)
        {
            var snippet = HtmlResources.ApplicationSnippetResource;
            var refId   = Guid.NewGuid().ToString();

            snippet = snippet.Replace("{icon}", HtmlResources.TargetMessagingObjectIconIntermediary);
            snippet = snippet.Replace("{refId}", refId);
            snippet = snippet.Replace("{name}", intermediary.Name);
            snippet = snippet.Replace("{stars}", BuildResourceStarsSnippetFromRating((int)intermediary.Rating));

            // Build the description rows.
            var descriptionBuilder = new StringBuilder();

            if (!string.IsNullOrEmpty(intermediary.Description))
            {
                descriptionBuilder.Append(string.Format(CultureInfo.CurrentCulture, HtmlResources.TargetApplicationSnippetDescriptionRow, intermediary.Description));
            }
            descriptionBuilder.Append(string.Format(CultureInfo.CurrentCulture, HtmlResources.TargetApplicationSnippetPropertyRow, HtmlResources.TargetApplicationPropertyIntermediaryType, intermediary.IntermediaryType.ToString()));
            if (intermediary is MessageRouter)
            {
                descriptionBuilder.Append(string.Format(CultureInfo.CurrentCulture, HtmlResources.TargetApplicationSnippetPropertyRow, HtmlResources.TargetApplicationPropertyMessageRouterType, ((MessageRouter)intermediary).MessageRouterType.ToString()));
            }
            if (intermediary is MessageProcessor)
            {
                descriptionBuilder.Append(string.Format(CultureInfo.CurrentCulture, HtmlResources.TargetApplicationSnippetPropertyRow, HtmlResources.TargetApplicationPropertyMessageProcessorType, ((MessageProcessor)intermediary).MessageProcessorType.ToString()));
            }
            snippet = snippet.Replace("{description}", descriptionBuilder.ToString());

            var node = CreateNodeWithSnippetContent(snippet);

            containerNode.AppendChild(node);

            // Build the analysis content for this resource.
            var childNode = node.SelectSingleNode(string.Format(CultureInfo.CurrentCulture, HtmlResources.ApplicationResourceChildJQuery, refId));

            // Create the properties.
            RenderMessagingObjectProperties(childNode, intermediary);

            // Create the analysis messages:
            RenderMessagingObjectMessages(childNode, intermediary);

            // List out the resources that will be created for the item.
            RenderMessagingObjectResources(childNode, intermediary);

            // Create the links.
            RenderMessagingObjectLinks(childNode, intermediary);
        }
コード例 #12
0
ファイル: MoviesController.cs プロジェクト: gitpraj/WebJetAPI
 public IActionResult GetMoviePrice(Provider provider, String id)
 {
     try
     {
         Decimal      price;
         CinemaWorld  cinemaWorld = new CinemaWorld(Configuration.GetSection("CinemaWorldApi").Value, Configuration.GetSection("CinemaWorldAccessToken").Value);
         FilmWorld    filmWorld   = new FilmWorld(Configuration.GetSection("FilmWorldApi").Value, Configuration.GetSection("FilmWorldAccessToken").Value);
         Intermediary im          = new Intermediary(cinemaWorld, filmWorld);
         price = im.MoviePrice(provider, id).Result;
         return(Ok(price));
     }
     catch (Exception ex)
     {
         return(new JsonResult(new { message = "Price for the movie not found" })
         {
             StatusCode = 500
         });
     }
 }
コード例 #13
0
ファイル: MoviesController.cs プロジェクト: gitpraj/WebJetAPI
 public IActionResult GetMovie(String searchTerm)
 {
     try
     {
         IEnumerable <MovieSummary> movies;
         CinemaWorld  cinemaWorld = new CinemaWorld(Configuration.GetSection("CinemaWorldApi").Value, Configuration.GetSection("CinemaWorldAccessToken").Value);
         FilmWorld    filmWorld   = new FilmWorld(Configuration.GetSection("FilmWorldApi").Value, Configuration.GetSection("FilmWorldAccessToken").Value);
         Intermediary im          = new Intermediary(cinemaWorld, filmWorld);
         movies = im.FindMovies(searchTerm).Result;
         return(Ok(movies));
     }
     catch (Exception ex)
     {
         return(new JsonResult(new { message = "Movie Not Found" })
         {
             StatusCode = 500
         });
     }
 }
コード例 #14
0
        public async Task <Unit> Handle(CreateIntermediaryCommand request, CancellationToken cancellationToken)
        {
            var entity = new Intermediary
            {
                IntermediaryId = request.Id,
                Name           = request.Name,
                Address        = request.Address,
                City           = request.City,
                ContactName    = request.ContactName,
                ContactTitle   = request.ContactTitle,
                Country        = request.Country,
                Fax            = request.Fax,
                Phone          = request.Phone,
                PostalCode     = request.PostalCode
            };

            _context.Intermediaries.Add(entity);

            await _context.SaveChangesAsync(cancellationToken);

            return(Unit.Value);
        }
コード例 #15
0
        /// <summary>
        /// Walks the process manager route.
        /// </summary>
        /// <param name="rule">The name of the rule walking the route.</param>
        /// <param name="scenario">The name of the scenario representing the route.</param>
        /// <param name="activatingIntermediary">The intermediary which starts the route.</param>
        /// <param name="intermediaries">The intermediaries to check if they are in the route.</param>
        /// <param name="channels">The channels to check if they are in the route.</param>
        /// <returns>A list of messaging objects and the channel used to get them in the route.</returns>
        public IList <(MessagingObject RoutingObject, Channel InputChannel)> WalkProcessManagerRoute(string rule, string scenario, Intermediary activatingIntermediary, IEnumerable <Intermediary> intermediaries, IEnumerable <Channel> channels)
        {
            _ = activatingIntermediary ?? throw new ArgumentNullException(nameof(activatingIntermediary));

            _logger.LogDebug(TraceMessages.WalkingOrchestrationRoute, rule, scenario, activatingIntermediary.Name);

            var route = new List <(MessagingObject, Channel)>
            {
                // Add the activating intermediary to the route.
                (activatingIntermediary, null)
            };

            // Walk the rest of the route.
            route.AddRange(WalkProcessManagerRouteRecursively(rule, scenario, intermediaries, channels, activatingIntermediary.OutputChannelKeyRefs));

            return(route);
        }
コード例 #16
0
 public ConstructionSystem(Intermediary Intermediary)
 {
     this._intermediary = Intermediary;
 }
コード例 #17
0
 public static IntermediaryDetailModel Create(Intermediary intermediary)
 {
     return(Projection.Compile().Invoke(intermediary));
 }
コード例 #18
0
 public MotionSystem(Intermediary intermediary)
 {
     this._intermediary = intermediary;
     floorTransform     = GameObject.Find("Floor").transform;
 }
コード例 #19
0
 public CountSystem(Intermediary intermediary)
 {
     this._intermediary = intermediary;
     scoreText          = GameObject.Find("CountText").GetComponent <Text> ();
 }
コード例 #20
0
ファイル: Game.cs プロジェクト: April-wind/Design-Pattern
    void Awake()
    {
        _Intermediary = new Intermediary();

        _Intermediary.Init();
    }
コード例 #21
0
 public TimingSystem(Intermediary mediator)
 {
     this._intermediary = mediator;
     CountDownText      = GameObject.Find("CountDownText").GetComponent <Text> ();
 }