Exemplo n.º 1
0
        public void CreateMeetResultsPDF(OverallScore scoreToPrint)
        {
            IPrintoutPDFSvc printoutSvc = (IPrintoutPDFSvc)GetService(typeof(IPrintoutPDFSvc).Name);
            bool            didPrint    = printoutSvc.CreateMeetResultsPDF(scoreToPrint);

            if (!didPrint)
            {
            }
            //MessageBox.Show("Printout Failed!");
        }
Exemplo n.º 2
0
        /// <summary>
        /// Tests parameterized constructor
        /// </summary>
        /// <remarks>Each attribute is tested individually for accuracy</remarks>
        public void TestParameterizedConstructor()
        {
            Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name);
            bool test = true;

            IndEvent indEvent1 = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m);
            IndEvent indEvent2 = new IndEvent("PLM", "GWY", new EventPoints(0.0m, 5.0m, "P5", "PLM", "11.2"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 3.0m, 6.0m);
            Dictionary <string, IndEvent> indEvents = new Dictionary <string, IndEvent>();

            indEvents.Add("Boy's 100", indEvent1);
            indEvents.Add("Boy's 200", indEvent2);

            RelayEvent relayEvent1 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "11.3"), new EventPoints(0.0m, 0.0m, "A", "GWY", "11.4"), 5.0m, 0.0m);
            RelayEvent relayEvent2 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "400"), new EventPoints(0.0m, 0.0m, "A", "GWY", "500"), 5.0m, 0.0m);
            Dictionary <string, RelayEvent> relayEvents = new Dictionary <string, RelayEvent>();

            relayEvents.Add("Boy's 4x100", relayEvent1);
            relayEvents.Add("Boy's 4x400", relayEvent2);

            OverallScore myOverallScore = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gateway"), indEvents, relayEvents);

            if (myOverallScore == null)
            {
                test = false;
                Console.WriteLine("myOverallScore is null");
            }
            if (!myOverallScore.team1.Equals(Tuple.Create("PLM", "Plum", 10.0m)))
            {
                test = false;
                Console.WriteLine("team1 does not have the correct value");
            }
            if (!myOverallScore.team2.Equals(Tuple.Create("GWY", "Gateway", 6.0m)))
            {
                test = false;
                Console.WriteLine("team2 does not have the correct value");
            }
            if (!myOverallScore.indEvents.OrderBy(r => r.Key).SequenceEqual(indEvents.OrderBy(r => r.Key)))
            {
                test = false;
                Console.WriteLine("indEvents does not have the correct value");
            }
            if (!myOverallScore.relayEvents.OrderBy(r => r.Key).SequenceEqual(relayEvents.OrderBy(r => r.Key)))
            {
                test = false;
                Console.WriteLine("relayEvents does not have the correct value");
            }

            Assert.True(test, GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed");
            Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed");
        }
Exemplo n.º 3
0
 public OverallScore AddEvent(OverallScore scores, string eventName, RelayEvent eventToAdd)
 {
     try
     {
         IScoringSvc  scoringSvc = (IScoringSvc)GetService(typeof(IScoringSvc).Name);
         OverallScore os         = scoringSvc.AddEvent(scores, eventName, eventToAdd);
         return(os);
     }
     catch (Exception e) //Implement more specific Exceptions later
     {
         Console.WriteLine(e.ToString());
         Console.Write(e.StackTrace);
         return(null);
     }
 }
Exemplo n.º 4
0
 public OverallScore CalculateTotal(OverallScore scores, string gender)
 {
     try
     {
         IScoringSvc  scoringSvc = (IScoringSvc)GetService(typeof(IScoringSvc).Name);
         OverallScore os         = scoringSvc.CalculateTotal(scores, gender);
         return(os);
     }
     catch (Exception e) //Implement more specific Exceptions later
     {
         Console.WriteLine(e.ToString());
         Console.Write(e.StackTrace);
         return(null);
     }
 }
