Beispiel #1
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.activity_add_car);
     InitalizeViews();
     presenter = new AddCarPresenter(this);
 }
        private void AddCarButton_Click(object sender, EventArgs e)
        {
            AddCarPresenter presenter = new AddCarPresenter(this);

            presenter.ValidateCar();

            if (Valid.Keys.Contains(false))
            {
                string            errorMsg = Valid[false];
                string            caption  = "Nieprawidłowe dane";
                MessageBoxButtons buttons  = MessageBoxButtons.OK;
                MessageBox.Show(errorMsg, caption, buttons);
            }
            else if (Valid.Keys.Contains(true) && string.IsNullOrWhiteSpace(Valid[true]))
            {
                presenter.AddNewCar();

                if (Added)
                {
                    string            infoMsg      = "Samochód został pomyślnie dodany do bazy.";
                    string            caption      = "Dodano";
                    MessageBoxButtons buttons      = MessageBoxButtons.OK;
                    DialogResult      dialogResult = MessageBox.Show(infoMsg, caption, buttons);

                    if (dialogResult == DialogResult.OK)
                    {
                        this.Close();
                    }
                }
            }
        }
Beispiel #3
0
        private void FillComboBoxes()
        {
            AddCarPresenter presenter = new AddCarPresenter(this);
            Dictionary <string, string[]> comboBoxesValues = presenter.FillComboboxes();

            this.categoryComboBox.Items.AddRange(comboBoxesValues["category"]);
            this.driveTypeComboBox.Items.AddRange(comboBoxesValues["driveType"]);
            this.engineComboBox.Items.AddRange(comboBoxesValues["engine"]);
            this.gearboxComboBox.Items.AddRange(comboBoxesValues["gearbox"]);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.fragment_addcar, null);

            presenter = new AddCarPresenter()
            {
                View = this
            };
            ViewInjector.Inject(this, view);
            return(view);
        }
Beispiel #5
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            AddCarPresenter addCarPresenter = new AddCarPresenter(this);

            addCarPresenter.ClearCarData();

            ModifyCarPresenter modifyCarPresenter = new ModifyCarPresenter(this);

            modifyCarPresenter.ValidateSearchCriteria();

            if (ValidationResult.Keys.Contains(false))
            {
                this.ShowWarning(ValidationResult[false]);
                this.saveButton.Enabled = false;
            }
            else if (ValidationResult.Keys.Contains(true))
            {
                modifyCarPresenter.LoadCarData();
                this.saveButton.Enabled = true;
            }
        }