public ActionResult Submit(CalculationParameters calculationParameters)
        {
            if (ModelState.IsValid)
            {
                // Will put code for submitting to queue here.
                string projectName = calculationParameters.ProjectName;
                int iterationCount = calculationParameters.IterationCount;

                InitiateCalculation(calculationParameters);
                //new ProjectCalculator(projectName).InitiateCalculation();

                return RedirectToAction("Waiting", new { id = projectName, iterationCount = iterationCount });
                //return RedirectToAction("Details", new { id = projectName });
                //return View("Details", summary);

            }
            else
            {
                return View(calculationParameters);
            }
        }
 private void InitiateCalculation(CalculationParameters calculationParameters)
 {
     CalculatorDataSource dataSource = new CalculatorDataSource("main");
     dataSource.EnQueue(calculationParameters);
 }
 public ActionResult Submit()
 {
     CalculationParameters parameters = new CalculationParameters {IterationCount = 100};
     return View(parameters);
 }
        private void InitiateCalculation(CalculationParameters calculationParameters)
        {
            if (UseMessageBus)
            {
                // Create the queue if it does not exist already
                const string QueueName = "main";
                string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");
                var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
                if (!namespaceManager.QueueExists(QueueName))
                {
                    namespaceManager.CreateQueue(QueueName);
                }

                // Initialize the connection to Service Bus Queue
                QueueClient queueClient = QueueClient.CreateFromConnectionString(connectionString, QueueName);

                // For each simulation run, queue a message to simulate the project estimation
                BrokeredMessage message = new BrokeredMessage(calculationParameters);
                queueClient.Send(message);
            }
            else
            {
                CalculatorDataSource dataSource = new CalculatorDataSource("main");
                dataSource.EnQueue(calculationParameters);
            }
        }