コード例 #1
0
        static async Task callTopicAsync()
        {
            string topicEndpoint = "https://turnaroundeventgridtopic.eastus-1.eventgrid.azure.net/api/events";
            string sasKey        = "v6xbKQuwLMjh7fus4KJ+4plVXDEQJlkuFswZAlzEdjM=";

            Console.WriteLine("================================================");
            Console.WriteLine("Press any key to exit after sending the message.");
            Console.WriteLine("================================================");

            HttpClient client = new HttpClient();

            client.DefaultRequestHeaders.Add("aeg-sas-key", sasKey);
            client.DefaultRequestHeaders.UserAgent.ParseAdd("democlient");

            List <GridEvent <TurnAround> > eventList = new List <GridEvent <TurnAround> >();
            Random           rnd = new Random();
            TurnAroundEvents events;

            events = TurnAroundEvents.Sixty_Days_Notice;
            for (int x = 0; x < 1; x++)
            {
                var        propertyId = (x + 2) * rnd.Next(300, 500);
                TurnAround tr         = new TurnAround();
                tr.Event      = events;
                tr.PropertyID = $"{propertyId}";
                tr.Date1      = DateTime.Now;
                Console.WriteLine($"Property ID : {propertyId}.");

                GridEvent <TurnAround> testEvent = new GridEvent <TurnAround>
                {
                    Subject   = $"{events.ToString()}",
                    EventType = (x % 2 == 0) ? "allEvents" : "filteredEvent",
                    EventTime = DateTime.UtcNow,
                    Data      = tr,
                    Id        = Guid.NewGuid().ToString(),
                    Topic     = string.Empty//"EventGridDoc-Topic"
                };
                eventList.Add(testEvent);
            }

            string             json    = JsonConvert.SerializeObject(eventList);
            HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, topicEndpoint)
            {
                Content = new StringContent(json, Encoding.UTF8, "application/json")
            };

            HttpResponseMessage response = await client.SendAsync(request);

            Console.WriteLine("================================================");
            Console.WriteLine("Message successfully sent.");
            Console.WriteLine("================================================");
        }
コード例 #2
0
        static GridEvent <TurnAround> BudgetStarted()
        {
            GridEvent <TurnAround> budgetStarted = new GridEvent <TurnAround>();

            budgetStarted.EventTime = DateTime.Now;
            budgetStarted.EventType = "allEvents";
            budgetStarted.Id        = Guid.NewGuid().ToString();
            budgetStarted.Topic     = string.Empty;

            budgetStarted.Data            = new TurnAround();
            budgetStarted.Data.Event      = TurnAroundEvents.Renowalk_Budget_Started;
            budgetStarted.Data.PropertyID = "1234";
            budgetStarted.Data.Date1      = new DateTime(2018, 10, 20); //Budget Start Date.
            budgetStarted.Data.IsForce    = false;                      //To Perform Force Update in CRM. True = Perform Force Update.

            return(budgetStarted);
        }
コード例 #3
0
        static GridEvent <TurnAround> SixtyDayNotification()
        {
            GridEvent <TurnAround> sixtyDayNotification = new GridEvent <TurnAround>();

            sixtyDayNotification.EventTime = DateTime.Now;
            sixtyDayNotification.EventType = "allEvents";
            sixtyDayNotification.Id        = Guid.NewGuid().ToString();
            sixtyDayNotification.Topic     = string.Empty;

            sixtyDayNotification.Data            = new TurnAround();
            sixtyDayNotification.Data.Event      = TurnAroundEvents.Sixty_Days_Notice;
            sixtyDayNotification.Data.PropertyID = "1234";
            sixtyDayNotification.Data.Date1      = new DateTime(2018, 10, 20); //Notification Date.
            sixtyDayNotification.Data.IsForce    = false;                      //To Perform Force Update in CRM. True = Perform Force Update.

            return(sixtyDayNotification);
        }
コード例 #4
0
        static GridEvent <TurnAround> FotoNotes_MoveOut_Inspection_Completed()
        {
            GridEvent <TurnAround> FotoNotes_MoveOut_Insp_Complete = new GridEvent <TurnAround>();

            FotoNotes_MoveOut_Insp_Complete.EventTime = DateTime.Now;
            FotoNotes_MoveOut_Insp_Complete.EventType = "allEvents";
            FotoNotes_MoveOut_Insp_Complete.Id        = Guid.NewGuid().ToString();
            FotoNotes_MoveOut_Insp_Complete.Topic     = string.Empty;

            FotoNotes_MoveOut_Insp_Complete.Data            = new TurnAround();
            FotoNotes_MoveOut_Insp_Complete.Data.Event      = TurnAroundEvents.FotoNotes_Move_Out_Insp_Complete;
            FotoNotes_MoveOut_Insp_Complete.Data.PropertyID = "1234";
            FotoNotes_MoveOut_Insp_Complete.Data.Date1      = new DateTime(2018, 10, 20); //Inspection Start Date.
            FotoNotes_MoveOut_Insp_Complete.Data.Date2      = new DateTime(2018, 10, 31); //Inspection Completion Date
            FotoNotes_MoveOut_Insp_Complete.Data.IsForce    = false;                      //To Perform Force Update in CRM. True = Perform Force Update.

            return(FotoNotes_MoveOut_Insp_Complete);
        }