Пример #1
0
 public TeamSetCreator()
 {
     TopMost = true;
     InitializeComponent();
     teamSet = new TeamSet();
     reloadTeamSetInfo();
 }
        private string getCrewName(TeamSet team)
        {
            string pilName = team.Pilot != null ? team.Pilot.LastName + " " + team.Pilot.FirstName : " - ";
            string navName = team.Navigator != null ? "|" + team.Navigator.LastName + " " + team.Navigator.FirstName : " - ";

            return(team.Id.ToString() + "|" + pilName + navName);
        }
Пример #3
0
 public TeamSetCreator(TeamSet teamSet)
 {
     TopMost      = true;
     this.teamSet = teamSet;
     InitializeComponent();
     reloadTeamSetInfo();
 }
        private void btnEdit_Click(object sender, EventArgs e)
        {
            // Show a modal dialog and determine if DialogResult = OK.
            // NOTE: must set the button property accordingly
            int rIdx = -1;

            if (dataGridView1.SelectedCells.Count == 0)
            {
                return;
            }
            else
            {
                rIdx = dataGridView1.SelectedCells[0].RowIndex;
            }
            List <SubscriberSet> lstSubsc = Client.SelectedCompetition.SubscriberSet.ToList();
            List <TeamSet>       lstCrews = Client.SelectedCompetition.TeamSet.ToList();
            TeamSet ts = dataGridView1.Rows[rIdx].Tag as TeamSet;

            if (ts == null)
            {
                ts = new TeamSet();
                ts.CompetitionSet = Client.SelectedCompetition;
                ts.Color          = "Black";
            }

            using (TeamDialog frmTeamDialog = new TeamDialog(ts, lstSubsc, lstCrews, lstTeamIdPilotNavNames))
            {
                DialogResult rRes = frmTeamDialog.ShowDialog();
                if (rRes == DialogResult.Cancel)
                {
                    //do nothing
                }

                if (rRes == DialogResult.OK)
                {
                    TeamSet tm = frmTeamDialog.SelectedTeam;
                    if (tm.Id == 0)
                    {
                        Client.DBContext.TeamSet.Add(tm);

                        DataGridViewRow dgvr = new DataGridViewRow();
                        dgvr.CreateCells(dataGridView1);
                        dgvr.SetValues(
                            tm.CNumber,
                            tm.Nationality != null ? tm.Nationality : "",
                            tm.Pilot.LastName + " " + tm.Pilot.FirstName,
                            tm.Navigator != null ? tm.Navigator.LastName + " " + tm.Navigator.FirstName : "-",
                            tm.AC,
                            tm.Color);
                        dgvr.Tag = tm;
                        dataGridView1.Rows.Add(dgvr);
                    }
                    Client.DBContext.SaveChanges();
                    this.BeginInvoke(new MethodInvoker(LoadLists));
                    this.BeginInvoke(new MethodInvoker(UpdateEnablement));
                }
            }
        }
Пример #5
0
    /// <summary>
    /// Inicializar equipo
    /// </summary>
    public void InitTeam(TeamSet tSet)
    {
        //Init team values
        _teamId    = tSet.teamId;
        _teamColor = tSet.teamColor;

        //init units
        foreach (Unit u in units)
        {
            u.InitUnit(this);
        }
    }
