Exemplo n.º 1
0
        protected override void Execute(CodeActivityContext context)
        {
            ITracingService      tracing         = context.GetExtension <ITracingService>();
            IWorkflowContext     workflowContext = context.GetExtension <IWorkflowContext>();
            IOrganizationService service         = context.GetExtension <IOrganizationServiceFactory>().CreateOrganizationService(workflowContext.InitiatingUserId);

            FuncLibrary aux = new FuncLibrary();
            find_marketingautomationintegration sendGridAccount = aux.GetMailchimpInfo(service);

            Apihelper.InitializeClient(sendGridAccount.find_SendGridIntegration);
            ApiRoot apiRoot = new ApiRoot();


            List            list            = service.Retrieve(MarketingList.Get(context).LogicalName, MarketingList.Get(context).Id, new ColumnSet("find_sendgridid")).ToEntity <List>();
            Campaign        campaign        = service.Retrieve(Campaign.Get(context).LogicalName, Campaign.Get(context).Id, new ColumnSet("name")).ToEntity <Campaign>();
            EntityReference memberReference = new EntityReference(MemberType.Get(context), new Guid(MemberId.Get(context)));
            find_metric     metric          = GetMetricByCampaign(service, campaign);


            if (HasMetricDetailsToMember(service, metric, memberReference))
            {
                return;
            }

            CreateMetricDetails(service, metric, memberReference);
            SyncMemberTypeToSendGrid(service, memberReference, list, apiRoot, tracing);
        }
Exemplo n.º 2
0
        private void PostActionSendTestEmailsSendGrid(find_marketingautomationintegration mailChimpObj, ApiRoot root, string emails)
        {
            Apihelper.InitializeClient(mailChimpObj.find_SendGridIntegration);
            Emails emailObj = new Emails(emails, mailChimpObj.find_MailAccount);

            Task t = Task.Run(() => root.PostTestsEmailsInSendGrid(emailObj));

            t.Wait();
        }
Exemplo n.º 3
0
        public void Get()
        {
            //ANN animeNews = new ANN();
            //animeNews.Run();

            Apihelper.InitializeClient();
            AnimeProcessor anime = new AnimeProcessor();

            anime.LoadAnime().Wait();
        }
Exemplo n.º 4
0
        private void PostActionSendTestEmailsMailchimp(Campaign campaign, find_marketingautomationintegration mailChimpObj, ApiRoot root, string emails, ITracingService tracing)
        {
            Apihelper.InitializeClient(mailChimpObj.find_MailChimpIntegration);
            string[] server = mailChimpObj.find_MailChimpIntegration.Split('-');

            List <string> listEmalis = emails.Split(',').ToList();
            TestEmails    testEmails = new TestEmails(listEmalis);

            Task t = Task.Run(() => root.PostTestsEmails(testEmails, server[1], campaign.find_mailChimpCampaignID));

            t.Wait();
        }
Exemplo n.º 5
0
        private void PostReplicateCampaignInSendGrid(IOrganizationService service, ApiRoot root, find_marketingautomationintegration mailChimpAccount, Campaign campaign, Campaign newCampaign)
        {
            Apihelper.InitializeClient(mailChimpAccount.find_SendGridIntegration);

            Task <MailChimpCampaign> t = Task.Run(() => root.PostCopySingleSend(campaign.find_SendGridId));

            t.Wait();
            if (t.IsCompleted)
            {
                newCampaign.find_SendGridId = t.Result.Id;
                service.Update(newCampaign);
            }
        }
Exemplo n.º 6
0
        private void PostReplicateCampaignInMailchimp(IOrganizationService service, ApiRoot root, find_marketingautomationintegration mailChimpAccount, Campaign campaign, Campaign newCampaign)
        {
            Apihelper.InitializeClient(mailChimpAccount.find_MailChimpIntegration);
            string[] server = mailChimpAccount.find_MailChimpIntegration.Split('-');

            Task <MailChimpCampaign> t = Task.Run(() => root.PostCopyCampaign(server[1], campaign.find_mailChimpCampaignID));

            t.Wait();
            if (t.IsCompleted)
            {
                newCampaign.find_mailChimpCampaignID = t.Result.Id;
                service.Update(newCampaign);
            }
        }
