Пример #1
0
        public ActionResult DeleteConfirmed(string id)
        {
            SPORT sPORT = db.SPORTs.Find(id);

            db.SPORTs.Remove(sPORT);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "ID,Sport1,Description")] SPORT sPORT)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sPORT).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sPORT));
 }
Пример #3
0
        private List <MatchInfo> getMatchInfoList(SPORT sport)
        {
            List <MatchInfo> infos = new List <MatchInfo>();

            try
            {
                string jsonHorseString = client.GetEventsById(sport == SPORT.Horse ? 241798357140019 : 24735152712200);

                Betburger.Json.Matchbook.JsonResult jsonResult = JsonConvert.DeserializeObject <Betburger.Json.Matchbook.JsonResult>(jsonHorseString);
                if (jsonResult == null || jsonResult.events == null)
                {
                    return(infos);
                }

                foreach (Betburger.Json.Matchbook.JsonEvent jsonEvent in jsonResult.events)
                {
                    if (jsonEvent == null || jsonEvent.markets == null || jsonEvent.markets.Count < 1)
                    {
                        continue;
                    }

                    MatchInfo info = new MatchInfo();
                    info.id     = jsonEvent.id.ToString();
                    info.name   = jsonEvent.name;
                    info.sport  = sport;
                    info.bookie = BOOKIE.Matchbook;

                    foreach (Betburger.Json.Matchbook.JsonRunner jsonRunner in jsonEvent.markets[0].runners)
                    {
                        RunnerInfo runner = new RunnerInfo();
                        runner.id   = jsonRunner.id;
                        runner.name = jsonRunner.name;

                        foreach (Betburger.Json.Matchbook.JsonPrice jsonPrice in jsonRunner.prices)
                        {
                            PriceInfo price = new PriceInfo();
                            price.odds  = jsonPrice.odds;
                            price.stake = jsonPrice.maxStake;
                            price.side  = jsonPrice.side == "back" ? SIDE.Back : SIDE.Lay;

                            runner.prices.Add(price);
                        }

                        info.runners.Add(runner);
                    }

                    infos.Add(info);
                }
            }
            catch (Exception e)
            {
            }

            return(infos);
        }
Пример #4
0
        public ActionResult Create([Bind(Include = "ID,Sport1,Description")] SPORT sPORT)
        {
            if (ModelState.IsValid)
            {
                db.SPORTs.Add(sPORT);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sPORT));
        }
Пример #5
0
 public bool CreateLeagueTeams(Team _teams)
 {
     try
     {
         using (SPORT_LINK_DBDataContext db = new SPORT_LINK_DBDataContext())
         {
             var    query   = from team in db.SPORTs where team.Name.ToLower().Equals(_teams.Name.ToLower()) select team;
             SPORT  teams   = new SPORT();
             LEAGUE leagues = new LEAGUE();
             if (query.Count() != 0)
             {
                 teams = query.Single();
                 var leagueQuery = from league in db.LEAGUEs where league.Name.ToLower().Equals(_teams.LeagueName.ToLower()) select league;
                 if (leagueQuery.Count() != 0)
                 {
                     leagues = leagueQuery.Single();
                     var insertQuery = from team in db.SPORT_LEAGUEs
                                       where team.League_Id.Equals(leagues.League_Id) &&
                                       team.Sport_Id.Equals(teams.Sport_Id)
                                       select team;
                     if (insertQuery.Count() == 0) //Insert to DB
                     {
                         SPORT_LEAGUE toinsert = new SPORT_LEAGUE();
                         toinsert.League_Id   = leagues.League_Id;
                         toinsert.Sport_Id    = teams.Sport_Id;
                         toinsert.LeagueName  = leagues.Name;
                         toinsert.TeamName    = teams.Name;
                         toinsert.TeamAverage = 0;
                         db.SPORT_LEAGUEs.InsertOnSubmit(toinsert);
                         db.SubmitChanges();
                         return(true);
                     }
                     else
                     {
                         return(false);
                     }
                 }
                 else
                 {
                     return(false);
                 }
             }
             else
             {
                 return(false);
             }
         };
     }
     catch (Exception)
     {
         return(false);
     }
 }
Пример #6
0
        // GET: SPORTs/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SPORT sPORT = db.SPORTs.Find(id);

            if (sPORT == null)
            {
                return(HttpNotFound());
            }
            return(View(sPORT));
        }
        public NewPlanStep1ViewModel()
        {
            Categories  = PLANTYPE.GetAllPlanTypes();
            SkillLevels = SKILLLEVEL.GetAllSkillLevel();
            Languages   = LANGUAGE.GetAllLanguages();
            FoodTypes   = FOODTYPE.GetAllFoodTypes();
            Sports      = SPORT.GetAllSports();

            plan = new Plan();

            plan.PlanDate    = DateTime.Now;
            plan.EndPlanDate = DateTime.Now;

            ButtonText = "CREAR PLAN";
        }