Пример #6
0
    public void InitPlayer(TeamSet tSet)
    {
        _team.InitTeam(tSet);

        _drawGrid   = DrawGrid.instance;
        _groundMask = LayerMask.GetMask("Ground");

        _hoverTimer = 0;

        flagEnemy     = levelScript.GetEnemyFlag(_team);
        flagAlly      = _team.flagPosition;
        totalDistance = path.GetDistance(flagAlly, flagEnemy);
    }
        private string getTeamDsc(TeamSet team)
        {
            SubscriberSet pilot = team.Pilot;
            StringBuilder sb    = new StringBuilder();

            sb.Append(pilot.LastName).Append(" ").Append(pilot.FirstName);
            if (team.Navigator != null)
            {
                SubscriberSet navi = team.Navigator;
                sb.Append(" - ").Append(navi.LastName).Append(" ").Append(navi.FirstName);
            }
            return(sb.ToString());
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedCells == null)
            {
                return;
            }
            TeamSet team = dataGridView1.Rows[dataGridView1.SelectedCells[0].RowIndex].Tag as TeamSet;

            Client.DBContext.TeamSet.Remove(team);
            Client.DBContext.SaveChanges();

            this.BeginInvoke(new MethodInvoker(LoadLists));
            this.BeginInvoke(new MethodInvoker(UpdateEnablement));
        }
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count > 0)
            {
                if (dataGridView1.SelectedRows[0].Cells[1] != null && dataGridView1.SelectedRows[0].Cells[1].Value != null)
                {
                    TeamSet tm = dataGridView1.SelectedRows[0].Tag as TeamSet;
                }

                if (dataGridView1.SelectedRows[0].Index == dataGridView1.NewRowIndex)
                {
                }
            }
        }
Пример #10
0
        private static string getTeamDsc(Client.DataAccess c, FlightSet flight)
        {
            TeamSet       team  = flight.TeamSet;
            SubscriberSet pilot = team.Pilot;
            StringBuilder sb    = new StringBuilder();

            sb.Append(team.CNumber).Append(" ");
            sb.Append(pilot.LastName).Append(" ").Append(pilot.FirstName);
            if (team.Navigator != null)
            {
                SubscriberSet navi = team.Navigator;
                sb.Append(" - ").Append(navi.LastName).Append(" ").Append(navi.FirstName);
            }
            return(sb.ToString());
        }
Пример #11
0
        public TeamDialog(TeamSet team, List <SubscriberSet> lstParticipants, List <TeamSet> lstCrews, List <string> lstCrewIdPilNavNames)
        {
            InitializeComponent();
            List <SubscriberExtension> lstSubscExt = getListOfSubsc(lstParticipants).OrderBy(l => l.LastNameFirstName).ToList();

            ListTeamIdPilNavNames = lstCrewIdPilNavNames;
            ListCrews             = lstCrews;
            ListParticipants      = lstParticipants;
            TeamId       = 0;
            SelectedTeam = team;
            //Reload();
            if (SelectedTeam == null)
            {
                SelectedTeam           = new TeamSet();
                textBoxCrewNumber.Text = calculateCrewNumber();
            }
            else
            {
                TeamId    = SelectedTeam.Id;
                Pilot     = SelectedTeam.Pilot;
                Navigator = SelectedTeam.Navigator;

                textBoxNationality.Text = SelectedTeam.Nationality;
                textBoxCrewNumber.Text  = string.IsNullOrEmpty(SelectedTeam.CNumber) ? calculateCrewNumber() : SelectedTeam.CNumber;

                textBoxAC.Text           = SelectedTeam.AC;
                btnColorSelect.BackColor = Color.Gray;
                btnColorSelect.Text      = SelectedTeam.Color != null?SelectedTeam.Color.ToString() : Color.Gray.ToString();

                btnColorSelect.BackColor = SelectedTeam.Color != null?TeamControl.getColor(SelectedTeam.Color) : Color.Gray;
            }

            if (SelectedTeam.Pilot != null)
            {
                comboBoxPilot.SelectedValue = SelectedTeam.Pilot.Id;
            }

            if (SelectedTeam.Navigator != null)
            {
                comboBoxNavigator.SelectedValue = SelectedTeam.Navigator.Id;
            }
            errorProvider1.Clear();
            UpdateEnablement();
        }