Exemplo n.º 7
0
        private bool PostActionSendMail(Campaign campaign, find_marketingautomationintegration mailChimpObj, ApiRoot root)
        {
            Apihelper.InitializeClient(mailChimpObj.find_MailChimpIntegration);
            string[] server = mailChimpObj.find_MailChimpIntegration.Split('-');

            Task <bool> t = Task.Run(() => root.PostSendEmail(server[1], campaign.find_mailChimpCampaignID));

            t.Wait();
            if (t.IsCompleted)
            {
                return(t.Result);
            }
            else
            {
                throw new Exception();
            }
        }
Exemplo n.º 8
0
        protected override void Execute(CodeActivityContext context)
        {
            ITracingService      tracing         = context.GetExtension <ITracingService>();
            IWorkflowContext     workflowContext = context.GetExtension <IWorkflowContext>();
            IOrganizationService service         = context.GetExtension <IOrganizationServiceFactory>().CreateOrganizationService(workflowContext.InitiatingUserId);

            FuncLibrary aux = new FuncLibrary();
            find_marketingautomationintegration accountObj = aux.GetMailchimpInfo(service);

            Apihelper.InitializeClient(accountObj.find_SendGridIntegration);
            ApiRoot root = new ApiRoot();

            Campaign    campaign = service.Retrieve(Campaign.Get(context).LogicalName, Campaign.Get(context).Id, new ColumnSet("name", "find_sendgridid")).ToEntity <Campaign>();
            find_metric metric   = GetMetricByCampaign(service, campaign);

            UpdateMetric(service, root, campaign, metric, tracing);
        }
Exemplo n.º 9
0
        private bool PutScheduleNow(Campaign campaign, find_marketingautomationintegration mailChimpObj, ApiRoot root)
        {
            Apihelper.InitializeClient(mailChimpObj.find_SendGridIntegration);
            SingleSend singleSend = new SingleSend("now");

            Task <bool> t = Task.Run(() => root.PutSchedule(singleSend, campaign.find_SendGridId));

            t.Wait();
            if (t.IsCompleted)
            {
                return(t.Result);
            }
            else
            {
                throw new Exception();
            }
        }
Exemplo n.º 10
0
        private void PutScheduleNow(IOrganizationService service, Campaign campaign, find_marketingautomationintegration mailChimpObj, ApiRoot root)
        {
            Apihelper.InitializeClient(mailChimpObj.find_SendGridIntegration);

            Task <bool> t = Task.Run(() => root.DeleteScheduleCampaign(campaign.find_SendGridId));

            t.Wait();
            if (t.IsCompleted && t.Result)
            {
                campaign.find_mail_integration_started = false;
                campaign.find_Schedule = null;
                service.Update(campaign);
            }
            else
            {
                throw new Exception();
            }
        }
Exemplo n.º 11
0
        private void ProcessSendGridLists(IOrganizationService service, CrmEarlyBound.Campaign campaign, find_marketingautomationintegration mailChimpAccount, ApiRoot root, List <List> listsToUpdate)
        {
            Apihelper.InitializeClient(mailChimpAccount.find_SendGridIntegration);

            if (campaign.find_SendGridId == null)
            {
                CreateSingleSend(service, campaign, root);
            }

            foreach (List list in listsToUpdate)
            {
                if (list.find_SendGridId == null)
                {
                    CreateListSendGrid(service, list, root);
                }
            }

            AssociateMarketingListToSendGrid(root, listsToUpdate, campaign);
        }
Exemplo n.º 12
0
        private void PutScheduleNow(IOrganizationService service, Campaign campaign, find_marketingautomationintegration mailChimpObj, ApiRoot root, string dateTime)
        {
            Apihelper.InitializeClient(mailChimpObj.find_SendGridIntegration);
            SingleSend singleSend = new SingleSend(dateTime);

            Task <bool> t = Task.Run(() => root.PutSchedule(singleSend, campaign.find_SendGridId));

            t.Wait();
            if (t.IsCompleted && t.Result)
            {
                campaign.find_mail_integration_started = true;
                campaign.find_Schedule = DateTime.Parse(dateTime);
                service.Update(campaign);
            }
            else
            {
                throw new Exception();
            }
        }
