コード例 #1
0
        private int PosStartComparison(DsMultiBouder.boulderResultsRow r1, DsMultiBouder.boulderResultsRow r2)
        {
            if (r1.iid == r2.iid)
            {
                return(0);
            }
            long res1 = (r1.IsresNull() ? 0 : r1.res);
            long res2 = (r2.IsresNull() ? 0 : r2.res);

            if (res1 != res2)
            {
                return(res2.CompareTo(res1));
            }
            if (r1.pos != r2.pos)
            {
                return(r1.pos.CompareTo(r2.pos));
            }
            if (r1.nya != r2.nya)
            {
                return(r1.nya.CompareTo(r2.nya));
            }
            if (r1.disq != r2.disq)
            {
                return(r1.disq.CompareTo(r2.disq));
            }
            if (r1.ParticipantsRow.vk != r2.ParticipantsRow.vk)
            {
                return(r1.ParticipantsRow.vk.CompareTo(r2.ParticipantsRow.vk));
            }
            return(r1.start.CompareTo(r2.start));
        }
コード例 #2
0
        private ListType CheckRow(DsMultiBouder.boulderResultsRow row, SqlTransaction tran)
        {
            DsMultiBouder.BoulderRoutesRow[] rLst = row.GetBoulderRoutesRows();
            if (row.nya || row.disq)
            {
                return(ListType.Res);
            }
            if (rLst == null || rLst.Length < 1)
            {
                return(ListType.Start);
            }
            List <DsMultiBouder.BoulderRoutesRow> rowL = new List <DsMultiBouder.BoulderRoutesRow>(rLst);

            rowL.Sort(new Comparison <DsMultiBouder.BoulderRoutesRow>(
                          delegate(DsMultiBouder.BoulderRoutesRow r1, DsMultiBouder.BoulderRoutesRow r2)
            {
                return(r1.routeN.CompareTo(r2.routeN));
            }));
            bool hasNothing    = true;
            bool hasEverything = (routeNumber <= rowL.Count);

            for (int i = 1; i <= routeNumber && i <= rowL.Count; i++)
            {
                if (rowL[i - 1].IsbonusANull() || rowL[i - 1].IstopANull())
                {
                    hasEverything = false;
                }
                else
                {
                    hasNothing = false;
                }
                if (rowL[i - 1].routeN != i)
                {
                    hasEverything = false;
                }
            }
            if (routeNumber < rowL.Count)
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = cn;
                cmd.Transaction = tran;
                cmd.CommandText = "DELETE FROM BoulderRoutes WHERE iid_parent=" + row.iid.ToString() +
                                  " AND routeN > " + routeNumber.ToString();
                cmd.ExecuteNonQuery();
            }
            if (hasNothing)
            {
                return(ListType.Start);
            }
            if (hasEverything)
            {
                return(ListType.Res);
            }
            return(ListType.Print);
        }
コード例 #3
0
        private int PosComparison(DsMultiBouder.boulderResultsRow r1, DsMultiBouder.boulderResultsRow r2)
        {
            if (r1.iid == r2.iid)
            {
                return(r1.iid.CompareTo(r2.iid));
            }
            long res1 = (r1.IsresNull() ? 0 : r1.res);
            long res2 = (r2.IsresNull() ? 0 : r2.res);

            if (res1 != res2)
            {
                return(res2.CompareTo(res1));
            }
            if (r1.pos != r2.pos)
            {
                return(r1.pos.CompareTo(r2.pos));
            }
            if (r1.nya != r2.nya)
            {
                return(r1.nya.CompareTo(r2.nya));
            }
            if (r1.disq != r2.disq)
            {
                return(r1.disq.CompareTo(r2.disq));
            }
            if (r1.ParticipantsRow.vk != r2.ParticipantsRow.vk)
            {
                return(r1.ParticipantsRow.vk.CompareTo(r2.ParticipantsRow.vk));
            }
            if (r1.ParticipantsRow.TeamsRow.name != r2.ParticipantsRow.TeamsRow.name)
            {
                return(r1.ParticipantsRow.TeamsRow.name.CompareTo(r2.ParticipantsRow.TeamsRow.name));
            }
            if (r1.ParticipantsRow.surname != r2.ParticipantsRow.surname)
            {
                return(r1.ParticipantsRow.surname.CompareTo(r2.ParticipantsRow.surname));
            }
            string sName1 = (r1.ParticipantsRow.IsnameNull() ? "" : r1.ParticipantsRow.name);
            string sName2 = (r2.ParticipantsRow.IsnameNull() ? "" : r2.ParticipantsRow.name);

            return(sName1.CompareTo(sName2));
        }
コード例 #4
0
 private int StartComparison(DsMultiBouder.boulderResultsRow r1, DsMultiBouder.boulderResultsRow r2)
 {
     return(r1.start.CompareTo(r2.start));
 }