Beispiel #1
0
        public ActionResult Details(int id = 0, int?p = 1)
        {
            Jockey jockey = db.Jockeys.Find(id);

            if (jockey == null)
            {
                return(HttpNotFound());
            }
            if (jockey.TwitterId != null)
            {
                var auth   = TwitterUtilities.GetAuthorizer();
                var ctx    = new TwitterContext(auth);
                var tweets =
                    from tweet in ctx.Status
                    where tweet.Type == StatusType.User &&
                    tweet.ScreenName == jockey.TwitterId
                    select tweet;

                if (tweets != null)
                {
                    try
                    {
                        ViewData["Tweets"] = tweets.ToList();
                    }
                    catch
                    {
                        Console.WriteLine("Tweet problem...");
                    }
                }
            }
            int page = p ?? 1;

            ViewBag.Results = db.Results.Include("Race.Meeting.Course").Include("Horse").Where(r => r.Jockey.Id == jockey.Id).OrderByDescending(r => r.Race.OffTime).ToPagedList(page, 50);
            return(View(jockey));
        }
        public static List <Jockey> GetJockeys()
        {
            List <Jockey> ListJockey      = new List <Jockey>();
            ConnexionDb   MaConnectionSql = new ConnexionDb();

            MaConnectionSql.InitializeConnection();
            MaConnectionSql.OpenConnection();
            string stringSql2 = "select * from jockey";

            MaConnectionSql.Cmd.CommandText = stringSql2;
            MaConnectionSql.MonLecteur      = MaConnectionSql.Cmd.ExecuteReader();
            while (MaConnectionSql.MonLecteur.Read())
            {
                // recuperation de valeurs
                int    jockId     = (int)MaConnectionSql.MonLecteur["joc_id"];
                string jockNom    = (string)MaConnectionSql.MonLecteur["joc_nom"];
                string jockPrenom = (string)MaConnectionSql.MonLecteur["joc_prenom"];
                int    jockAge    = (int)MaConnectionSql.MonLecteur["joc_age"];
                string jockCiv    = (string)MaConnectionSql.MonLecteur["joc_civilite"];
                Jockey unJockey   = new Jockey(jockId, jockNom, jockPrenom, jockAge, jockCiv);
                ListJockey.Add(unJockey);
            }
            MaConnectionSql.MonLecteur.Close();
            MaConnectionSql.CloseConnection();
            return(ListJockey);
        }
Beispiel #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Jockey jockey = db.Jockeys.Find(id);

            db.Jockeys.Remove(jockey);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 private static Jockey BuildJockeyForDB(string name)
 {
     if (name == null) name = "NO JOCKEY";
     var jockey = new Jockey()
         {
             JockeyName = name
         };
     return jockey;
 }
Beispiel #5
0
        //
        // GET: /Jockey/Delete/5

        public ActionResult Delete(int id = 0)
        {
            Jockey jockey = db.Jockeys.Find(id);

            if (jockey == null)
            {
                return(HttpNotFound());
            }
            return(View(jockey));
        }
Beispiel #6
0
 public ActionResult Edit(Jockey jockey)
 {
     if (ModelState.IsValid)
     {
         db.Entry(jockey).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(jockey));
 }
Beispiel #7
0
        private static Jockey AddDetails(Jockey jockey)
        {
            Jockey        returnJockey  = new Jockey();
            JockeyService jockeyService = new JockeyService();

            returnJockey           = jockey;
            returnJockey.RealAge   = jockeyService.GetRealAge(returnJockey.DateOfBirth);
            returnJockey.DOBString = returnJockey.DateOfBirth.ToString("dd/MM/yyyy");
            return(returnJockey);
        }
Beispiel #8
0
		public void TextMyMock ()
		{
			Jockey jockey = new Jockey ();
			IDataService mockData = jockey.Mock<IDataService> ();

			Expect.When (mockData)
					.CallsMethod ("returnDexter")
					.ThatItReturns ("CSI");

			Assert.AreEqual ("CSI", mockData.returnDexter ());
		}
