Beispiel #1
0
        public async Task <HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Function, "delete", Route = "broadcaster")] HttpRequest req,
            ILogger log)
        {
            TelemetryClient.TrackEvent("Stop");

            using (LoggerService.Init(log))
            {
                ConfigurationModel config = ConfigurationService.GetConfiguration();

                try
                {
                    AzureMediaServicesClient client = await AuthenticationService.GetClientAsync(config);

                    InputRequestService inputRequestService = new InputRequestService(client, config);
                    StopController      stopController      = new StopController(client, config);

                    InputRequestModel inputModel = await inputRequestService.GetInputRequestModelAsync(req);

                    StatusChangeOutputModel outputModel = await stopController.StopServicesAsync(inputModel);

                    await WebhookService.CallWebhookAsync(config.WebhookStartSuccess, ActionEnum.Stop, outputModel.Status.Summary.Name);

                    return(SuccessResponseService.CreateResponse(outputModel));
                }
                catch (AppException e)
                {
                    return(await ReportErrorAsync(config, e));
                }
                catch (Exception e)
                {
                    return(await ReportErrorAsync(config, e));
                }
            }
        }
Beispiel #2
0
            public Arrangement(ICSVStopRepository csvStopRepository, IPlacesRepository placesRepository, IMapper mapper)
            {
                Mapper            = mapper;
                PlacesRepository  = placesRepository;
                CSVStopRepository = csvStopRepository;

                SUT = new StopController(csvStopRepository, placesRepository, mapper);
            }
Beispiel #3
0
        public void Read()
        {
            List <Stop> stops = new StopController(connectionString).Read("");

            foreach (var s in stops)
            {
                Console.WriteLine($"stop_id:\t {s.stop_id}");
                Console.WriteLine($"name:\t {s.name}");
                Console.WriteLine($"average_volume:\t {s.average_volume}");
                Console.WriteLine();
            }
        }
Beispiel #4
0
 protected override void OnStop()
 {
     //Log.WriteEntry("CryptoScanner Stopped");
     StopController.Invoke(this, new EventArgs());
 }
        public static void Render(string connectionString)
        {
            int table  = 0;
            int action = 0;

            do
            {
                table = FirstMenu();
                if (table == 0)
                {
                    return;
                }

                IView          view       = null;
                BaseController controller = null;

                switch (table)
                {
                case 1:
                    action     = SecondMenu("Garage");
                    view       = new GarageView(connectionString);
                    controller = new GarageController(connectionString);
                    break;

                case 2:
                    action     = SecondMenu("Route");
                    view       = new RouteView(connectionString);
                    controller = new RouteController(connectionString);
                    break;

                case 3:
                    action     = SecondMenu("Stop");
                    view       = new StopView(connectionString);
                    controller = new StopController(connectionString);
                    break;

                case 4:
                    action     = SecondMenu("Transport");
                    view       = new TransportView(connectionString);
                    controller = new TransportController(connectionString);
                    break;

                case 5:
                    action     = SecondMenu("Type");
                    view       = new TypeView(connectionString);
                    controller = new TypeController(connectionString);
                    break;

                default:
                    Console.WriteLine("Wrong input!");
                    break;
                }


                switch (action)
                {
                case 1:
                    view.Create();
                    break;

                case 2:
                    view.Read();
                    break;

                case 3:
                    view.Update();
                    break;

                case 4:
                    view.Delete();
                    break;

                case 5:
                    view.Find();
                    break;

                case 6:
                    view.Generate();
                    break;

                default:
                    Console.WriteLine("Wrong input!");
                    break;
                }
            } while (true);
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            string connectionString = "Host=localhost;Username=postgres;Password=p;Database=CityTransport";

            int table  = 0;
            int action = 0;

            do
            {
                table = FirstMenu();
                if (table == 0)
                {
                    return;
                }

                BaseController controller = null;

                switch (table)
                {
                case 1:
                    action     = SecondMenu("Garage");
                    controller = new GarageController(connectionString);
                    break;

                case 2:
                    action     = SecondMenu("Route");
                    controller = new RouteController(connectionString);
                    break;

                case 3:
                    action     = SecondMenu("Stop");
                    controller = new StopController(connectionString);
                    break;

                case 4:
                    action     = SecondMenu("Transport");
                    controller = new TransportController(connectionString);
                    break;

                case 5:
                    action     = SecondMenu("Type");
                    controller = new TypeController(connectionString);
                    break;
                }


                switch (action)
                {
                case 1:
                    controller.Create();
                    break;

                case 2:
                    controller.Read();
                    break;

                case 3:
                    controller.Update();
                    break;

                case 4:
                    controller.Delete();
                    break;

                case 5:
                    controller.Find();
                    break;

                case 6:
                    controller.Generate();
                    break;
                }
            } while (true);
        }
Beispiel #7
0
 void Start()
 {
     controller = (StopController)FindObjectOfType(typeof(StopController));
 }