コード例 #1
0
        private DSPatrolManagement sortList(DSPatrolManagement dblist)
        {
            Trace.WriteLine("CPatrolManagement: sortList() started on thread \"" +
                            Thread.CurrentThread.Name + "\" ( " +
                            System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() +
                            " )");

            try
            {
                DSPatrolManagement dblistnew = new DSPatrolManagement();
                int i = 0;
                foreach (DSPatrolManagement.PSortRow row in
                         dblist.PSort.Select("", "NrOfRounds desc, ClubId"))
                {
                    DSPatrolManagement.PSortRow newRow = dblistnew.PSort.NewPSortRow();
                    newRow.ShooterId  = row.ShooterId;
                    newRow.ClubId     = row.ClubId;
                    newRow.NrOfRounds = row.NrOfRounds;
                    dblistnew.PSort.AddPSortRow(newRow);
                    i++;
                    this.myInterface.updatedPatrolAddAutomaticCompetitors(
                        database.Shooters.Count + i,
                        3 * database.Shooters.Count);
                }

                return(dblistnew);
            }
            finally
            {
                Trace.WriteLine("CPatrolManagement: sortList() ended.");
            }
        }
コード例 #2
0
        private DSPatrolManagement createList()
        {
            Trace.WriteLine("CPatrolManagement: createList() started on thread \"" +
                            Thread.CurrentThread.Name + "\" ( " +
                            System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() +
                            " )");

            try
            {
                DSPatrolManagement dblist = new DSPatrolManagement();

                int i = 0;
                foreach (DatabaseDataset.ShootersRow shooter in database.Shooters)
                {
                    DSPatrolManagement.PSortRow newRow = dblist.PSort.NewPSortRow();

                    newRow.ClubId = shooter.ClubId;
                    int rounds = 0;
                    foreach (System.Data.DataRow row in shooter.GetChildRows("ShootersCompetitors"))
                    {
                        if (row.IsNull("PatrolId"))
                        {
                            rounds++;
                        }
                    }
                    if (rounds > 0)
                    {
                        newRow.NrOfRounds = rounds;
                        newRow.ShooterId  = shooter.ShooterId;

                        dblist.PSort.AddPSortRow(newRow);
                    }
                    i++;

                    this.myInterface.updatedPatrolAddAutomaticCompetitors(i, 3 * database.Shooters.Count);
                }

                return(dblist);
            }
            finally
            {
                Trace.WriteLine("CPatrolManagement: createList() ended.");
            }
        }