Beispiel #9
0
        public ActionResult Create(Jockey jockey)
        {
            if (ModelState.IsValid)
            {
                db.Jockeys.Add(jockey);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(jockey));
        }
        public string GetJockey(int?id)
        {
            string result = string.Empty;

            if (id != null)
            {
                Jockey jockey = SessionService.DbContainer.Resolve <JockeyDataManager>().GetById(id);
                result = jockey == null ? "" : jockey.Fullname;
            }

            return(result);
        }
Beispiel #11
0
        //Cette méthode modifie un utilisateur passé en paramétre dans la BD
        // A VERIFIER ABSOLUMENT (SQL)
        public static int UpdateJockey(Jockey unJockey)
        {
            int nbEnr;
            // connexion à la BD
            SqlConnection MaConnectionSql = ConnexionDb.GetSqlConnexion();
            SqlCommand    Cmd             = MaConnectionSql.CreateCommand();

            Cmd.CommandText = "update jockey set joc_nom = '" + unJockey.Nom + "', joc_prenom = '" + unJockey.Prenom + "', joc_age = " + unJockey.Age + ", joc_civilite = '" + unJockey.Civilite + "'  WHERE joc_id = " + unJockey.Id;
            nbEnr           = Cmd.ExecuteNonQuery();
            ConnexionDb.CloseConnexion();
            return(nbEnr);
        }
Beispiel #12
0
        public static int AjoutJockey(Jockey unJockey)
        {
            int nbEnr;
            // connexion à la BD
            SqlConnection MaConnectionSql = ConnexionDb.GetSqlConnexion();
            SqlCommand    Cmd             = MaConnectionSql.CreateCommand();

            Cmd.CommandText = " insert into jockey (joc_nom, joc_prenom, joc_age, joc_civilite) VALUES ('" + unJockey.Nom + "','" + unJockey.Prenom + "'," + unJockey.Age + ",'" + unJockey.Civilite + "')";
            nbEnr           = Cmd.ExecuteNonQuery();
            ConnexionDb.CloseConnexion();
            return(nbEnr);
        }
        public JockeyWindow(Jockey jockeyToChange)
        {
            if (jockeyToChange == null)
            {
                throw new ArgumentNullException();
            }

            InitializeComponent();
            AssignComboBoxValues();

            oldJockey = jockeyToChange;
            ShowOldContestInformation();
        }
Beispiel #14
0
        private void JockeyGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            Jockey jockey = JockeyGrid.SelectedItem as Jockey;

            if (jockey == null)
            {
                return;
            }
            jockeyWindow           = new JockeyWindow(jockey);
            jockeyWindow.Title     = string.Format("Jockey - Id: {0}, Name: {1}", jockey.Id, jockey.FirstName + " " + jockey.LastName);
            jockeyWindow.OnAdd    += managementSystem.Library.Jockeys.Add;
            jockeyWindow.OnUpdate += managementSystem.Library.Jockeys.Update;
            jockeyWindow.Show();
        }
 private void buttonUpdate_Click(object sender, RoutedEventArgs e)
 {
     if (oldJockey != null)
     {
         if (CheckInformationFields())
         {
             Jockey jockey = GetJockey();
             jockey.Id = oldJockey.Id;
             OnUpdate?.Invoke(jockey, oldJockey.Id);
             MessageBox.Show("Contest was successfully updated in the database.");
             this.Close();
         }
     }
 }
