private void CommonCityChecker_SelectedIndexChanged(object sender, EventArgs e)
        {
            CityPlatformInfo city = CitySelector.SelectedItem as CityPlatformInfo;

            ApplyForAll(Reservers, reserver => reserver.SelectCity(city));

            OperationSelector.Items.Clear();
            OperationSelector.Items.AddRange((CitySelector.SelectedItem as CityPlatformInfo).Operations);
        }
        public void InitDateChecker(PlatformApiInfo platformInfo, CityPlatformInfo cityInfo, OperationInfo operationInfo, DelayInfo delayInfo)
        {
            PlatformInfo  = platformInfo;
            CityInfo      = cityInfo;
            OperationInfo = operationInfo;
            DelayInfo     = delayInfo;

            ApiClient = new RestClient(CityInfo.AltApiUrl ?? PlatformInfo.ApiUrl);

            Init();
        }
        private void SaveButton_Click(object sender, EventArgs e)
        {
            Order.Surname = SurnameInput.InputText;
            Order.Name    = NameInput.InputText;
            Order.Email   = EmailInput.InputText;

            PlatformApiInfo  selectedPlatform = PlatformSelector.SelectedItem as PlatformApiInfo;
            CityPlatformInfo selectedCity     = CitySelector.SelectedItem as CityPlatformInfo;

            Order.Platform = selectedPlatform.Name;
            Order.City     = selectedCity.Name;
            Order.CityUrl  = selectedCity.BaseUrl;

            Order.Operation = OperationSelector.SelectedItem as OperationInfo;

            this.Close();
        }
        public static T[] CreateFromCityPlatformInfo <T>(
            PlatformApiInfo apiInfo, CityPlatformInfo cityInfo, DelayInfo delayInfo,
            EventHandler <DateCheckerErrorEventArgs> onRequestErrorHandler,
            EventHandler <DateCheckerOkEventArgs> onRequestOkHandler
            ) where T : DateChecker, new()
        {
            T[] checkers = new T[cityInfo.Operations.Length];

            for (int i = 0; i < cityInfo.Operations.Length; ++i)
            {
                checkers[i] = new T();
                checkers[i].InitDateChecker(apiInfo, cityInfo, cityInfo.Operations[i], delayInfo);

                checkers[i].OnRequestError += onRequestErrorHandler;
                checkers[i].OnRequestOK    += onRequestOkHandler;
            }

            return(checkers);
        }
        private ReservationOrder BuildOrder()
        {
            bool surnameInvalid = string.IsNullOrEmpty(SurnameInput.InputText);
            bool nameInvalid    = string.IsNullOrEmpty(NameInput.InputText);
            bool emailInvalid   = string.IsNullOrEmpty(EmailInput.InputText);
            bool typeInvalid    = OperationSelector.SelectedIndex == -1;

            if (surnameInvalid || nameInvalid || emailInvalid || typeInvalid)
            {
                MessageBox.Show("Invalid data");
                return(null);
            }

            PlatformApiInfo  platform  = PlatformSelector.SelectedItem as PlatformApiInfo;
            CityPlatformInfo city      = CitySelector.SelectedItem as CityPlatformInfo;
            OperationInfo    operation = OperationSelector.SelectedItem as OperationInfo;

            ReservationOrder order = new ReservationOrder(
                SurnameInput.InputText, NameInput.InputText, EmailInput.InputText,
                platform.Name, city.Name, city.BaseUrl, operation
                );

            return(order);
        }