Exemplo n.º 5
0
 public void CreateMeetResultsPDF(OverallScore scoreToPrint)
 {
     try
     {
         IPrintoutPDFSvc printoutSvc = (IPrintoutPDFSvc)GetService(typeof(IPrintoutPDFSvc).Name);
         bool            didPrint    = printoutSvc.CreateMeetResultsPDF(scoreToPrint);
         if (!didPrint)
         {
             MessageBox.Show("Printout Failed!");
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("Exception in PrintoutMgr: CreateMeetResultsPDF: " + e);
         MessageBox.Show("Printout Failed!");
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Interface for calculating The overall score of a meet
        /// </summary>
        /// <param name="scores">Overall scores</param>
        /// <param name="gender">string to hold what gender the meet is, boy's or girl's</param>
        /// <returns>OverallScore object that holds accurate overall score points</returns>
        public OverallScore CalculateTotal(OverallScore scores, string gender)
        {
            decimal    totalPointsTeam1 = 0;
            decimal    totalPointsTeam2 = 0;
            IndEvent   tempIndEvent     = new IndEvent();
            RelayEvent tempRelayEvent   = new RelayEvent();

            string[] validIndEvents = { "100", "200", "400", "800", "1600",    "3200",   "HH", "300H",
                                        "LJ",  "TJ",  "HJ",  "PV",  "ShotPut", "Discus", "Javelin" };

            for (int i = 0; i < validIndEvents.Length; i++)
            {
                if (scores != null && scores.indEvents != null)
                {
                    scores.indEvents.TryGetValue(gender + "'s " + validIndEvents[i], out tempIndEvent);
                    if (tempIndEvent != null)
                    {
                        totalPointsTeam1 += tempIndEvent.team1Total;
                        totalPointsTeam2 += tempIndEvent.team2Total;
                    }
                }
            }

            //DO THE SAME FOR RELAY EVENTS
            string[] validRelayEvents = { "4x100", "4x400", "4x800" };

            for (int i = 0; i < validRelayEvents.Length; i++)
            {
                if (scores != null && scores.relayEvents != null)
                {
                    scores.relayEvents.TryGetValue(gender + "'s " + validRelayEvents[i], out tempRelayEvent);
                    if (tempRelayEvent != null)
                    {
                        totalPointsTeam1 += tempRelayEvent.team1Total;
                        totalPointsTeam2 += tempRelayEvent.team2Total;
                    }
                }
            }

            scores.team1Points = totalPointsTeam1;
            scores.team2Points = totalPointsTeam2;

            return(scores);
        }
        public void TestCreateMeetResultsDoc()
        {
            IndEvent indEvent1 = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m);
            IndEvent indEvent2 = new IndEvent("PLM", "GWY", new EventPoints(0.0m, 5.0m, "P5", "PLM", "11.2"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 3.0m, 6.0m);
            Dictionary <string, IndEvent> indEvents = new Dictionary <string, IndEvent>();

            indEvents.Add("Boy's 100", indEvent1);
            indEvents.Add("Boy's 200", indEvent2);

            RelayEvent relayEvent1 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "11.3"), new EventPoints(0.0m, 0.0m, "A", "GWY", "11.4"), 5.0m, 0.0m);
            RelayEvent relayEvent2 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "400"), new EventPoints(0.0m, 0.0m, "A", "GWY", "500"), 5.0m, 0.0m);
            Dictionary <string, RelayEvent> relayEvents = new Dictionary <string, RelayEvent>();

            relayEvents.Add("Boy's 4x100", relayEvent1);
            relayEvents.Add("Boy's 4x400", relayEvent2);

            OverallScore myOverallScore = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gateway"), indEvents, relayEvents);

            PrintoutDocXSvcImpl pdxi = new PrintoutDocXSvcImpl();

            pdxi.CreateMeetResultsDoc("Boy's", new DateTime(01, 01, 2000), "Anywhere", myOverallScore);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Implementation for adding a relayEvent to an OverallScore object
        /// </summary>
        /// <param name="scores">Overall scores</param>
        /// <param name="eventName">Name of the event being added</param>
        /// <param name="eventToAdd">Data for the event being added</param>
        /// <returns>OverallScore with the event added</returns>
        public OverallScore AddEvent(OverallScore scores, string eventName, RelayEvent eventToAdd)
        {
            if (scores == null)
            {
                scores = new OverallScore();
            }

            if (scores.relayEvents == null)
            {
                scores.relayEvents = new Dictionary <string, RelayEvent>();
            }

            if (scores.relayEvents != null && scores.relayEvents.ContainsKey(eventName))
            {
                scores.relayEvents[eventName] = eventToAdd;
            }
            else
            {
                scores.relayEvents.Add(eventName, eventToAdd);
            }

            return(scores);
        }