Beispiel #16
0
 public void AddNewJockey(JockeyViewModel model)
 {
     using (var unit = new UnitOfWork())
     {
         var jockey = new Jockey
         {
             Alias      = model.Alias,
             DateBirth  = DateTime.Parse(model.DateBirth),
             FirstName  = model.FirstName,
             LastName   = model.LastName,
             MiddleName = model.MiddleName
         };
         unit.Jockey.Save(jockey);
     }
 }
        //Cette méthode modifie un utilisateur passé en paramétre dans la BD
        // A VERIFIER ABSOLUMENT (SQL)
        public static int UpdateJockey(Jockey unJockey)
        {
            int nbEnr;
            // connexion à la BD
            ConnexionDb MaConnectionSql = new ConnexionDb();

            MaConnectionSql.InitializeConnection();
            MaConnectionSql.OpenConnection();
            string stringSql = "update jockey set joc_nom = '" + unJockey.Nom + "', joc_prenom = '" + unJockey.Prenom + "', joc_age = " + unJockey.Age + ", joc_civilite = '" + unJockey.Civilite + "'  WHERE joc_id = " + unJockey.Id;

            MaConnectionSql.Cmd.CommandText = stringSql;
            nbEnr = MaConnectionSql.Cmd.ExecuteNonQuery();
            MaConnectionSql.CloseConnection();
            return(nbEnr);
        }
    public List <Jockey> InputJockeyCSV(string fileName)
    {
        List <Jockey> JockeyData = new List <Jockey>();
        TextAsset     csvFile    = Resources.Load("CSV/" + fileName) as TextAsset;
        StringReader  reader     = new StringReader(csvFile.text);

        while (reader.Peek() > -1)
        {
            string   line     = reader.ReadLine();
            string[] line_arr = line.Split(','); // リストに入れる
            Jockey   j        = new Jockey();
            j.Name    = line_arr[CSV_CULUMN_NUM_JOCKEY_NAME];
            j.Winrate = float.Parse(line_arr[CSV_CULUMN_NUM_JOCKEY_WINRATE]);
            JockeyData.Add(j);
        }
        return(JockeyData);
    }
        public static int AjoutJockey(Jockey unJockey)
        {
            int nbEnr;
            // connexion à la BD
            ConnexionDb MaConnectionSql = new ConnexionDb();

            MaConnectionSql.InitializeConnection();
            MaConnectionSql.OpenConnection();
            // ok, la ligne suivante en sql fait un peu mal à la tête
            // merci de bien la vérifié au niveau de cheval.ent.id et cheval.pro.Id
            string stringSql = " insert into jockey (joc_nom, joc_prenom, joc_age, joc_civilite) VALUES ('" + unJockey.Nom + "','" + unJockey.Prenom + "'," + unJockey.Age + ",'" + unJockey.Civilite + "')";

            MaConnectionSql.Cmd.CommandText = stringSql;
            nbEnr = MaConnectionSql.Cmd.ExecuteNonQuery();
            MaConnectionSql.CloseConnection();
            return(nbEnr);
        }
Beispiel #20
0
        public IHttpActionResult PostJockey([FromBody] List <Jockey> jockeys)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                List <Jockey> returnJockeys = new List <Jockey>();
                foreach (var jockey in jockeys)
                {
                    Jockey returnJockey = AddDetails(jockey);
                    returnJockeys.Add(returnJockey);
                }
                return(Ok(returnJockeys));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Beispiel #21
0
        // methode qui relie les cables de la DAL avec la BLL
        // C'est VIIIIIINCE qui m'a donné cette méthode. Va falloir la tester (voir CHEVAL DAO création de l'objet cheval a partir de la BDD)
        public static Jockey GetUnJockey(int id)
        {
            Jockey        unJockey        = null;
            SqlConnection MaConnectionSql = ConnexionDb.GetSqlConnexion();
            SqlCommand    Cmd             = MaConnectionSql.CreateCommand();

            Cmd.CommandText = "select * from jockey where joc_id = " + id;
            SqlDataReader MonLecteur = Cmd.ExecuteReader();

            if (MonLecteur.Read())
            {
                int    jockId     = (int)MonLecteur["joc_id"];
                string jockNom    = (string)MonLecteur["joc_nom"];
                string jockPrenom = (string)MonLecteur["joc_prenom"];
                int    jockAge    = (int)MonLecteur["joc_age"];
                string jockCiv    = (string)MonLecteur["joc_civilite"];
                unJockey = new Jockey(jockId, jockNom, jockPrenom, jockAge, jockCiv);
            }

            MonLecteur.Close();
            ConnexionDb.CloseConnexion();
            return(unJockey);
        }
