示例#1
0
        private void OnInsertClick(object sender, EventArgs e)
        {
            InsertItems InsertItemForm = new InsertItems();

            InsertItemForm.InsertItemEvent += new EventHandler <InsertItemEventArgs>(OnInsertChangeEvent);
            InsertItemForm.Show();
        }
示例#2
0
        public bool OpenRecord(object primaryKey)
        {
            InsertItems.ToStatesNationality(comboBoxNationality);
            InsertItems.ToTeams(comboBoxTeam);

            if (primaryKey == null)
            {
                return(false);
            }
            var idDriver = (int)primaryKey;
            var driver   = new  DriversMapper().SelectDriver(idDriver);

            textBoxFirstName.Text = driver.FirstName;
            textBoxLastName.Text  = driver.LastName;
            if (driver.Number != null)
            {
                numericUpDownNumber.Value = (int)driver.Number;
            }
            if (driver.DateOfBirth != null)
            {
                dateTimePickerDateOfbirth.Value = (DateTime)driver.DateOfBirth;
            }

            driver.Team = Teams.FindForDriver(driver);
            if (driver.Team != null)
            {
                comboBoxTeam.SelectedIndex = driver.Team.Id;
            }
            else
            {
                comboBoxTeam.SelectedIndex = -1;
            }

            driver.State = States.FindForDriver(driver);
            if (driver.State != null)
            {
                comboBoxNationality.SelectedIndex = driver.State.Id;
            }
            else
            {
                comboBoxNationality.SelectedIndex = -1;
            }

            labelHeader.Text = @"Úprava jezdce - " + driver.FirstName + @" " + driver.LastName;
            Text             = labelHeader.Text;

            _driverId = driver.Id;

            return(true);
        }
        public bool OpenRecord(object primaryKey)
        {
            InsertItems.ToStatesNames(comboBoxState);
            InsertItems.Manufacturers(comboBoxManufacturer);

            if (primaryKey == null)
            {
                return(false);
            }
            _teamId = (int)primaryKey;
            var team = new TeamsMapper().SelectTeam(_teamId);

            textBoxName.Text  = team.Name;
            textBoxTyres.Text = team.Tyres;


            team.Manufacturer = Manufacturers.FindForTeam(team);
            if (team.Manufacturer != null)
            {
                comboBoxManufacturer.SelectedIndex = team.Manufacturer.Id;
            }
            else
            {
                comboBoxManufacturer.SelectedIndex = -1;
            }

            team.State = States.FindForTeam(team);
            if (team.State != null)
            {
                comboBoxState.SelectedIndex = team.State.Id;
            }
            else
            {
                comboBoxState.SelectedIndex = -1;
            }

            labelHeader.Text = @"Úprava týmu - " + team.Name;
            Text             = labelHeader.Text;

            return(true);
        }