Esempio n. 1
0
        private void butAddWinner_Click(object sender, EventArgs e)
        {
            using (EditWinnerDialog dlg = new EditWinnerDialog()) {
                dlg.ClassID = CurrentClassID;
                dlg.Year    = (short)DateTime.Now.Year;

                if (dlg.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                TrophyDataSet.tblWinnersRow row = ((tblWinnersBindingSource.AddNew() as DataRowView).Row as TrophyDataSet.tblWinnersRow);
                row.fldClassID    = dlg.ClassID;
                row.fldCreated    = DateTime.Now;
                row.fldCrew       = dlg.Crew;
                row.fldHelm       = dlg.Helm;
                row.fldNotes      = dlg.Notes;
                row.fldOwner      = dlg.Owner;
                row.fldSailNumber = dlg.SailNumber;
                row.fldTrophyID   = CurrentTrophyID;
                row.fldYear       = dlg.Year;

                tblWinnersBindingSource.CurrencyManager.EndCurrentEdit();
                tblWinnersTableAdapter.Update(trophyDataSet.tblWinners);

                row.fldWinnerID = GetLastAutoIncrementID("tblWinners", "fldWinnerID");
                row.AcceptChanges();
            }
        }
Esempio n. 2
0
        private void OnEditCurrentWinner()
        {
            TrophyDataSet.tblWinnersRow row = ((tblWinnersBindingSource.Current as DataRowView).Row as TrophyDataSet.tblWinnersRow);

            using (EditWinnerDialog dlg = new EditWinnerDialog()) {
                dlg.ClassID    = row.fldClassID;
                dlg.Crew       = row.fldCrew;
                dlg.Helm       = row.fldHelm;
                dlg.Notes      = row.fldNotes;
                dlg.Owner      = row.fldOwner;
                dlg.SailNumber = row.fldSailNumber;
                dlg.Year       = row.fldYear;

                if (dlg.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                row.fldClassID    = dlg.ClassID;
                row.fldCrew       = dlg.Crew;
                row.fldHelm       = dlg.Helm;
                row.fldModified   = DateTime.Now;
                row.fldOwner      = dlg.Owner;
                row.fldNotes      = dlg.Notes;
                row.fldSailNumber = dlg.SailNumber;
                row.fldYear       = dlg.Year;

                tblWinnersBindingSource.CurrencyManager.EndCurrentEdit();
                tblWinnersTableAdapter.Update(trophyDataSet.tblWinners);
            }
        }
Esempio n. 3
0
        private void OnEditCurrentWinner()
        {
            TrophyDataSet.tblWinnersRow row = ((tblWinnersBindingSource.Current as DataRowView).Row as TrophyDataSet.tblWinnersRow);

              using (EditWinnerDialog dlg = new EditWinnerDialog()) {
            dlg.ClassID = row.fldClassID;
            dlg.Crew = row.fldCrew;
            dlg.Helm = row.fldHelm;
            dlg.Notes = row.fldNotes;
            dlg.Owner = row.fldOwner;
            dlg.SailNumber = row.fldSailNumber;
            dlg.Year = row.fldYear;

            if (dlg.ShowDialog(this) != DialogResult.OK)
              return;

            row.fldClassID = dlg.ClassID;
            row.fldCrew = dlg.Crew;
            row.fldHelm = dlg.Helm;
            row.fldModified = DateTime.Now;
            row.fldOwner = dlg.Owner;
            row.fldNotes = dlg.Notes;
            row.fldSailNumber = dlg.SailNumber;
            row.fldYear = dlg.Year;

            tblWinnersBindingSource.CurrencyManager.EndCurrentEdit();
            tblWinnersTableAdapter.Update(trophyDataSet.tblWinners);
              }
        }
Esempio n. 4
0
        private void butAddWinner_Click(object sender, EventArgs e)
        {
            using (EditWinnerDialog dlg = new EditWinnerDialog()) {
            dlg.ClassID = CurrentClassID;
            dlg.Year = (short)DateTime.Now.Year;

            if (dlg.ShowDialog(this) != DialogResult.OK)
              return;

            TrophyDataSet.tblWinnersRow row = ((tblWinnersBindingSource.AddNew() as DataRowView).Row as TrophyDataSet.tblWinnersRow);
            row.fldClassID = dlg.ClassID;
            row.fldCreated = DateTime.Now;
            row.fldCrew = dlg.Crew;
            row.fldHelm = dlg.Helm;
            row.fldNotes = dlg.Notes;
            row.fldOwner = dlg.Owner;
            row.fldSailNumber = dlg.SailNumber;
            row.fldTrophyID = CurrentTrophyID;
            row.fldYear = dlg.Year;

            tblWinnersBindingSource.CurrencyManager.EndCurrentEdit();
            tblWinnersTableAdapter.Update(trophyDataSet.tblWinners);

            row.fldWinnerID = GetLastAutoIncrementID("tblWinners", "fldWinnerID");
            row.AcceptChanges();
              }
        }