Ejemplo n.º 1
0
        public static void calculateResults()
        {
            using (CastlesTableAdapters.CastlesTableAdapter adapter = new CastlesTableAdapters.CastlesTableAdapter())
            {
                Castles.CastlesDataTable table          = new Castles.CastlesDataTable();
                Castles.CastlesDataTable compareToTable = new Castles.CastlesDataTable();
                //Castles.CastlesDataTable compareToTables = new Castles.CastlesDataTable();
                adapter.FillByRange(table, 0, 0);
                adapter.Fill(compareToTable);


                #region ToDo stuff

                //Castle castleFrom = new Castle();
                //castleFrom = Castle.FrontDataObject(table[0]);

                //adapter.FillByNotID(compareToTables, 1);
                List <Castle> castles = new List <Castle>();
                foreach (Castles.CastlesRow row in table)
                {
                    Castle castle = new Castle();
                    castle = Castle.FrontDataObject(row);
                    castles.Add(castle);
                }

                List <Castle> allCastles = new List <Castle>();
                foreach (Castles.CastlesRow row in compareToTable)
                {
                    Castle cas = new Castle();
                    cas = Castle.FrontDataObject(row);
                    allCastles.Add(cas);
                }

                addPoints(castles, allCastles);
                foreach (Castles.CastlesRow row in table)
                {
                    Castle castle = castles.Where(x => x.ID == row.Id).FirstOrDefault();
                    Castle.toDataObject(castle, row);
                }
                #endregion

                adapter.Update(table);
                table.AcceptChanges();
            }
        }
Ejemplo n.º 2
0
        public static Castle FrontDataObject(Castles.CastlesRow row)
        {
            Castle cas = new Castle();

            cas.ID          = row.Id;
            cas.CastleOne   = row.CastleOne;
            cas.CastleTwo   = row.CastleTwo;
            cas.CastleThree = row.CastleThree;
            cas.CastleFour  = row.CastleFour;
            cas.CastleFive  = row.CastleFive;
            cas.CastleSix   = row.CastleSix;
            cas.CastleSeven = row.CastleSeven;
            cas.CastleEight = row.CastleEight;
            cas.CastleNine  = row.CastleNine;
            cas.CastleTen   = row.CastleTen;
            cas.TotalWins   = row.IsTotalWinsNull() ? 0 : row.TotalWins;
            cas.TotalLosses = row.IsTotalLossesNull() ? 0 : row.TotalLosses;
            cas.TotalTies   = row.IsTotalTiedNull() ? 0 : row.TotalTied;
            cas.Rank        = row.IsRankNull() ? 0 : row.Rank;
            return(cas);
        }
Ejemplo n.º 3
0
 public static void toDataObject(Castle cas, Castles.CastlesRow row)
 {
     row.TotalWins   = cas.TotalWins;
     row.TotalLosses = cas.TotalLosses;
     row.TotalTied   = cas.TotalTies;
 }