Exemplo n.º 9
0
        public void TestEqualsMethod()
        {
            Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name);
            bool test = true;

            IndEvent indEvent1 = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m);
            IndEvent indEvent2 = new IndEvent("PLM", "GWY", new EventPoints(0.0m, 5.0m, "P5", "PLM", "11.2"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 3.0m, 6.0m);
            IndEvent indEvent3 = new IndEvent("PLM", "GWY", new EventPoints(0.0m, 5.0m, "P7", "PLM", "11.2"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 3.0m, 6.0m);

            Dictionary <string, IndEvent> indEventsA = new Dictionary <string, IndEvent>();

            indEventsA.Add("Boy's 100", indEvent1);
            indEventsA.Add("Boy's 200", indEvent2);

            Dictionary <string, IndEvent> indEventsB = new Dictionary <string, IndEvent>();

            indEventsB.Add("Boy's 100", indEvent1);
            indEventsB.Add("Boy's 200", indEvent3);

            RelayEvent relayEvent1 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "11.3"), new EventPoints(0.0m, 0.0m, "A", "GWY", "11.4"), 5.0m, 0.0m);
            RelayEvent relayEvent2 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "400"), new EventPoints(0.0m, 0.0m, "A", "GWY", "500"), 5.0m, 0.0m);
            RelayEvent relayEvent3 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "450"), new EventPoints(0.0m, 0.0m, "A", "GWY", "500"), 5.0m, 0.0m);

            Dictionary <string, RelayEvent> relayEventsA = new Dictionary <string, RelayEvent>();

            relayEventsA.Add("Boy's 4x100", relayEvent1);
            relayEventsA.Add("Boy's 4x400", relayEvent2);

            Dictionary <string, RelayEvent> relayEventsB = new Dictionary <string, RelayEvent>();

            relayEventsB.Add("Boy's 4x100", relayEvent1);
            relayEventsB.Add("Boy's 4x400", relayEvent3);

            OverallScore control = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gateway"), indEventsA, relayEventsA);

            OverallScore equal           = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gateway"), indEventsA, relayEventsA);
            OverallScore diffTeam1       = new OverallScore(Tuple.Create("PLU", "Plum"), Tuple.Create("GWY", "Gateway"), indEventsA, relayEventsA);
            OverallScore diffTeam2       = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gate HS"), indEventsA, relayEventsA);
            OverallScore diffIndEvents   = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gateway"), indEventsB, relayEventsA);
            OverallScore diffRelayEvents = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gateway"), indEventsA, relayEventsB);

            if (!control.Equals(equal))
            {
                test = false;
                Console.WriteLine("equal was not equal to control");
            }
            if (control.Equals(diffTeam1))
            {
                test = false;
                Console.WriteLine("diffTeam1 was equal to control");
            }
            if (control.Equals(diffTeam2))
            {
                test = false;
                Console.WriteLine("diffTeam2 was equal to control");
            }
            if (control.Equals(diffIndEvents))
            {
                test = false;
                Console.WriteLine("diffIndEvents was equal to control");
            }
            if (control.Equals(diffRelayEvents))
            {
                test = false;
                Console.WriteLine("diffRelayEvents was equal to control");
            }

            Assert.True(test, GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed");
            Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed");
        }