Beispiel #22
0
        public static List <Jockey> GetJockeys()
        {
            List <Jockey> ListJockey      = new List <Jockey>();
            SqlConnection MaConnectionSql = ConnexionDb.GetSqlConnexion();
            SqlCommand    Cmd             = MaConnectionSql.CreateCommand();

            Cmd.CommandText = "select * from jockey";
            SqlDataReader MonLecteur = Cmd.ExecuteReader();

            while (MonLecteur.Read())
            {
                // recuperation de valeurs
                int    jockId     = (int)MonLecteur["joc_id"];
                string jockNom    = (string)MonLecteur["joc_nom"];
                string jockPrenom = (string)MonLecteur["joc_prenom"];
                int    jockAge    = (int)MonLecteur["joc_age"];
                string jockCiv    = (string)MonLecteur["joc_civilite"];
                Jockey unJockey   = new Jockey(jockId, jockNom, jockPrenom, jockAge, jockCiv);
                ListJockey.Add(unJockey);
            }
            MonLecteur.Close();
            ConnexionDb.CloseConnexion();
            return(ListJockey);
        }
        // methode qui relie les cables de la DAL avec la BLL
        // C'est VIIIIIINCE qui m'a donné cette méthode. Va falloir la tester (voir CHEVAL DAO création de l'objet cheval a partir de la BDD)
        public static Jockey GetUnJockey(int id)
        {
            Jockey      unJockey        = null;
            ConnexionDb MaConnectionSql = new ConnexionDb();

            MaConnectionSql.InitializeConnection();
            MaConnectionSql.OpenConnection();
            string stringSql = "select * from jockey where joc_id = " + id;

            MaConnectionSql.Cmd.CommandText = stringSql;
            MaConnectionSql.MonLecteur      = MaConnectionSql.Cmd.ExecuteReader();
            if (MaConnectionSql.MonLecteur.Read())
            {
                int    jockId     = (int)MaConnectionSql.MonLecteur["joc_id"];
                string jockNom    = (string)MaConnectionSql.MonLecteur["joc_nom"];
                string jockPrenom = (string)MaConnectionSql.MonLecteur["joc_prenom"];
                int    jockAge    = (int)MaConnectionSql.MonLecteur["joc_age"];
                string jockCiv    = (string)MaConnectionSql.MonLecteur["joc_civilite"];
                unJockey = new Jockey(jockId, jockNom, jockPrenom, jockAge, jockCiv);
            }

            MaConnectionSql.CloseConnection();
            return(unJockey);
        }
Beispiel #24
0
		public void TextMyMockEvent ()
		{
			Jockey jockey = new Jockey ();
			IEventsTest myMockEvents = jockey.Mock<IEventsTest> ();
			myMockEvents.TestEvent += MySubscriber;

			Expect.When (myMockEvents)
				.CallsMethod ("ExecuteWithSideEffect")
				.ThatItRaises ("TestEvent", myMockEvents, new EventArgs ());

			myMockEvents.ExecuteWithSideEffect ();
			Assert.IsTrue (eventFlag);


			Jockey myJockey = new Jockey ();
			IDataService myMockService = myJockey.Mock<IDataService> ();

			Expect.When (myMockService)
					.CallsProperty ("Name")
					.ThatItReturns ("My Product Name");

			Assert.IsNotNull (myMockService);
			Assert.AreEqual ("My Product Name", myMockService.Name);
		}
