コード例 #1
0
        public ActionResult Execute()
        {
            IInteroperability myChanel = null;

            try
            {
                _LoggingService.Write("HomeController (Index) page access", true);
                Execution           myExecution = _ExecutionRepository.GetCurrent();
                List <Model.Action> myActions   = myExecution.Script.Action.ToList();
                myChanel = _WcfService.GetClientChanel();
                StringBuilder planeNameConcatenation = new StringBuilder();

                foreach (ExecutionPlane item in myExecution.ExecutionPlane)
                {
                    Plane current = _PlaneRepository.GetById(item.IdPlane);
                    planeNameConcatenation.Append(current.Name + ", ");
                    _FileService.Save(current.Name, current.FileContent);
                    myChanel.Process(_ActionRepository.GetAllAsWrapper(myActions, current.Name));
                    _PlaneRepository.Update(item.IdPlane, _FileService.ReadFromFile(current.Name));
                }

                ExecutionViewModel myModel = new ExecutionViewModel();
                myModel.LastExecutionPlanName = string.Format("{0} - {1}", myExecution.Script.Name, myExecution.Date.ToShortDateString());
                string myText = planeNameConcatenation.ToString();
                myText = myText.Remove(myText.Length - 2, 2);
                myModel.LastExecutionPlanText = string.Format("Script lanzado contra los siguientes planos: {0}", myText);

                return(RedirectToAction("Index", "Home"));
            }
            catch (Exception ex)
            {
                _LoggingService.WriteWithInner(ex, true, "ExecutionController(Execute) error: ");
                return(new HttpNotFoundResult());
            }
        }