Exemplo n.º 13
0
        private void PostActionCancelScheduleMail(IOrganizationService service, Campaign campaign, find_marketingautomationintegration mailChimpObj, ApiRoot root)
        {
            Apihelper.InitializeClient(mailChimpObj.find_MailChimpIntegration);
            string[] server = mailChimpObj.find_MailChimpIntegration.Split('-');

            Task <bool> t = Task.Run(() => root.PostCancelScheduleCampaign(server[1], campaign.find_mailChimpCampaignID));

            t.Wait();
            if (t.IsCompleted && t.Result)
            {
                campaign.find_mail_integration_started = false;
                campaign.find_Schedule = null;
                service.Update(campaign);
            }
            else
            {
                throw new Exception();
            }
        }
Exemplo n.º 14
0
        protected override void Execute(CodeActivityContext context)
        {
            ITracingService      tracing         = context.GetExtension <ITracingService>();
            IWorkflowContext     workflowContext = context.GetExtension <IWorkflowContext>();
            IOrganizationService service         = context.GetExtension <IOrganizationServiceFactory>().CreateOrganizationService(workflowContext.InitiatingUserId);

            FuncLibrary aux = new FuncLibrary();
            find_marketingautomationintegration mailChimpObj = aux.GetMailchimpInfo(service);

            Apihelper.InitializeClient(mailChimpObj.find_MailChimpIntegration);
            ApiRoot root = new ApiRoot();

            string[] server = mailChimpObj.find_MailChimpIntegration.Split('-');

            Campaign    campaign = service.Retrieve(Campaign.Get(context).LogicalName, Campaign.Get(context).Id, new ColumnSet("name", "find_mailchimpcampaignid")).ToEntity <Campaign>();
            find_metric metric   = GetMetricByCampaign(service, campaign);
            List <find_metricdetails> metricDetailsList = GetMetricDetailsByMetric(service, metric);

            ProcessAtivitiesByMember(service, metricDetailsList, aux, root, server[1], campaign, metric, tracing);
        }