Beispiel #25
0
        public void DownloadData(string url)
        {
            string              MAIN_URL = url;
            HtmlDocument        doc;
            Task <HtmlDocument> tsk = GetData(MAIN_URL);

            doc = tsk.Result;
            Link lnk = new Link();

            lnk.URL = (MAIN_URL);


            HtmlNode node = doc.GetElementbyId("racecard");

            string courseandDate = node.ChildNodes[1].InnerText;


            DateTime raceDate;
            string   raceLocation = "";

            if (courseandDate.Contains('-'))
            {
                raceLocation = courseandDate.Split('-').ElementAt(0).Split(',').ElementAt(0);
                var dateStr = courseandDate.Split('-').ElementAt(1).Split(',').ElementAt(1);
                raceDate = DateTime.Parse(dateStr);
            }
            else
            {
                raceLocation = courseandDate.Split(',').ElementAt(0);
                int tempLen = courseandDate.Split(',').Count();
                raceDate = DateTime.Parse(courseandDate.Split(',').ElementAt(tempLen - 1));
            }


            var allRace    = node.ChildNodes[5].ChildNodes.Where(m => m.OriginalName.Equals("li"));
            int totalRaces = allRace.Count();

            if (totalRaces > 0)
            {
                using (var conn = new RaceContext())
                {
                    conn.Links.Add(lnk);
                    //conn.SaveChanges();
                    lnk.Races = new List <Race>();
                    var tempcontentsRaces = node.ChildNodes[7].ChildNodes[3].ChildNodes[1];
                    var contentsRaces     = tempcontentsRaces.ChildNodes.Where(m => m.Name == "div");

                    List <Race> races = new List <Race>();

                    foreach (var item in contentsRaces)
                    {
                        Race race = new Race();
                        race.Date     = raceDate;
                        race.Location = raceLocation;

                        var itemcontentsRace        = item.ChildNodes.Where(m => m.Attributes.Contains("class") && m.Attributes["class"].Value.Contains("raceDetails")).SingleOrDefault();
                        var itemcontentsRaceRunners = item.ChildNodes.Where(m => m.Attributes.Contains("class") && m.Attributes["class"].Value.Contains("cardFields")).SingleOrDefault();

                        var detailsInfo = itemcontentsRace.ChildNodes.Where(m => m.Attributes.Contains("class") && m.Attributes["class"].Value.Contains("detailInfo")).SingleOrDefault();

                        race.Title = detailsInfo.ChildNodes[1].InnerText;
                        var tempTime = detailsInfo.ChildNodes[3].ChildNodes[1].InnerText;
                        race.Time = race.Date;
                        if (!tempTime.Equals(" : : : "))
                        {
                            race.Time = race.Time.AddHours(double.Parse(tempTime.Split(':')[0]));
                            race.Time = race.Time.AddMinutes(double.Parse(tempTime.Split(':')[1]));
                        }

                        var typeandclass = detailsInfo.ChildNodes[3].ChildNodes[3].InnerText;
                        race.Class       = typeandclass.Split('-')[1];
                        race.Type        = typeandclass.Split('-')[0];
                        race.TrackLength = detailsInfo.ChildNodes[3].ChildNodes[5].InnerText.Split('M')[0] + "M";
                        race.TrackType   = detailsInfo.ChildNodes[3].ChildNodes[5].InnerText.Split('M')[1];

                        var winningPriceCurrency = detailsInfo.ChildNodes[3].ChildNodes[7].InnerText.Split(' ');
                        race.WinningCurrency = winningPriceCurrency.ElementAt(1);

                        string temprice = winningPriceCurrency.ElementAt(19).ToString().Replace(",", "");
                        race.WinningPrice = long.Parse(temprice);

                        var railSafety = detailsInfo.ChildNodes.Where(m => m.Attributes.Contains("class") && m.Attributes["class"].Value.Contains("railSafety")).SingleOrDefault();
                        race.Weather = railSafety.ChildNodes[1].ChildNodes[2].ChildNodes[0].InnerText;

                        race.TrackCondition = railSafety.ChildNodes[3].ChildNodes[2].ChildNodes.Count > 0 ? railSafety.ChildNodes[3].ChildNodes[2].ChildNodes[0].InnerText : "";

                        race.RailPosition = railSafety.ChildNodes[7].ChildNodes[2].ChildNodes.Count > 0 ? railSafety.ChildNodes[7].ChildNodes[2].ChildNodes[0].InnerText : "";

                        race.SafetyLimit = railSafety.ChildNodes[9].ChildNodes[2].ChildNodes.Count > 0 ? railSafety.ChildNodes[9].ChildNodes[2].ChildNodes[0].InnerText : "";

                        var finishTime = detailsInfo.ChildNodes.Where(m => m.Attributes.Contains("class") && m.Attributes["class"].Value.Contains("finishTime")).SingleOrDefault();
                        //finishTime.InnerText.Substring(finishTime.InnerText.IndexOf(@" " "))
                        Regex reg = new Regex("[0-9]{2}:[0-9]{2}:[0-9]{2}");
                        Match mch = reg.Match(finishTime.InnerText);
                        race.RunningTime = mch.Value;

                        //getting null string <span>(Hand Timed)</span> = <span></span>
                        reg = new Regex("[(].*[)]");
                        mch = reg.Match(finishTime.InnerHtml);
                        race.RunningTimeType = mch.Value;
                        //race.RunningTimeType = "Test";
                        var fullConditions = itemcontentsRace.ChildNodes.Where(m => m.Attributes.Contains("class") && m.Attributes["class"].Value.Contains("fullConditions")).SingleOrDefault();
                        var prizeBreak     = fullConditions.ChildNodes.Where(m => m.Attributes.Contains("class") && m.Attributes["class"].Value.Contains("prizeBreak")).SingleOrDefault();


                        var prizeTable = prizeBreak.ChildNodes.Where(m => m.Name == "table").SingleOrDefault();


                        var prizeTableTr = prizeTable.ChildNodes.Where(m => m.Name == "tr");
                        List <WinningPrice> allPrizes  = new List <WinningPrice>();
                        List <Runner>       allRunners = new List <Runner>();

                        int[] pricePosition = { 1, 4, 2, 5, 3, 7 };
                        int   tmp           = 0;

                        foreach (var bodyRow in prizeTableTr)
                        {
                            WinningPrice prize  = new WinningPrice();
                            WinningPrice prize2 = new WinningPrice();

                            var tablePrizestd = bodyRow.ChildNodes.Where(m => m.Name == "td");
                            prize.Position = pricePosition[tmp];
                            prize.Price    = long.Parse(tablePrizestd.ElementAt(1).InnerHtml.Replace(",", ""));
                            prize.Race     = race;
                            conn.WinningPrizes.Add(prize);
                            tmp = tmp + 1;

                            prize2.Position = pricePosition[tmp];
                            prize2.Price    = long.Parse(tablePrizestd.ElementAt(4).InnerHtml.Replace(",", ""));
                            prize2.Race     = race;

                            allPrizes.Add(prize);
                            allPrizes.Add(prize2);
                            tmp = tmp + 1;
                            conn.WinningPrizes.Add(prize2);
                        }
                        var detailedConditions = fullConditions.ChildNodes.Where(m => m.Attributes.Contains("class") && m.Attributes["class"].Value.Contains("detailedConditions")).SingleOrDefault();
                        race.Notes = detailedConditions.InnerText;

                        race.WinningPrices = allPrizes;
                        conn.Races.Add(race);

                        lnk.Races.Add(race);
                        //conn.SaveChanges();



                        var resultsTable     = itemcontentsRaceRunners.ChildNodes.Where(m => m.Attributes.Contains("class") && m.Attributes["class"].Value.Contains("entriesTable resultsTable")).SingleOrDefault();
                        var resultsTableRows = resultsTable.ChildNodes.Where(m => m.Name == "tbody").SingleOrDefault().ChildNodes.Where(m => m.Name == "tr");
                        race.Runners = new List <Runner>();
                        foreach (var runnerRow in resultsTableRows)
                        {
                            Runner tempRunner = new Runner();
                            tempRunner.Name = runnerRow.Attributes["owner"].Value;
                            var tempRunnerCols       = runnerRow.ChildNodes.Where(m => m.Name == "td");
                            var tempPositionValidate = tempRunnerCols.ElementAt(0).InnerText;

                            var tmpPosition = (tempPositionValidate.Contains("nd") ? tempPositionValidate.Replace("nd", "") : tempPositionValidate.Contains("st") ? tempPositionValidate.Replace("st", "") : tempPositionValidate.Contains("th") ? tempPositionValidate.Replace("th", "") : tempPositionValidate.Contains("rd") ? tempPositionValidate.Replace("rd", "") : tempPositionValidate);
                            tempRunner.Position = tmpPosition;
                            tempRunner.Margin   = tempRunnerCols.ElementAt(1).InnerText.ToString();
                            tempRunner.Drawn    = !string.IsNullOrEmpty(tempRunnerCols.ElementAt(2).InnerText) ? int.Parse(tempRunnerCols.ElementAt(2).InnerText) : 0;
                            tempRunner.OR       = tempRunnerCols.ElementAt(3).InnerText;
                            //tempRunner. Horse

                            string horseUrl = "http:/" + tempRunnerCols.ElementAt(4).ChildNodes.Where(m => m.Name == "a").SingleOrDefault().Attributes["href"].Value;

                            Horse tempHorse = new Horse()
                            {
                                URL  = horseUrl,
                                Name = tempRunnerCols.ElementAt(4).ChildNodes.Where(m => m.Name == "a").SingleOrDefault().InnerText,
                            };

                            conn.Horses.Add(tempHorse);
                            tempHorse.Runners = new List <Runner>();
                            tempHorse.Runners.Add(tempRunner);
                            tempRunner.Equipment = tempRunnerCols.ElementAt(6).InnerText;

                            string  trainerURl  = "http:/" + tempRunnerCols.ElementAt(7).ChildNodes.Where(m => m.Name == "a").SingleOrDefault().Attributes["href"].Value;
                            Trainer tempTrainer = new Trainer()
                            {
                                Name = tempRunnerCols.ElementAt(7).ChildNodes.Where(m => m.Name == "a").SingleOrDefault().InnerText,
                                URL  = trainerURl
                            };
                            tempTrainer.Runners = new List <Runner>();
                            tempTrainer.Runners.Add(tempRunner);
                            conn.Trainers.Add(tempTrainer);

                            string jockeyUrl  = "http:/" + tempRunnerCols.ElementAt(8).ChildNodes.Where(m => m.Name == "a").SingleOrDefault().Attributes["href"].Value;
                            Jockey tempJockey = new Jockey()
                            {
                                URL    = jockeyUrl,
                                Name   = tempRunnerCols.ElementAt(8).ChildNodes.Where(m => m.Name == "a").SingleOrDefault().InnerText,
                                Weight = decimal.Parse(tempRunnerCols.ElementAt(5).InnerText)
                            };

                            tempJockey.Runners = new List <Runner>();
                            tempJockey.Runners.Add(tempRunner);
                            conn.Jockeys.Add(tempJockey);
                            tempRunner.Race = race;
                            race.Runners.Add(tempRunner);

                            conn.Runners.Add(tempRunner);
                        }



                        conn.SaveChanges();
                    }
                }
            }
        }
Beispiel #26
0
 public void Save(Jockey jockey)
 {
     jockey.IsActive = true;
     save(jockey);
 }
Beispiel #27
0
 public void Delete(Jockey jockey)
 {
     jockey.IsActive = false;
     save(jockey);
 }
Beispiel #28
0
        public static int ModifierJockey(string nom, string prenom, int age, string civilite)
        {
            Jockey jo = new Jockey(nom, prenom, age, civilite);

            return(JockeyDAO.UpdateJockey(jo));
        }
Beispiel #29
0
        public static int CreerJockey(string nom, string prenom, int age, string civilite)
        {
            Jockey jo = new Jockey(nom, prenom, age, civilite);

            return(JockeyDAO.AjoutJockey(jo));
        }