Пример #12
0
        public static void CreateRankingListPDF(Client.DataAccess c, QualificationRoundSet qRnd, List <ComboBoxFlights> qRndFlights, String pathToPDF)
        {
            List <Toplist> toplist = new List <Toplist>();

            foreach (ComboBoxFlights cbct in qRndFlights)
            {
                int sum = 0;
                foreach (PenaltySet penalty in cbct.flight.PenaltySet)
                {
                    sum += penalty.Points;
                }
                toplist.Add(new Toplist(cbct.flight, sum));
            }
            toplist.Sort();

            Document doc = new Document();

            doc.Info.Author   = "*****@*****.**";
            doc.Info.Comment  = "Generated from ANRL Client on " + DateTime.Now.ToString();
            doc.Info.Keywords = "ANRL Toplist";
            doc.Info.Subject  = "Toplist";
            doc.Info.Title    = "Toplist";
            doc.UseCmykColor  = true;
            doc.DefaultPageSetup.PageFormat   = PageFormat.A4;
            doc.DefaultPageSetup.Orientation  = Orientation.Landscape;
            doc.DefaultPageSetup.BottomMargin = Unit.FromCentimeter(1);
            doc.DefaultPageSetup.TopMargin    = Unit.FromCentimeter(1);
            doc.DefaultPageSetup.LeftMargin   = Unit.FromCentimeter(1.5);
            doc.DefaultPageSetup.RightMargin  = Unit.FromCentimeter(1);


            Section sec = doc.AddSection();

            AddCompetitionAndLogo(c, sec);
            sec.AddParagraph("");
            sec.AddParagraph("Ranking List: " + qRnd.Name);
            sec.AddParagraph("");

            Table table = sec.AddTable();

            table.Borders.Visible = true;

            table.AddColumn(Unit.FromCentimeter(2));
            table.AddColumn(Unit.FromCentimeter(2));
            table.AddColumn(Unit.FromCentimeter(2.5));
            table.AddColumn(Unit.FromCentimeter(4));
            table.AddColumn(Unit.FromCentimeter(4));
            table.AddColumn(Unit.FromCentimeter(4));
            table.AddColumn(Unit.FromCentimeter(4));

            Row row = table.AddRow();

            row.Shading.Color = Colors.Gray;
            row.Cells[0].AddParagraph("Rank");
            row.Cells[1].AddParagraph("Points");
            row.Cells[2].AddParagraph("Nationality");
            row.Cells[3].AddParagraph("Pilot Lastname");
            row.Cells[4].AddParagraph("Pilot Firstname");
            row.Cells[5].AddParagraph("Navigator Lastname");
            row.Cells[6].AddParagraph("Navigator Firstname");

            int oldsum   = -1;
            int prevRank = 0;
            int rank     = 0;

            foreach (Toplist top in toplist)
            {
                rank++;
                TeamSet t = top.ct.TeamSet;
                Row     r = table.AddRow();
                if (rank > 1 && oldsum == top.sum)  // we have a shared rank
                {
                    r.Cells[0].AddParagraph(prevRank + "");
                }
                else  // the normal case
                {
                    prevRank = rank;
                    r.Cells[0].AddParagraph(rank + "");
                }
                r.Cells[1].AddParagraph(top.sum.ToString());
                r.Cells[2].AddParagraph(t.Nationality);
                SubscriberSet pilot = t.Pilot;
                r.Cells[3].AddParagraph(pilot.LastName);
                r.Cells[4].AddParagraph(pilot.FirstName);
                if (t.Navigator != null)
                {
                    SubscriberSet navigator = t.Navigator;
                    r.Cells[5].AddParagraph(navigator.LastName);
                    r.Cells[6].AddParagraph(navigator.FirstName);
                }
                oldsum = top.sum;
            }

            PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always);

            renderer.Document = doc;
            renderer.RenderDocument();
            renderer.PdfDocument.Save(pathToPDF);

            Process.Start(pathToPDF);
        }
        //private int ParcourLength;
        //private int TakeOffStartgate;
        //private int TakeOffIntervall;
        //private int ParcourIntervall;

        public StartListDialog(
            List <TeamSet> lstTeams,
            FlightSet selectedFlt,
            int maxStartId,
            long dateQRDate,
            long timeTKOF0,
            long timeStart0,
            long timeEnd0,
            int nrOfRoutes)
        {
            InitializeComponent();
            // BindingSource bs = new BindingSource();
            // bs.DataSource = lstTeams;
            // comboBoxTKOFLines.DataSource = bs;
            if (selectedFlt == null)
            {
                SelectedFlight = new FlightSet();
            }
            else
            {
                SelectedFlight = selectedFlt;
            }
            SelectedTeam = SelectedFlight.TeamSet;

            List <ComboTeamExtension> lstCboTeam = new List <ComboTeamExtension>();

            foreach (TeamSet t in lstTeams)
            {
                comboBoxCrew.Items.Add(new ComboTeamExtension(t, getTeamDsc(t)));
            }

            for (int i = 1; i <= nrOfRoutes; i++)
            {
                Route r = (Route)i;
                comboBoxRoute.Items.Add(new ComboRoute(r));
            }

            if (SelectedFlight.Id == 0)
            {
                textBoxStartId.Text       = maxStartId.ToString();
                comboBoxCrew.SelectedItem = null;
                date.Value        = new DateTime(dateQRDate);
                timeTakeOff.Value = new DateTime(timeTKOF0);
                timeStart.Value   = new DateTime(timeStart0);
                timeEnd.Value     = new DateTime(timeEnd0);
                // select first item id we have only one route
                comboBoxRoute.SelectedIndex = (nrOfRoutes == 1) ? 0: -1;
            }
            else
            {
                ComboTeamExtension comboTeam = null;
                foreach (Object o in comboBoxCrew.Items)
                {
                    if ((o as ComboTeamExtension).p == SelectedTeam)
                    {
                        comboTeam = o as ComboTeamExtension;
                        comboBoxCrew.SelectedItem = comboTeam;
                        break;
                    }
                }
                ComboRoute route = null;
                foreach (Object o in comboBoxRoute.Items)
                {
                    ComboRoute r = o as ComboRoute;
                    if ((int)r.p == SelectedFlight.Route)
                    {
                        route = r;
                        comboBoxRoute.SelectedItem = route;
                        break;
                    }
                }
                comboBoxRoute.SelectedItem = route;

                textBoxStartId.Text = SelectedFlight.StartID.ToString();
                DateTime takeOff = new DateTime(SelectedFlight.TimeTakeOff);
                date.Value          = takeOff;
                timeTakeOff.Value   = takeOff;
                timeStart.Value     = new DateTime(SelectedFlight.TimeStartLine);
                timeEnd.Value       = new DateTime(SelectedFlight.TimeEndLine);
                textBoxStartId.Tag  = SelectedFlight;
                textBoxStartId.Text = SelectedFlight.StartID.ToString();
            }
            UpdateEnablement();
            errorProvider1.Clear();
        }
        private void ImportFromExcel(ComboQRExtension item, string filename)
        {
            // this has not been tested after changes in version 2.0.0
            // therefore unsupported UFN
            return;

            FileInfo newFile = new FileInfo(filename);

            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
            //ExcelPackage pck = new ExcelPackage(newFile);
            using (var pck = new ExcelPackage(newFile))
            {
                ExcelWorksheet Participants = pck.Workbook.Worksheets.First(p => p.Name == "Participants");
                ExcelWorksheet Teams        = pck.Workbook.Worksheets.First(p => p.Name == "Crews");
                ExcelWorksheet StartList    = pck.Workbook.Worksheets.First(p => p.Name == "StartList");
                int            i            = 2;
                while (i < 200)
                {
                    string LastName  = Participants.Cells[("A" + i)].Value as string;
                    string FirstName = Participants.Cells[("B" + i)].Value as string;
                    if (LastName != null && FirstName != null && LastName != "" && FirstName != "")
                    {
                        if (!Client.SelectedCompetition.SubscriberSet.Any(p => p.LastName == LastName && p.FirstName == FirstName))
                        {
                            SubscriberSet sub = new SubscriberSet();
                            sub.CompetitionSet = Client.SelectedCompetition;
                            sub.LastName       = LastName;
                            sub.FirstName      = FirstName;
                            Client.DBContext.SubscriberSet.Add(sub);
                        }
                    }
                    else
                    {
                        break;
                    }
                    i++;
                }
                Client.DBContext.SaveChanges();
                i = 2;
                while (i < 200)
                {
                    double?cNumber     = Teams.Cells[("A" + i)].Value as double?;
                    string nationality = Teams.Cells[("B" + i)].Value as string;
                    string pilot       = Teams.Cells[("C" + i)].Value as string;
                    string navigator   = Teams.Cells[("D" + i)].Value as string;
                    string ac          = Teams.Cells[("E" + i)].Value as string;
                    if (cNumber.HasValue && pilot != null && pilot != "")
                    {
                        SubscriberSet pilotS     = Client.SelectedCompetition.SubscriberSet.First(p => pilot.Contains(p.FirstName) && pilot.Contains(p.LastName));
                        SubscriberSet navigatorS = null;
                        if (navigator != null && navigator != "")
                        {
                            navigatorS = Client.SelectedCompetition.SubscriberSet.First(p => navigator.Contains(p.FirstName) && navigator.Contains(p.LastName));
                        }
                        TeamSet t = null;
                        if (Client.SelectedCompetition.TeamSet.Any(p => p.CNumber == ((int)cNumber.Value).ToString()))
                        {
                            t = Client.SelectedCompetition.TeamSet.First(p => p.CNumber == ((int)cNumber.Value).ToString());
                        }
                        else
                        {
                            t = new TeamSet();
                            t.CompetitionSet = Client.SelectedCompetition;
                            Client.DBContext.TeamSet.Add(t);
                        }
                        t.Pilot       = pilotS;
                        t.Navigator   = navigatorS;
                        t.CNumber     = ((int)cNumber.Value).ToString();
                        t.Nationality = nationality;
                        t.AC          = ac;
                    }
                    else
                    {
                        break;
                    }
                    i++;
                }
                Client.DBContext.SaveChanges();
                i = 2;
                DateTime?date = null;
                while (i < 200)
                {
                    if (i == 2)
                    {
                        date = StartList.Cells[("K" + i)].Value as DateTime?;
                    }
                    double?startId = StartList.Cells[("A" + i)].Value as double?;
                    double?cNumber = StartList.Cells[("B" + i)].Value as double?;
                    double?takeOff = StartList.Cells[("G" + i)].Value as double?;
                    double?start   = StartList.Cells[("H" + i)].Value as double?;
                    double?end     = StartList.Cells[("I" + i)].Value as double?;
                    string route   = StartList.Cells[("J" + i)].Value as string;
                    if (date != null && date.HasValue && takeOff != null && start != null && end != null && startId.HasValue && cNumber.HasValue && takeOff.HasValue && start.HasValue && end.HasValue && route != null)
                    {
                        FlightSet f = null;
                        if (item.q.FlightSet.Any(p => p.StartID == startId.Value))
                        {
                            f = item.q.FlightSet.First(p => p.StartID == startId.Value);
                        }
                        else
                        {
                            f = new FlightSet();
                            f.QualificationRoundSet = item.q;
                            f.StartID = ((int)startId.Value);
                            Client.DBContext.FlightSet.Add(f);
                        }
                        f.TeamSet = Client.SelectedCompetition.TeamSet.First(p => p.CNumber == ((int)cNumber.Value).ToString());
                        f.Route   = (int)Enum.Parse(typeof(Route), route, true);
                        DateTime d  = date.Value;
                        DateTime to = DateTime.FromOADate(takeOff.Value);
                        DateTime st = DateTime.FromOADate(start.Value);
                        DateTime en = DateTime.FromOADate(end.Value);
                        f.TimeTakeOff   = new DateTime(d.Year, d.Month, d.Day, to.Hour, to.Minute, to.Second).Ticks;
                        f.TimeStartLine = new DateTime(d.Year, d.Month, d.Day, st.Hour, st.Minute, st.Second).Ticks;
                        f.TimeEndLine   = new DateTime(d.Year, d.Month, d.Day, en.Hour, en.Minute, en.Second).Ticks;
                    }
                    else
                    {
                        break;
                    }
                    i++;
                }
                Client.DBContext.SaveChanges();
            }
        }
        public static void CreateRankingListExcel(string CompName, string QRName, List <ComboBoxFlights> qRndFlights, String filename)
        {
            List <Toplist> toplist = new List <Toplist>();

            foreach (ComboBoxFlights cbct in qRndFlights)
            {
                int sum = 0;
                foreach (PenaltySet penalty in cbct.flight.PenaltySet)
                {
                    sum += penalty.Points;
                }
                toplist.Add(new Toplist(cbct.flight, sum));
            }
            toplist.Sort();

            var newFile = new FileInfo(filename);

            if (newFile.Exists)
            {
                newFile.Delete();
            }
            using (var pck = new ExcelPackage(newFile))
            {
                ExcelWorksheet ResultList = pck.Workbook.Worksheets.Add("ResultList");
                ResultList.Cells[1, 1].Value = String.Format("Competition: {0}", CompName);
                ResultList.Cells[2, 1].Value = String.Format("Qualification Round: {0}", QRName);

                string[] colNamesValues = { "Rank", "Points", "Nationality", "Pilot Lastname", "Pilot Firstname", "Navigator Lastname", "Navigator Firstname" };

                for (int jCol = 0; jCol < colNamesValues.Length; jCol++)
                {
                    ResultList.Cells[3, jCol + 1].Value = colNamesValues[jCol];
                }

                int oldsum   = -1;
                int prevRank = 0;
                int rank     = 0;
                int i        = 0;
                int iBase    = 3;

                foreach (Toplist top in toplist)
                {
                    rank++;
                    i++;
                    TeamSet t = top.ct.TeamSet;
                    if (i > 0 && oldsum == top.sum)  // we have a shared rank
                    {
                        ResultList.Cells[i + iBase, 1].Value = prevRank;
                    }
                    else  // the normal case
                    {
                        prevRank = rank;
                        ResultList.Cells[i + iBase, 1].Value = rank;
                    }
                    ResultList.Cells[i + iBase, 2].Value = top.sum.ToString();
                    ResultList.Cells[i + iBase, 3].Value = t.Nationality;
                    SubscriberSet pilot = t.Pilot;
                    ResultList.Cells[i + iBase, 4].Value = pilot.LastName;
                    ResultList.Cells[i + iBase, 5].Value = pilot.FirstName;
                    if (t.Navigator != null)
                    {
                        SubscriberSet navigator = t.Navigator;
                        ResultList.Cells[i + iBase, 6].Value = navigator.LastName;
                        ResultList.Cells[i + iBase, 7].Value = navigator.FirstName;
                    }
                    oldsum = top.sum;
                }
                pck.Save();
            }
        }