Exemplo n.º 15
0
        private void ProcessMailChimpListsAndCampaign(IOrganizationService service, CrmEarlyBound.Campaign campaign, find_marketingautomationintegration mailChimpAccount, ApiRoot root, List <List> listsToUpdate)
        {
            Apihelper.InitializeClient(mailChimpAccount.find_MailChimpIntegration);
            string[] server = mailChimpAccount.find_MailChimpIntegration.Split('-');

            if (campaign.find_mailChimpCampaignID == null)
            {
                PostCampaignToMailchimp(service, server[1], mailChimpAccount, root, campaign);
            }

            foreach (List list in listsToUpdate)
            {
                if (list.find_MailChimpListId == null)
                {
                    CreateAsyncInterest(service, server[1], root, mailChimpAccount, list);
                }
            }

            AssociateMarkeitngListToMailchimpCampaign(root, listsToUpdate, server[1], campaign);
        }
        static async Task Main(string[] args)
        {
            List <Review> reviews = new List <Review>();

            Apihelper.InitializeClient();
            Processor processor = new Processor();
            await processor.getReviews();

            int averageRating = 0;

            foreach (var item in processor.ReviewList)
            {
                averageRating = averageRating + item.Rating;
                Console.WriteLine($"--------------------------");
                Console.WriteLine($"Review rating {item.Rating}");
                Console.WriteLine($"Review description {item.Description}");
                Console.WriteLine($"The person who reviewed has the age {item.Age} and gender {item.Gender}");
                Console.WriteLine($"--------------------------");
                Thread.Sleep(500);
            }
            Console.WriteLine($"Average rating is {averageRating / processor.ReviewList.Count}");
            Console.ReadLine();
        }
        private static string logPath = "C:/Users/Bruger/Documents/GitHub/Mini-Project-3-microservices/Log.txt";   // Jonas


        static async Task Main(string[] args)
        {
            //             [MicroService used]                       //
            Apihelper.InitializeClient();
            Microservices.CarService.Processor processor = new Microservices.CarService.Processor();
            await processor.getBookings();


            //EIP "Channel" created on localhost with help of MqRabbit ref..
            var factory = new ConnectionFactory()
            {
                HostName = "localhost"
            };

            using (var connection = factory.CreateConnection())
                using (var channel = connection.CreateModel())
                {
                    //Declaring of the que to send messages to.
                    channel.QueueDeclare(queue: "rpc_queue", durable: false,
                                         exclusive: false, autoDelete: false, arguments: null);
                    channel.BasicQos(0, 1, false);
                    var consumer = new EventingBasicConsumer(channel);
                    channel.BasicConsume(queue: "rpc_queue",
                                         autoAck: false, consumer: consumer);
                    Console.WriteLine(" [x] Awaiting RPC requests");

                    //Variable used within the Received protocol.
                    int           caseSwitch           = 1;
                    int           caseSwitchChoice     = 1;
                    List <Car>    availableCars        = new List <Car>();
                    List <string> colorsFound          = new List <string>();
                    List <Car>    availableCarsByColor = new List <Car>();
                    List <Car>    chooseCarList        = new List <Car>();
                    Car           selectedCar          = null;
                    bool          found = false;


                    Microservices.ReviewService.Processor reviewProcessor = new Microservices.ReviewService.Processor();

                    //Message recevied
                    consumer.Received += async(model, ea) =>
                    {
                        string response   = null;
                        var    body       = ea.Body;
                        var    props      = ea.BasicProperties;
                        var    replyProps = channel.CreateBasicProperties();
                        replyProps.CorrelationId = props.CorrelationId;

                        var message = Encoding.UTF8.GetString(body).ToString();
                        //Console.WriteLine(" [.] Message send from client", message);
                        string[] opdelt     = message.Split(' ');
                        var      identifyer = opdelt[0];

                        File.AppendAllText(logPath, TimeStampForLog(" ", message));
                        //write message down into a TXT log file (not made yet)

                        //Choice 1 - Review
                        if (identifyer == "R")
                        {
                            switch (caseSwitchChoice)
                            {
                            case 1:
                                File.AppendAllText(logPath, Setuplog("----------------------------Flow start----------------------------"));
                                Review review   = new Review();
                                string section1 = "Feedback section";
                                Console.WriteLine(section1);
                                File.AppendAllText(logPath, TimeStampForLog(section1, message));

                                var responseBytes = Encoding.UTF8.GetBytes("R");
                                channel.BasicPublish(exchange: "", routingKey: props.ReplyTo,
                                                     basicProperties: replyProps, body: responseBytes);
                                channel.BasicAck(deliveryTag: ea.DeliveryTag,
                                                 multiple: false);

                                caseSwitchChoice += 1;
                                break;

                            case 2:
                                string section2 = "Choice case 1 - rating";
                                Console.WriteLine(section2);
                                File.AppendAllText(logPath, TimeStampForLog(section2, message));
                                string realMessageRating = message.Remove(0, 1);
                                reviewProcessor.Review.Rating = Convert.ToInt32(realMessageRating);

                                response = "rating ok";
                                File.AppendAllText(logPath, TimeStampForLog(response, message));

                                var responseRating = Encoding.UTF8.GetBytes(response);

                                channel.BasicPublish(exchange: "", routingKey: props.ReplyTo,
                                                     basicProperties: replyProps, body: responseRating);
                                channel.BasicAck(deliveryTag: ea.DeliveryTag,
                                                 multiple: false);

                                caseSwitchChoice += 1;
                                break;

                            case 3:
                                string section3 = "Choice case 2 - Location";
                                Console.WriteLine(section3);
                                File.AppendAllText(logPath, TimeStampForLog(section3, message));
                                string realMessageLocation = message.Remove(0, 1);
                                reviewProcessor.Review.Location = realMessageLocation;

                                response = "Location registered";
                                File.AppendAllText(logPath, TimeStampForLog(response, message));

                                var responseLocation = Encoding.UTF8.GetBytes(response);
                                channel.BasicPublish(exchange: "", routingKey: props.ReplyTo,
                                                     basicProperties: replyProps, body: responseLocation);
                                channel.BasicAck(deliveryTag: ea.DeliveryTag,
                                                 multiple: false);

                                caseSwitchChoice += 1;
                                break;

                            case 4:
                                string section4 = "Choice case 3 - description";
                                Console.WriteLine(section4);
                                File.AppendAllText(logPath, TimeStampForLog(section4, message));
                                string realMessagedescription = message.Remove(0, 1);
                                reviewProcessor.Review.Description = realMessagedescription;

                                response = "description registered ok";
                                File.AppendAllText(logPath, TimeStampForLog(response, message));

                                var respondescription = Encoding.UTF8.GetBytes(response);
                                channel.BasicPublish(exchange: "", routingKey: props.ReplyTo,
                                                     basicProperties: replyProps, body: respondescription);
                                channel.BasicAck(deliveryTag: ea.DeliveryTag,
                                                 multiple: false);
                                caseSwitchChoice += 1;
                                break;

                            case 5:
                                string section5 = "Choice case 4 - gender";
                                Console.WriteLine(section5);
                                File.AppendAllText(logPath, TimeStampForLog(section5, message));
                                string realMessageGender = message.Remove(0, 1);
                                reviewProcessor.Review.Gender = realMessageGender;

                                response = "gender registered ok";
                                File.AppendAllText(logPath, TimeStampForLog(response, message));

                                var responseMale = Encoding.UTF8.GetBytes(response);
                                channel.BasicPublish(exchange: "", routingKey: props.ReplyTo,
                                                     basicProperties: replyProps, body: responseMale);
                                channel.BasicAck(deliveryTag: ea.DeliveryTag,
                                                 multiple: false);
                                caseSwitchChoice += 1;
                                break;

                            case 6:
                                string section6 = "Choice case 5 - age";
                                Console.WriteLine(section6);
                                File.AppendAllText(logPath, TimeStampForLog(section6, message));
                                string realMessageAge = message.Remove(0, 1);
                                reviewProcessor.Review.Age = Convert.ToInt32(realMessageAge);

                                response = "Age registered ok";
                                File.AppendAllText(logPath, TimeStampForLog(response, message));

                                var responseAge = Encoding.UTF8.GetBytes(response);
                                channel.BasicPublish(exchange: "", routingKey: props.ReplyTo,
                                                     basicProperties: replyProps, body: responseAge);
                                channel.BasicAck(deliveryTag: ea.DeliveryTag,
                                                 multiple: false);

                                await reviewProcessor.PostReview();

                                //reset the server variable controlling the flow, so it can start over.
                                caseSwitch       = 1;
                                caseSwitchChoice = 1;
                                selectedCar      = null;
                                found            = false;
                                identifyer       = " ";
                                File.AppendAllText(logPath, Setuplog("----------------------------Flow end----------------------------"));
                                break;

                            default:
                                string defaultCaseString = "Default case";
                                Console.WriteLine(defaultCaseString);
                                File.AppendAllText(logPath, TimeStampForLog(defaultCaseString, message));
                                break;
                            }
                        }
                        else
                        {
                            //Choice 2 - create booking
                            switch (caseSwitch)
                            {
                            case 1:
                                File.AppendAllText(logPath, Setuplog("----------------------------Flow start----------------------------"));
                                string section2_1 = "Case 0 - flow chosen";
                                Console.WriteLine(section2_1);
                                File.AppendAllText(logPath, TimeStampForLog(section2_1, message));
                                response = "2";
                                var responseBytesChoice = Encoding.UTF8.GetBytes(response);

                                //Send a response back ---------------
                                channel.BasicPublish(exchange: "", routingKey: props.ReplyTo,
                                                     basicProperties: replyProps, body: responseBytesChoice);
                                channel.BasicAck(deliveryTag: ea.DeliveryTag,
                                                 multiple: false);

                                caseSwitch += 1;
                                break;

                            //Check avaliablityart
                            case 2:
                                File.AppendAllText(logPath, TimeStampForLog("Feedback section = 2", message));
                                Console.WriteLine("Case 1 - Check avaliablity");
                                message1 = message;
                                string statusTest1 = "Case 1 - Check avaliablity";
                                File.AppendAllText(logPath, TimeStampForLog(statusTest1, message));

                                //EIP - Splitter  ---------------------------------------
                                //Splitting the data so we can use it to search the list in DataStorage for availablity
                                String[] messageArray = message.Split(' ');
                                string   carType      = messageArray[0];
                                string   date         = messageArray[1];
                                //EIP - Splitter ---------------------------------------


                                foreach (var car in processor.CarList)
                                {
                                    if (car.Type == carType && car.Date == date)
                                    {
                                        found = true;
                                        availableCars.Add(car);
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }
                                if (found == true)
                                {
                                    response = "bil blev fundet";
                                    Console.WriteLine("bil blev fundet");
                                    File.AppendAllText(logPath, TimeStampForLog(statusTest1, response));

                                    //EIP - Request & Reply ------------------------------------
                                    //New message created -----------------
                                    var responseBytes = Encoding.UTF8.GetBytes(response);
                                    //New message created -----------------

                                    //Send a response back ---------------
                                    channel.BasicPublish(exchange: "", routingKey: props.ReplyTo,
                                                         basicProperties: replyProps, body: responseBytes);
                                    channel.BasicAck(deliveryTag: ea.DeliveryTag,
                                                     multiple: false);
                                    //Send a response back ---------------
                                    //EIP - Request & Reply ------------------------------------

                                    caseSwitch += 1;
                                }
                                else
                                {
                                    response = "bil blev ikke fundet";
                                    Console.WriteLine("bil blev ikke fundet");
                                    File.AppendAllText(logPath, TimeStampForLog(statusTest1, response));

                                    var responseBytes = Encoding.UTF8.GetBytes(response);
                                    channel.BasicPublish(exchange: "", routingKey: props.ReplyTo,
                                                         basicProperties: replyProps, body: responseBytes);
                                    channel.BasicAck(deliveryTag: ea.DeliveryTag,
                                                     multiple: false);
                                }
                                break;

                            //Choose color
                            case 3:
                                string section2_3 = "case 2 - choose color";
                                Console.WriteLine(section2_3);
                                message2 = message;
                                File.AppendAllText(logPath, TimeStampForLog(section2_3, message));

                                foreach (var car in availableCars)
                                {
                                    if (colorsFound.Contains(car.Color))
                                    {
                                        continue;
                                    }
                                    else
                                    {
                                        colorsFound.Add(car.Color);
                                    }
                                }

                                foreach (var color in colorsFound)
                                {
                                    response = response + " " + color;
                                }
                                if (response == string.Empty)
                                {
                                    response = "Color not found, please try with another one or check spelling";
                                    File.AppendAllText(logPath, TimeStampForLog(section2_3, response));
                                }
                                else
                                {
                                    File.AppendAllText(logPath, TimeStampForLog(section2_3, response));
                                    var responseBytesCase2 = Encoding.UTF8.GetBytes(response);
                                    channel.BasicPublish(exchange: "", routingKey: props.ReplyTo,
                                                         basicProperties: replyProps, body: responseBytesCase2);
                                    channel.BasicAck(deliveryTag: ea.DeliveryTag,
                                                     multiple: false);
                                    caseSwitch += 1;
                                }
                                break;

                            case 4:
                                string section2_4 = "case 3 - choose car";
                                Console.WriteLine(section2_4);
                                File.AppendAllText(logPath, TimeStampForLog(section2_4, message));
                                if (message == string.Empty)
                                {
                                    response = "Please type a color to preceed";
                                    File.AppendAllText(logPath, TimeStampForLog(section2_4, response));
                                }
                                else if (colorsFound.Contains(message) == false)
                                {
                                    response = "Spelling ERORR, please try agian";
                                    File.AppendAllText(logPath, TimeStampForLog(section2_4, response));
                                }
                                else
                                {
                                    foreach (var car in availableCars)
                                    {
                                        if (car.Color == message)
                                        {
                                            availableCarsByColor.Add(car);
                                        }
                                    }
                                    foreach (var car in availableCarsByColor)
                                    {
                                        response = response + car.ToString() + "-";

                                        chooseCarList.Add(car);
                                    }

                                    File.AppendAllText(logPath, TimeStampForLog(section2_4, response));
                                    caseSwitch += 1;
                                }

                                var responseBytesCase3 = Encoding.UTF8.GetBytes(response);
                                channel.BasicPublish(exchange: "", routingKey: props.ReplyTo,
                                                     basicProperties: replyProps, body: responseBytesCase3);
                                channel.BasicAck(deliveryTag: ea.DeliveryTag,
                                                 multiple: false);

                                break;

                            case 5:
                                string section2_5 = "case 4 - selecet car";
                                Console.WriteLine(section2_5);
                                File.AppendAllText(logPath, TimeStampForLog(section2_5, message));
                                int index = Convert.ToInt32(message) - 1;
                                if (index < 0 || availableCarsByColor.Count < index + 1)
                                {
                                    response = "The number is not valid, try with a differnt one";
                                    File.AppendAllText(logPath, TimeStampForLog(section2_5, response));
                                }
                                else
                                {
                                    selectedCar = chooseCarList[index];
                                    response    = "selected CAR: " + selectedCar.ToString();
                                    File.AppendAllText(logPath, TimeStampForLog(section2_5, response));
                                    caseSwitch += 1;
                                }

                                File.AppendAllText(logPath, TimeStampForLog(section2_5, message));
                                var responseBytesCase4 = Encoding.UTF8.GetBytes(response);
                                channel.BasicPublish(exchange: "", routingKey: props.ReplyTo,
                                                     basicProperties: replyProps, body: responseBytesCase4);
                                channel.BasicAck(deliveryTag: ea.DeliveryTag,
                                                 multiple: false);
                                break;

                            case 6:
                                string section2_6 = "case 5 - create booking";
                                Console.WriteLine(section2_6);
                                File.AppendAllText(logPath, TimeStampForLog(section2_6, message));

                                message3 = message;
                                string[] nameAndLicense = message.Split(' ');
                                string   name           = nameAndLicense[0];
                                string   license        = nameAndLicense[1];
                                Driver   driver         = new Driver(name, license);
                                Booking  booking        = new Booking(driver, selectedCar, DateTime.Now);


                                //EIP - Aggregator  ------------------------------------------
                                if (message1 != string.Empty && message2 != string.Empty && message3 != string.Empty)
                                {
                                    response = message1 + message2 + message3;
                                    File.AppendAllText(logPath, TimeStampForLog(section2_6, response));
                                }
                                //EIP - Aggregator  ------------------------------------------

                                //Saves informations in a TXT file (illustrate database)
                                File.AppendAllText(@"C:/Users/Bruger/Documents/GitHub/Mini-Project-3-microservices/CompletedRentals.txt", CompletePost(response));  //Jonas
                                //File.AppendAllText(@"C:/Users/Jonas/source/repos/Mini-Project-3-microservices/CompletedRentals.txt", CompletePost(response));  //Jonas mac
                                //File.AppendAllText(@"C:/Users/Bruger/source/repos/Mini-Project-3-microservices/CompletedRentals.txt", CompletePost(response)); //Christoffer
                                Console.WriteLine("Booking has been created");
                                File.AppendAllText(logPath, TimeStampForLog("section2_6", "Booking has been created"));

                                var responseBytesCase5 = Encoding.UTF8.GetBytes(response);
                                channel.BasicPublish(exchange: "", routingKey: props.ReplyTo,
                                                     basicProperties: replyProps, body: responseBytesCase5);
                                channel.BasicAck(deliveryTag: ea.DeliveryTag,
                                                 multiple: false);

                                File.AppendAllText(logPath, Setuplog("----------------------------Flow end----------------------------"));
                                //reset the server variable controlling the flow, so it can start over.
                                caseSwitch       = 1;
                                caseSwitchChoice = 1;
                                selectedCar      = null;
                                found            = false;
                                identifyer       = " ";

                                break;

                            default:
                                string defaultCaseString = "Default case";
                                Console.WriteLine(defaultCaseString);
                                File.AppendAllText(logPath, TimeStampForLog(defaultCaseString, message));
                                break;
                            }
                        }
                    };
                    Console.WriteLine(" Press [enter] to exit.");
                    Console.ReadLine();
                }
        }