Exemplo 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();
            }
        }
Exemplo 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);
            }
        }
Exemplo n.º 3
0
        private void gridWinners_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            DataRowView rv = (DataRowView)gridWinners.Rows[e.RowIndex].DataBoundItem;

            TrophyDataSet.tblWinnersRow row = (TrophyDataSet.tblWinnersRow)rv.Row;

            mnuTrophiesWonBySailNumber.Enabled = (row.fldSailNumber.Length != 0);
            mnuTrophiesWonBySailNumber.Tag     = row.fldSailNumber;
            e.ContextMenuStrip = mnuWinnersContext;
        }
Exemplo n.º 4
0
        private void AddWinnerRow(Siberix.PDF.Layout.Table.Table table, TrophyDataSet.tblWinnersRow winner)
        {
            Siberix.PDF.Layout.Table.Row  row;
            Siberix.PDF.Layout.Table.Cell cell;
            Siberix.PDF.Layout.Text.Text  text;

            Siberix.PDF.Layout.Text.Style regular = new Siberix.PDF.Layout.Text.Style(WinnerFont, Brushes.Black);

            row = table.AddRow();
            // Year
            cell = row.AddCell();
            cell.BottomPadding = Px(1);
            cell.Width         = Px(15);
            cell.WidthIsFixed  = true;
            text       = cell.AddText();
            text.Style = regular;
            text.AddContent(winner.fldYear.ToString());
            // Sail #
            cell = row.AddCell();
            cell.BottomPadding = Px(1);
            cell.Width         = Px(30);
            cell.WidthIsFixed  = true;
            text       = cell.AddText();
            text.Style = regular;
            text.AddContent(winner.fldSailNumber);
            // Helm
            cell = row.AddCell();
            cell.BottomPadding = Px(1);
            text       = cell.AddText();
            text.Style = regular;
            text.AddContent(winner.fldHelm);
            // Owner
            cell = row.AddCell();
            cell.BottomPadding = Px(1);
            text       = cell.AddText();
            text.Style = regular;
            text.AddContent(winner.fldOwner);
        }