Пример #16
0
        internal static void CreateStartListPDF(QualificationRoundSet qRnd, Client.DataAccess Client, string pathToPDF)
        {
            Document doc = new Document();

            doc.Info.Author   = "*****@*****.**";
            doc.Info.Comment  = "Generated from ANRL Client on " + DateTime.Now.ToString();
            doc.Info.Keywords = "ANRL Start List";
            doc.Info.Subject  = "Start List";
            doc.Info.Title    = "Start List";
            doc.UseCmykColor  = true;
            doc.DefaultPageSetup.PageFormat  = PageFormat.A4;
            doc.DefaultPageSetup.Orientation = Orientation.Landscape;

            Section sec = doc.AddSection();

            AddCompetitionAndLogo(Client, sec);

            sec.AddParagraph("Qualification Round: " + qRnd.Name);
            sec.AddParagraph("Starting List");
            sec.AddParagraph("Printed (UTC): " + System.DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ssZ", DateTimeFormatInfo.InvariantInfo));
            sec.AddParagraph("");

            Table table = sec.AddTable();

            table.Borders.Visible = true;

            table.AddColumn(Unit.FromCentimeter(1));
            table.AddColumn(Unit.FromCentimeter(1));
            table.AddColumn(Unit.FromCentimeter(2));
            table.AddColumn(Unit.FromCentimeter(9));
            table.AddColumn(Unit.FromCentimeter(2.1));
            table.AddColumn(Unit.FromCentimeter(2.1));
            table.AddColumn(Unit.FromCentimeter(2.1));
            table.AddColumn(Unit.FromCentimeter(2.1));
            table.AddColumn(Unit.FromCentimeter(2.1));
            table.AddColumn(Unit.FromCentimeter(1.3));

            Row row = table.AddRow();

            row.Shading.Color = Colors.Gray;
            row.Cells[0].AddParagraph("Start ID");
            row.Cells[1].AddParagraph("Crew ID");
            row.Cells[2].AddParagraph("AC");
            row.Cells[3].AddParagraph("Pilot - Navigator");
            row.Cells[4].AddParagraph("Start Planning [UTC]");
            row.Cells[5].AddParagraph("End Planning [UTC]");
            row.Cells[6].AddParagraph("Take-Off [UTC]");
            row.Cells[7].AddParagraph("SP Gate [UTC]");
            row.Cells[8].AddParagraph("FP Gate [UTC]");
            row.Cells[9].AddParagraph("Route");

            foreach (FlightSet ct in qRnd.FlightSet.OrderBy(x => x.TimeTakeOff).ThenBy(x => x.Route))
            {
                Row r = table.AddRow();
                if ((table.Rows.Count - 1) % 2 == 0)
                {
                    r.Shading.Color = Colors.LightGray;
                }
                r.Cells[0].AddParagraph(ct.StartID.ToString());
                TeamSet teams = ct.TeamSet;
                r.Cells[1].AddParagraph(teams.CNumber);
                r.Cells[2].AddParagraph(teams.AC);
                SubscriberSet pilot = teams.Pilot;
                if (teams.Navigator != null)
                {
                    SubscriberSet navigator = teams.Navigator;
                    r.Cells[3].AddParagraph(pilot.LastName + " " + pilot.FirstName + " - " + navigator.LastName + " " + navigator.FirstName);
                }
                else
                {
                    r.Cells[3].AddParagraph(pilot.LastName + " " + pilot.FirstName);
                }
                DateTime dt = new DateTime(ct.TimeTakeOff);

                r.Cells[4].AddParagraph(dt.AddMinutes(-C_Timespan_StartPlanningToTKOF).ToString(C_TimeFormat, DateTimeFormatInfo.InvariantInfo));
                r.Cells[5].AddParagraph(dt.AddMinutes(-C_Timespan_EndPlanningToTKOF).ToString(C_TimeFormat, DateTimeFormatInfo.InvariantInfo));
                //                r.Cells[6].Shading.Color = Colors.LightGray;
                r.Cells[6].AddParagraph(dt.ToString(C_TimeFormat, DateTimeFormatInfo.InvariantInfo));
                r.Cells[7].AddParagraph(new DateTime(ct.TimeStartLine).ToString(C_TimeFormat, DateTimeFormatInfo.InvariantInfo));
                r.Cells[8].AddParagraph(new DateTime(ct.TimeEndLine).ToString(C_TimeFormat, DateTimeFormatInfo.InvariantInfo));
                r.Cells[9].AddParagraph(Enum.GetName(Route.A.GetType(), ct.Route));
                r.Cells[9].Format.Alignment = ParagraphAlignment.Center;
            }

            PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always);

            renderer.Document = doc;
            renderer.RenderDocument();
            renderer.PdfDocument.Save(pathToPDF);
            Process.Start(pathToPDF);
        }
 public RankedTeam(FlightSet t, TeamSet team, int points)
 {
     this.t      = t;
     this.team   = team;
     this.points = points;
 }
Пример #18
0
 public ComboTeamExtension(TeamSet p, String toString)
 {
     this.p        = p;
     this.toString = toString;
 }