Exemplo n.º 10
0
        public void TestToStringMethod()
        {
            Console.WriteLine("Inside " + GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name);

            IndEvent indEvent1 = new IndEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "P1", "PLM", "11.3"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 8.0m, 1.0m);
            IndEvent indEvent2 = new IndEvent("PLM", "GWY", new EventPoints(0.0m, 5.0m, "P5", "PLM", "11.2"), new EventPoints(3.0m, 0.0m, "P2", "PLM", "11.4"), new EventPoints(0.0m, 1.0m, "G1", "GWY", "11.5"), 3.0m, 6.0m);

            Dictionary <string, IndEvent> indEventsA = new Dictionary <string, IndEvent>();

            indEventsA.Add("Boy's 100", indEvent1);
            indEventsA.Add("Boy's 200", indEvent2);

            RelayEvent relayEvent1 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "11.3"), new EventPoints(0.0m, 0.0m, "A", "GWY", "11.4"), 5.0m, 0.0m);
            RelayEvent relayEvent2 = new RelayEvent("PLM", "GWY", new EventPoints(5.0m, 0.0m, "A", "PLM", "400"), new EventPoints(0.0m, 0.0m, "A", "GWY", "500"), 5.0m, 0.0m);

            Dictionary <string, RelayEvent> relayEventsA = new Dictionary <string, RelayEvent>();

            relayEventsA.Add("Boy's 4x100", relayEvent1);
            relayEventsA.Add("Boy's 4x400", relayEvent2);

            OverallScore myOverallScore = new OverallScore(Tuple.Create("PLM", "Plum"), Tuple.Create("GWY", "Gateway"), indEventsA, relayEventsA, 10.0m, 6.0m);

            string strOverallScore = myOverallScore.ToString();

            Console.WriteLine("My string:" + Environment.NewLine + Environment.NewLine);
            Console.WriteLine(strOverallScore + Environment.NewLine);

            Console.WriteLine("Expecting:" + Environment.NewLine + Environment.NewLine);
            Console.WriteLine("Plum - PLM: 10.0" + Environment.NewLine +
                              "Gateway - GWY: 6.0" + Environment.NewLine + Environment.NewLine +
                              "Boy's 100" + Environment.NewLine +
                              "First Place: P1 - PLM: 11.3" + Environment.NewLine +
                              "First Place Pts: PLM: 5 GWY: 0" + Environment.NewLine +
                              "Second Place: P2 - PLM: 11.4" + Environment.NewLine +
                              "Second Place Pts: PLM: 3 GWY: 0" + Environment.NewLine +
                              "Third Place: G1 - GWY: 11.5" + Environment.NewLine +
                              "Third Place Pts: PLM: 0 GWY: 1" + Environment.NewLine +
                              "Total: PLM: 8 GWY: 1" + Environment.NewLine +
                              "Boy's 200" + Environment.NewLine +
                              "First Place: P5 - PLM: 11.2" + Environment.NewLine +
                              "First Place Pts: PLM: 0 GWY: 5" + Environment.NewLine +
                              "Second Place: P2 - PLM: 11.4" + Environment.NewLine +
                              "Second Place Pts: PLM: 3 GWY: 0" + Environment.NewLine +
                              "Third Place: G1 - GWY: 11.5" + Environment.NewLine +
                              "Third Place Pts: PLM: 0 GWY: 1" + Environment.NewLine +
                              "Total: PLM: 3 GWY: 6" + Environment.NewLine +
                              "Boy's 4x100" + Environment.NewLine +
                              "First Place: A - PLM: 11.3" + Environment.NewLine +
                              "First Place Pts: PLM: 5 GWY: 0" + Environment.NewLine +
                              "Second Place: A - GWY: 11.4" + Environment.NewLine +
                              "Second Place Pts: PLM: 0 GWY: 0" + Environment.NewLine +
                              "Total: PLM: 5 GWY: 0" + Environment.NewLine +
                              "Boy's 4x400" + Environment.NewLine +
                              "First Place: A - PLM: 400" + Environment.NewLine +
                              "First Place Pts: PLM: 5 GWY: 0" + Environment.NewLine +
                              "Second Place: A - GWY: 500" + Environment.NewLine +
                              "Second Place Pts: PLM: 0 GWY: 0" + Environment.NewLine +
                              "Total: PLM: 5 GWY: 0" + Environment.NewLine);

            Assert.AreEqual(strOverallScore, "Plum - PLM: 10.0" + Environment.NewLine +
                            "Gateway - GWY: 6.0" + Environment.NewLine + Environment.NewLine +
                            "Boy's 100" + Environment.NewLine +
                            "First Place: P1 - PLM: 11.3" + Environment.NewLine +
                            "First Place Pts: PLM: 5 GWY: 0" + Environment.NewLine +
                            "Second Place: P2 - PLM: 11.4" + Environment.NewLine +
                            "Second Place Pts: PLM: 3 GWY: 0" + Environment.NewLine +
                            "Third Place: G1 - GWY: 11.5" + Environment.NewLine +
                            "Third Place Pts: PLM: 0 GWY: 1" + Environment.NewLine +
                            "Total: PLM: 8 GWY: 1" + Environment.NewLine +
                            "Boy's 200" + Environment.NewLine +
                            "First Place: P5 - PLM: 11.2" + Environment.NewLine +
                            "First Place Pts: PLM: 0 GWY: 5" + Environment.NewLine +
                            "Second Place: P2 - PLM: 11.4" + Environment.NewLine +
                            "Second Place Pts: PLM: 3 GWY: 0" + Environment.NewLine +
                            "Third Place: G1 - GWY: 11.5" + Environment.NewLine +
                            "Third Place Pts: PLM: 0 GWY: 1" + Environment.NewLine +
                            "Total: PLM: 3 GWY: 6" + Environment.NewLine +
                            "Boy's 4x100" + Environment.NewLine +
                            "First Place: A - PLM: 11.3" + Environment.NewLine +
                            "First Place Pts: PLM: 5 GWY: 0" + Environment.NewLine +
                            "Second Place: A - GWY: 11.4" + Environment.NewLine +
                            "Second Place Pts: PLM: 0 GWY: 0" + Environment.NewLine +
                            "Total: PLM: 5 GWY: 0" + Environment.NewLine +
                            "Boy's 4x400" + Environment.NewLine +
                            "First Place: A - PLM: 400" + Environment.NewLine +
                            "First Place Pts: PLM: 5 GWY: 0" + Environment.NewLine +
                            "Second Place: A - GWY: 500" + Environment.NewLine +
                            "Second Place Pts: PLM: 0 GWY: 0" + Environment.NewLine +
                            "Total: PLM: 5 GWY: 0" + Environment.NewLine,
                            GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Failed");

            Console.WriteLine(GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Passed");
        }
Exemplo n.º 11
0
 public void CreateMeetResultsDoc(string gender, DateTime dt, string location, OverallScore scoreToPrint)
 {
     try
     {
         IPrintoutDocSvc printoutSvc = (IPrintoutDocSvc)GetService(typeof(IPrintoutDocSvc).Name);
         bool            didPrint    = printoutSvc.CreateMeetResultsDoc(gender, dt, location, scoreToPrint);
         if (!didPrint)
         {
             MessageBox.Show("Printout Failed!");
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("Exception in PrintoutMgr: CreateMeetResultsDoc: " + e);
         MessageBox.Show("Printout Failed!");
     }
 }
 /// <summary>
 /// Implementation for creating a PDF for all scoring information for a Meet
 /// </summary>
 /// <param name="scoreToPrint">OverallScore information of the meet to be printed</param>
 /// <returns>boolean that shows whether or not the PDF was created successfully or not</returns>
 public bool CreateMeetResultsPDF(OverallScore scoreToPrint)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 13
0
        public void CreateMeetResultsDoc(string gender, DateTime dt, string location, OverallScore scoreToPrint)
        {
            IPrintoutDocSvc printoutSvc = (IPrintoutDocSvc)GetService(typeof(IPrintoutDocSvc).Name);
            bool            didPrint    = printoutSvc.CreateMeetResultsDoc(gender, dt, location, scoreToPrint);

            if (!didPrint)
            {
            }
            //MessageBox.Show("Printout Failed!");
        }