Пример #8
0
        private string createBiGSport(string result)
        {
            SPORT  item          = DATA._SPORT.Last();
            string i1            = item.mainImg;
            string sname         = DATA.imageDict[i1];
            string imglistprefix = "data\\sport";

            result = result.Replace("$sportimagelink", imglistprefix + "\\" + item.Id + ".html");
            result = result.Replace("$sportdate", item.date.ToString("yyyy-MM-dd"));

            result = result.Replace("$sportimagesrc", imglistprefix + "\\" + item.Id + "\\" + i1);

            string texts = string.Join("<br> <br>", item.txtContents.ToArray());

            result = result.Replace("$sportDigText", texts);
            return(result);
        }
Пример #9
0
        private CONTENT getContent(String path, string _type)
        {
            CONTENT content = new CONTENT();


            switch (_type)
            {
            case "DOGANDCAT":
                content = new DOGANDCAT();
                break;

            case "FRIENDS":
                content = new FRIENDS();
                break;

            case "SPORT":
                content = new SPORT();
                break;

            case "WORKOUT":
                content = new WORKOUT();
                break;

            case "FOOD":
                content = new FOOD();
                break;

            case "BOOK":
                content = new BOOK();
                break;

            default:
                Console.WriteLine("WRONG TYPE!!!");
                break;
            }

            String[] ll = path.Split(new string[] { "\\" }, StringSplitOptions.None);
            string   si = ll.Last();

            content.Id             = Convert.ToInt32(si);
            content.dataFolderPath = path;
            content.parse();
            return(content);
        }
Пример #10
0
        private void parseJsonEvent(string message, SPORT sport)
        {
            try
            {
                string json = getJsonFromResponse(message);
                if (string.IsNullOrEmpty(json))
                {
                    return;
                }

                JsonEventGroup result = JsonConvert.DeserializeObject <JsonEventGroup>(json);
                if (result == null || result.list == null || result.list.Count < 1)
                {
                    return;
                }

                foreach (JsonEventGroupList groupList in result.list)
                {
                    if (groupList.eve == null)
                    {
                        continue;
                    }

                    // check sports and leagues here
                    if (sport == SPORT.Horse || sport == SPORT.Dog)
                    {
                        TempMatchInfo matchInfo = new TempMatchInfo();
                        matchInfo.id    = groupList.id;
                        matchInfo.sport = sport;
                        matchInfo.name  = groupList.eve.nameTranslations.unpiped;

                        matchInfos.Add(matchInfo);

                        continue;
                    }
                }
            }
            catch (Exception e)
            {
                onWriteLog(string.Format("[{0}]{1} (parseJsonEvent) ---> {2}", DateTime.Now.ToString(), getLogTitle(), e.ToString()));
            }
        }
Пример #11
0
        public int AddTeam(Team _team)
        {
            try
            {
                //
                using (SPORT_LINK_DBDataContext db = new SPORT_LINK_DBDataContext())
                {
                    var query = (from tm in db.SPORTs where tm.UserId.Equals(_team.foreignID) && tm.Name.ToLower().Equals(_team.Name.ToLower()) select tm);
                    if (query.Count() == 0) //AddTeam
                    {
                        SPORT toinsert = new SPORT();
                        toinsert.Type        = _team.Type;
                        toinsert.Name        = _team.Name;
                        toinsert.NumPlayers  = _team.NumPlayers;
                        toinsert.Description = _team.Desc;
                        toinsert.UserId      = _team.foreignID;
                        toinsert.Average     = 0;
                        db.SPORTs.InsertOnSubmit(toinsert);
                        db.SubmitChanges();
                    }
                };

                using (SPORT_LINK_DBDataContext db = new SPORT_LINK_DBDataContext())
                {
                    var queryID = (from tm in db.SPORTs
                                   where tm.Type.Equals(_team.Type) &&
                                   tm.Name.ToLower().Equals(_team.Name.ToLower()) &&
                                   tm.NumPlayers.Equals(_team.NumPlayers) && tm.Description.Equals(_team.Desc)
                                   select tm);
                    SPORT res = queryID.Single();
                    int   ID  = res.Sport_Id;

                    return(ID);
                };
            }
            catch (Exception)
            {
                return(-1);
            }
        }
Пример #12
0
 public string Add_event_sport(SPORT sport)
 {
     return(new Events().Add_event_sport(sport));
 }
Пример #13
0
 public string delete_sport(SPORT sport)
 {
     return(new Events().Delete_Sport(sport));
 }
Пример #14
0
 public SPORT select_sport_event(SPORT sport)
 {
     return(new Events().select_sport_event(sport));
 }
Пример #15
0
 public string Update_Sport(SPORT sport)
 {
     return(new Events().Update_Sport(sport));
 }