Exemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (Request["countryId"] != null)
            {
                int countryId = 0;
                if (int.TryParse(Request["countryId"], out countryId))
                {
                    using (UaFootball_DBDataContext db = DBManager.GetDB())
                    {
                        List <Match> games      = db.Matches.Where(m => m.NationalTeam.Country_Id == countryId || m.NationalTeam1.Country_Id == countryId).ToList();
                        Repeater     rptMatches = accCountry.Panes["apMatches"].FindControl("rptMatches") as Repeater;
                        rptMatches.DataSource = games;
                        rptMatches.DataBind();

                        List <UaFDatabase.Club> clubs = db.Clubs.Where(c => c.City.Country_ID == countryId).ToList();
                        Repeater rptClubs             = accCountry.Panes["apClubs"].FindControl("rptClubs") as Repeater;
                        rptClubs.DataSource = clubs;
                        rptClubs.DataBind();

                        List <UaFDatabase.Player> players = db.Players.Where(p => p.Country_Id == countryId).OrderBy(p => p.Last_Name).ToList();
                        Repeater rptPlayers = accCountry.Panes["apPlayers"].FindControl("rptPlayers") as Repeater;
                        rptPlayers.DataSource = players;
                        rptPlayers.DataBind();
                    }
                }
            }
        }
Exemplo n.º 2
0
 protected void SetCompetitionStages()
 {
     using (UaFootball_DBDataContext db = DBManager.GetDB())
     {
         BindDropdown(db, Constants.ObjectType.CompetitionStage, ddlStage, true, ddlCompetitions.SelectedValue);
     }
 }
Exemplo n.º 3
0
        public int SaveToDB(ClubDTO dtoObj)
        {
            Club dbObj = new Club();

            using (UaFootball_DBDataContext db = DBManager.GetDB())
            {
                if (dtoObj.Club_ID > 0)
                {
                    dbObj = db.Clubs.Single(cc => cc.Club_ID == dtoObj.Club_ID);
                }
                else
                {
                    db.Clubs.InsertOnSubmit(dbObj);
                }

                CopyDTOToDbObject(dtoObj, dbObj);


                IEnumerable <MultimediaTag> mTagsToDel = db.MultimediaTags.Where(t => t.Club_ID == dtoObj.Club_ID && t.Multimedia.MultimediaSubType_CD == Constants.DB.MutlimediaSubTypes.ClubLogo);
                db.MultimediaTags.DeleteAllOnSubmit(mTagsToDel);


                db.SubmitChanges();

                return(dbObj.Club_ID);
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IsNationalTeam = (Request[Constants.QueryParam.NationalTeam] != null && Request[Constants.QueryParam.NationalTeam].Equals("1"));

            string competitionLevelCode = IsNationalTeam ? Constants.DB.CompetitionLevelCd_NationalTeam : Constants.DB.CompetitionLevelCd_Club;

            if (!IsPostBack)
            {
                using (UaFootball_DBDataContext db = DBManager.GetDB())
                {
                    ddlCompetitions.DataSource     = GetGenericReferenceData(db, Constants.ObjectType.Competition).Where(grd => grd.GenericStringValue.Equals(competitionLevelCode));
                    ddlCompetitions.DataTextField  = "Name";
                    ddlCompetitions.DataValueField = "Value";
                    ddlCompetitions.DataBind();

                    IEnumerable <GenericReferenceObject> seasons = GetGenericReferenceData(db, Constants.ObjectType.Season).Where(grd => grd.GenericStringValue.Equals(competitionLevelCode));
                    ddlSeasons.DataSource     = seasons;
                    ddlSeasons.DataTextField  = "Name";
                    ddlSeasons.DataValueField = "Value";
                    ddlSeasons.DataBind();
                    ddlSeasons.SelectedValue = seasons.FirstOrDefault().Value.ToString();

                    ddlCompetitions.Items.Insert(0, new ListItem(Constants.UI.DropdownDefaultText, Constants.UI.DropdownDefaultValue));
                    ddlSeasons.Items.Insert(0, new ListItem(Constants.UI.DropdownDefaultText, Constants.UI.DropdownDefaultValue));

                    SearchParameters.Match searchParam = new SearchParameters.Match {
                        CompetitionCode = competitionLevelCode, Season_Id = seasons.FirstOrDefault().Value
                    };
                    BindData(searchParam);
                }
            }
        }
Exemplo n.º 5
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int multimediaId = MMId;

            using (UaFootball_DBDataContext db = DBManager.GetDB())
            {
                if (multimediaId > 0)
                {
                    UaFDatabase.Multimedia mm = db.Multimedias.SingleOrDefault(m => m.Multimedia_ID == multimediaId);
                    if (mm != null)
                    {
                        db.MultimediaTags.DeleteAllOnSubmit(db.MultimediaTags.Where(m => m.Multimedia_ID == multimediaId));
                        db.Multimedias.DeleteOnSubmit(mm);

                        string filePath = PathHelper.GetFileSystemPath(Constants.Paths.MultimediaStorageRoot, mm.FilePath, mm.FileName);
                        if (File.Exists(filePath))
                        {
                            File.Delete(filePath);
                        }

                        db.SubmitChanges();
                    }
                }
            }
        }
Exemplo n.º 6
0
        public PlayerDTO GetFromDB(int objectId)
        {
            using (UaFootball_DBDataContext db = DBManager.GetDB())
            {
                var dbData = (from player in db.Players
                              where player.Player_Id == objectId
                              select new { p = player, c = player.Country.Country_Name }).Single();
                PlayerDTO ret = ConvertDBObjectToDTO(dbData.p);
                ret.Country_Name = dbData.c;

                ret.Multimedia = new List <MultimediaDTO>();

                var dbPlayerLogos = from mt in db.MultimediaTags
                                    where mt.Player_ID == objectId && mt.Multimedia.MultimediaSubType_CD == Constants.DB.MutlimediaSubTypes.PlayerLogo
                                    select mt.Multimedia;


                foreach (Multimedia m in dbPlayerLogos)
                {
                    MultimediaDTO playerLogo = MultimediaDTO.FromDBObject(m);
                    playerLogo.IsUploaded = true;
                    ret.Multimedia.Add(playerLogo);
                }


                return(ret);
            }
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AUTOPLAY          = bool.FalseString.ToLower();
            DEFAULT_VIDEO_URL = "";

            List <VideoDTO> videosToPlay = new List <VideoDTO>();
            int             matchId      = 0;
            int             eventId      = 0;

            if (Request["MatchId"] != null)
            {
                if (int.TryParse(Request["MatchId"], out matchId))
                {
                    using (UaFootball_DBDataContext db = DBManager.GetDB())
                    {
                        var mm = from tag in db.MultimediaTags
                                 where tag.Match_ID == matchId && tag.Multimedia.MultimediaSubType_CD == Constants.DB.MutlimediaSubTypes.MatchVideo
                                 select tag.Multimedia;
                        videosToPlay = mm.Select(m => new VideoDTO {
                            Description = m.Multimedia_ID.ToString(), URL = PathHelper.GetFullWebPath("Multimedia", m.FilePath, m.FileName)
                        }).ToList();
                    }
                }
            }
            else
            {
                if (Request["EventId"] != null)
                {
                    if (int.TryParse(Request["EventId"], out eventId))
                    {
                        using (UaFootball_DBDataContext db = DBManager.GetDB())
                        {
                            var mm = from tag in db.MultimediaTags
                                     where tag.MatchEvent_ID == eventId && tag.Multimedia.MultimediaSubType_CD == Constants.DB.MutlimediaSubTypes.MatchVideo
                                     select tag.Multimedia;
                            videosToPlay = mm.Select(m => new VideoDTO {
                                Description = m.Multimedia_ID.ToString(), URL = PathHelper.GetFullWebPath("Multimedia", m.FilePath, m.FileName)
                            }).ToList();
                        }
                    }
                }
            }

            if (eventId > 0)
            {
                if (videosToPlay.Count == 1)
                {
                    AUTOPLAY          = bool.TrueString.ToLower();
                    DEFAULT_VIDEO_URL = videosToPlay[0].URL;
                }
            }
            else
            {
                if (videosToPlay.Count > 0)
                {
                    rptVideoSelection.DataSource = videosToPlay;
                    rptVideoSelection.DataBind();
                }
            }
        }
Exemplo n.º 8
0
        public int SaveToDB(CountryDTO dtoObj)
        {
            Country dbObj = new Country();

            using (UaFootball_DBDataContext db = DBManager.GetDB())
            {
                if (dtoObj.Country_ID > 0)
                {
                    dbObj = db.Countries.Single(cc => cc.Country_ID == dtoObj.Country_ID);
                }
                else
                {
                    db.Countries.InsertOnSubmit(dbObj);
                    NationalTeam newNationalTeam = new NationalTeam {
                        Country = dbObj, NationalTeamType_Cd = Constants.DB.NationalTeamTypeCd_National
                    };
                    NationalTeam newNationalU21Team = new NationalTeam {
                        Country = dbObj, NationalTeamType_Cd = Constants.DB.NationalTeamTypeCd_U21
                    };
                    db.NationalTeams.InsertOnSubmit(newNationalTeam);
                    db.NationalTeams.InsertOnSubmit(newNationalU21Team);
                }

                CopyDTOToDbObject(dtoObj, dbObj);

                db.SubmitChanges();

                return(dbObj.Country_ID);
            }
        }
Exemplo n.º 9
0
        protected override void PrepareUI()
        {
            using (UaFootball_DBDataContext db = DBManager.GetDB())
            {
                BindDropdown(db, Constants.ObjectType.Country, ddlCountries, false, string.Empty);
                for (int i = 1; i < 32; i++)
                {
                    ddlDay.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }

                string[] months = new string[12] {
                    "Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"
                };

                for (int i = 0; i < 12; i++)
                {
                    ddlMonth.Items.Add(new ListItem(months[i], (i + 1).ToString()));
                }

                for (int i = DateTime.Now.Year - 62; i < DateTime.Now.Year - 15; i++)
                {
                    ddlYear.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }

                ddlYear.SelectedValue = (DateTime.Now.Year - 25).ToString();
            }
        }
Exemplo n.º 10
0
 protected override void PrepareUI()
 {
     using (UaFootball_DBDataContext db = DBManager.GetDB())
     {
         BindDropdown(db, Constants.ObjectType.Country, ddlCountries, false, string.Empty);
     }
 }
Exemplo n.º 11
0
 protected override void PrepareUI()
 {
     using (UaFootball_DBDataContext db = DBManager.GetDB())
     {
         BindDropdown(db, Constants.ObjectType.FIFAAssociation, ddlConfedereations, false, string.Empty);
     }
 }
Exemplo n.º 12
0
        public NationalTeamDTO GetFromDB(int objectId)
        {
            using (UaFootball_DBDataContext db = DBManager.GetDB())
            {
                var dbData = (from nationalTeam in db.NationalTeams
                              join country in db.Countries on nationalTeam.Country_Id equals country.Country_ID
                              where nationalTeam.NationalTeam_Id == objectId
                              select new { Team = nationalTeam, CountryName = country.Country_Name }).Single();

                NationalTeamDTO dtoObj = ConvertDBObjectToDTO(dbData.Team);
                dtoObj.Country_Name = dbData.CountryName;

                Multimedia mLogo = (from tag in db.MultimediaTags
                                    where tag.NationalTeam_ID == objectId && tag.Multimedia.MultimediaSubType_CD == Constants.DB.MutlimediaSubTypes.NationalTeamLogo
                                    select tag.Multimedia).FirstOrDefault();

                if (mLogo != null)
                {
                    dtoObj.Logo            = MultimediaDTO.FromDBObject(mLogo);
                    dtoObj.Logo.IsUploaded = true;
                }

                return(dtoObj);
            }
        }
Exemplo n.º 13
0
        public List <MatchDTO> GetListFromDB(SearchParameters.Match searchParam)
        {
            List <MatchDTO> ret = new List <MatchDTO>();

            using (UaFootball_DBDataContext db = DBManager.GetDB())
            {
                var dbData = from matchData in db.vwMatches select matchData;

                if (searchParam.CompetitionCode != null)
                {
                    dbData = dbData.Where(d => d.CompetitionLevel_Cd.Equals(searchParam.CompetitionCode));
                }

                if (searchParam.Competition_Id > 0)
                {
                    dbData = dbData.Where(d => d.Competition_Id == searchParam.Competition_Id);
                }

                if (searchParam.Season_Id > 0)
                {
                    dbData = dbData.Where(d => d.Season_Id == searchParam.Season_Id);
                }

                if (searchParam.Referee_Id > 0)
                {
                    dbData = dbData.Where(d => d.Referee_Id == searchParam.Referee_Id);
                }

                if (searchParam.Stadium_Id > 0)
                {
                    dbData = dbData.Where(d => d.Stadium_Id == searchParam.Stadium_Id);
                }

                if (searchParam.Coach_Id > 0)
                {
                    List <int> lineups = db.MatchLineups.Where(ml => ml.Coach_Id == searchParam.Coach_Id).Select(ml => ml.Match_Id).ToList();
                    dbData = dbData.Where(d => lineups.Contains(d.Match_ID));
                }

                if (searchParam.Club_Id > 0)
                {
                    dbData = dbData.Where(d => d.HomeClub_Id == searchParam.Club_Id || d.AwayClub_Id == searchParam.Club_Id);
                }

                if (searchParam.NationalTeam_Id > 0)
                {
                    dbData = dbData.Where(d => d.HomeNationalTeam_Id == searchParam.NationalTeam_Id || d.AwayNationalTeam_Id == searchParam.NationalTeam_Id);
                }

                dbData = dbData.OrderByDescending(d => d.Date);

                foreach (var md in dbData)
                {
                    ret.Add(ConvertDBObjectToDTO(md));
                }
            }

            return(ret);
        }
Exemplo n.º 14
0
 public CityDTO GetFromDB(int objectId)
 {
     using (UaFootball_DBDataContext db = DBManager.GetDB())
     {
         City c = db.Cities.Single(cc => cc.City_ID == objectId);
         return(ConvertDBObjectToDTO(c));
     }
 }
Exemplo n.º 15
0
 public StadiumDTO GetFromDB(int objectId)
 {
     using (UaFootball_DBDataContext db = DBManager.GetDB())
     {
         Stadium c = db.Stadiums.Single(cc => cc.Stadium_Id == objectId);
         return(ConvertDBObjectToDTO(c));
     }
 }
Exemplo n.º 16
0
        public int SaveToDB(PlayerDTO dtoObj)
        {
            Player dbObj = new Player();

            using (UaFootball_DBDataContext db = DBManager.GetDB())
            {
                if (dtoObj.Player_Id > 0)
                {
                    dbObj = db.Players.Single(cc => cc.Player_Id == dtoObj.Player_Id);
                }
                else
                {
                    db.Players.InsertOnSubmit(dbObj);
                }

                CopyDTOToDbObject(dtoObj, dbObj);

                /*IEnumerable<MultimediaTag> mTagsToDel = db.MultimediaTags.Where(t => t.Player_ID == dtoObj.Player_Id && t.Multimedia.MultimediaSubType_CD == Constants.DB.MutlimediaSubTypes.PlayerLogo);
                 * db.MultimediaTags.DeleteAllOnSubmit(mTagsToDel);
                 *
                 * foreach (MultimediaDTO multimedia in dtoObj.Multimedia)
                 * {
                 *  Multimedia dbMultimedia = new Multimedia();
                 *  multimedia.CopyDTOToDbObject(dbMultimedia);
                 *
                 *  if (!multimedia.IsUploaded)
                 *  {
                 *      string mmRelativePath = PathHelper.GetMultimediaRelativePath(dbMultimedia);
                 *      string dropBoxFilePath = PathHelper.GetFileSystemPath(Constants.Paths.DropBoxPath, mmRelativePath, multimedia.FileName);
                 *
                 *      FileInfo fi = new FileInfo(dropBoxFilePath);
                 *      if (fi.Exists)
                 *      {
                 *          DateTime Now = DateTime.Now;
                 *          string newFileName = string.Format("{0}{1}{2}{3}{4}{5}{6}{7}", Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, Now.Second, Now.Millisecond, fi.Extension);
                 *          string newFilePath = PathHelper.GetFileSystemPath(Constants.Paths.MultimediaStorageRoot, mmRelativePath, multimedia.FileName);
                 *
                 *          File.Copy(dropBoxFilePath, newFilePath);
                 *
                 *          dbMultimedia.FilePath = "";
                 *          dbMultimedia.FileName = newFileName;
                 *      }
                 *  }
                 *
                 *  db.Multimedias.InsertOnSubmit(dbMultimedia);
                 *
                 *  MultimediaTag newTag = new MultimediaTag();
                 *  newTag.Multimedia = dbMultimedia;
                 *  newTag.Player = dbObj;
                 *  db.MultimediaTags.InsertOnSubmit(newTag);
                 *
                 * }*/

                db.SubmitChanges();

                return(dbObj.Player_Id);
            }
        }
Exemplo n.º 17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (UaFootball_DBDataContext db = DBManager.GetDB())
     {
         var allReferees = db.vw_RefereeLists.GroupBy(cl => cl.Country_Name).ToList();
         rptCountries.DataSource = allReferees;
         rptCountries.DataBind();
     }
 }
Exemplo n.º 18
0
        protected void tbObjectId_TextChanged(object sender, EventArgs e)
        {
            TextBox tbId = sender as TextBox;
            int     id   = 0;

            if (int.TryParse(tbId.Text, out id))
            {
                using (UaFootball_DBDataContext db = DBManager.GetDB())
                {
                    switch (ddlTagType.SelectedValue)
                    {
                    case _tagTypeClub:
                    {
                        Club c = db.Clubs.SingleOrDefault(cl => cl.Club_ID == id);
                        if (c != null)
                        {
                            ListItem li = new ListItem();
                            li.Text  = c.Club_Name;
                            li.Value = c.Club_ID.ToString();
                            ddlTagValue.Items.Insert(0, li);
                            ddlTagValue.SelectedIndex = 0;
                        }
                        break;
                    }

                    case _tagTypeGame:
                    {
                        vwMatch match = db.vwMatches.SingleOrDefault(m => m.Match_ID == id);
                        if (match != null)
                        {
                            ListItem li = new ListItem();
                            li.Text  = string.Format("{0} | {1} - {2}", match.Date.ToShortDateString(), match.HomeTeam, match.AwayTeam);
                            li.Value = match.Match_ID.ToString();
                            ddlTagValue.Items.Insert(0, li);
                            ddlTagValue.SelectedIndex = 0;
                        }
                        break;
                    }

                    case _tagTypePlayer:
                    {
                        UaFDatabase.Player p = db.Players.SingleOrDefault(m => m.Player_Id == id);
                        if (p != null)
                        {
                            ListItem li = new ListItem();
                            li.Text  = string.Format("{0} {1}", p.First_Name, p.Last_Name);
                            li.Value = p.Player_Id.ToString();
                            ddlTagValue.Items.Insert(0, li);
                            ddlTagValue.SelectedIndex = 0;
                        }
                        break;
                    }
                    }
                }
            }
        }
Exemplo n.º 19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (UaFootball_DBDataContext db = DBManager.GetDB())
     {
         //var allCoaches = db.vw_CoachesLists.GroupBy(cl => cl.Country_Name).Select(cl=>new {CountryName = cl.Key, Referees = cl}).ToList();
         var allCoaches = db.vw_CoachesLists.GroupBy(cl => cl.Country_Name).ToList();
         var b          = allCoaches.First();
         rptCountries.DataSource = allCoaches;
         rptCountries.DataBind();
     }
 }
Exemplo n.º 20
0
 public CoachDTO GetFromDB(int objectId)
 {
     using (UaFootball_DBDataContext db = DBManager.GetDB())
     {
         var dbData = (from Coach in db.Coaches
                       where Coach.CoachId == objectId
                       select new { p = Coach, c = Coach.Country.Country_Name }).Single();
         CoachDTO ret = ConvertDBObjectToDTO(dbData.p);
         ret.CountryName = dbData.c;
         return(ret);
     }
 }
Exemplo n.º 21
0
 private void DeleteNote(int noteId)
 {
     using (UaFootball_DBDataContext db = DBManager.GetDB())
     {
         MatchNote noteToDelete = db.MatchNotes.SingleOrDefault(mn => mn.MatchNote_Id == noteId);
         if (noteToDelete != null)
         {
             db.MatchNotes.DeleteOnSubmit(noteToDelete);
         }
         db.SubmitChanges();
     }
 }
Exemplo n.º 22
0
 public RefereeDTO GetFromDB(int objectId)
 {
     using (UaFootball_DBDataContext db = DBManager.GetDB())
     {
         var dbData = (from Referee in db.Referees
                       where Referee.Referee_Id == objectId
                       select new { p = Referee, c = Referee.Country.Country_Name }).Single();
         RefereeDTO ret = ConvertDBObjectToDTO(dbData.p);
         ret.CountryName = dbData.c;
         return(ret);
     }
 }
Exemplo n.º 23
0
    protected void cbMatchKind_CheckedChanged(object sender, EventArgs e)
    {
        CheckBox cbMatchKind         = sender as CheckBox;
        bool     isNationalTeamMatch = cbMatchKind.Checked;
        string   competitionFilter   = isNationalTeamMatch ? Constants.DB.CompetitionLevelCd_NationalTeam : Constants.DB.CompetitionLevelCd_Club;

        using (UaFootball_DBDataContext db = new UaFootball_DBDataContext())
        {
            BindDropdown(db, Constants.ObjectType.Competition, ddlCompetitions, true, competitionFilter);
            BindDropdown(db, Constants.ObjectType.Season, ddlSeasons, true, competitionFilter);
        }
    }
Exemplo n.º 24
0
        public List <PlayerDTO> GetFromDB(string query, Constants.QueryType qType, bool uaOnly, bool includeOnReview)
        {
            List <PlayerDTO> players = new List <PlayerDTO>();

            using (UaFootball_DBDataContext db = DBManager.GetDB())
            {
                IQueryable <Player> dbPlayers = null;

                if (qType == Constants.QueryType.StartsWith)
                {
                    dbPlayers = from dbObj in db.Players
                                where dbObj.Last_Name.StartsWith(query)
                                select dbObj;
                }
                else
                if (qType == Constants.QueryType.All)
                {
                    dbPlayers = from dbObj in db.Players select dbObj;
                }

                if (uaOnly)
                {
                    dbPlayers = dbPlayers.Where(o => o.Country.Country_Code == Constants.CountryCodeUA);
                }

                if (!includeOnReview)
                {
                    dbPlayers = dbPlayers.Where(o => (o.RequiresReview == null) || (o.RequiresReview == false));
                }
                else
                {
                    dbPlayers = dbPlayers.Where(o => (o.RequiresReview == true));
                }

                var dbPlayers2 = from dbObj in dbPlayers
                                 orderby dbObj.Last_Name
                                 select new
                {
                    p            = dbObj,
                    Country_Name = dbObj.Country.Country_Name
                };

                foreach (var dbPlayer in dbPlayers2)
                {
                    PlayerDTO player = ConvertDBObjectToDTO(dbPlayer.p);
                    player.Country_Name = dbPlayer.Country_Name;
                    players.Add(player);
                }
            }

            return(players);
        }
Exemplo n.º 25
0
 private int GetCountryId(bool isNationalMatch, int?teamId)
 {
     using (UaFootball_DBDataContext db = DBManager.GetDB())
     {
         if (isNationalMatch)
         {
             return(db.NationalTeams.Single(nt => nt.NationalTeam_Id == teamId.Value).Country.Country_ID);
         }
         else
         {
             return(db.Clubs.Single(c => c.Club_ID == teamId.Value).City.Country_ID);
         }
     }
 }
Exemplo n.º 26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int matchId  = 0;
            int playerId = 0;

            if (Request["MatchId"] != null)
            {
                matchId = int.Parse(Request["MatchId"]);
            }
            if (Request["PlayerId"] != null)
            {
                playerId = int.Parse(Request["PlayerId"]);
            }

            using (UaFootball_DBDataContext db = DBManager.GetDB())
            {
                IQueryable <MatchEvent> events = null;
                if (playerId > 0)
                {
                    //var mm = db.MultimediaTags.Where(mt=>mt.Multimedia.MultimediaType_CD == Constants.DB.MutlimediaTypes.Video && (mt.MatchEvent.Player1_Id == playerId || mt.MatchEvent.Player2_Id == playerId));
                    var mm = (from multimediaTag in db.MultimediaTags
                              join multimedia in db.Multimedias on multimediaTag.Multimedia_ID equals multimedia.Multimedia_ID
                              join matchEvent in db.MatchEvents on multimediaTag.MatchEvent_ID equals matchEvent.MatchEvent_Id
                              join vMatch in db.vwMatches on matchEvent.Match_Id equals vMatch.Match_ID
                              where matchEvent.Player1_Id == playerId || matchEvent.Player2_Id == playerId
                              orderby vMatch.Date descending
                              select new
                    {
                        HomeTeam = vMatch.HomeTeam,
                        AwayTeam = vMatch.AwayTeam,
                        VideoType = matchEvent.Event_Cd == Constants.DB.EventTypeCodes.Penalty ? "Пенальти" : matchEvent.Player1_Id == playerId ? "Гол" : "Пас",
                        Minute = matchEvent.Minute,
                        EventFlags = matchEvent.EventFlags,
                        File = multimedia,
                        EventTypeCode = matchEvent.Event_Cd,
                        MatchDate = vMatch.Date,
                        MatchType = vMatch.CompetitionLevel_Cd
                    }).ToList();


                    foreach (var m in mm)
                    {
                    }


                    rptVideos.DataSource = mm;
                    rptVideos.DataBind();
                }
            }
        }
Exemplo n.º 27
0
        protected void btnSearchByCountry_Click(object sender, EventArgs e)
        {
            int countryId = int.Parse(ddlCountries.SelectedValue);

            using (UaFootball_DBDataContext db = DBManager.GetDB())
            {
                var playersList = from player in db.Players where player.Country_Id == countryId && !(player.RequiresReview ?? false) orderby player.Last_Name_Int, player.Last_Name select player;
                rptSearchPlayers.Visible    = true;
                rptSearchPlayers.DataSource = playersList;
                rptSearchPlayers.DataBind();
                rptDuplicates.Visible    = false;
                rptDuplicates.DataSource = null;
                rptDuplicates.DataBind();
            }
        }
Exemplo n.º 28
0
 public List <CityDTO> GetAllFromDB()
 {
     using (UaFootball_DBDataContext db = DBManager.GetDB())
     {
         IEnumerable <CityDTO> cities = from city in db.Cities
                                        orderby city.Country.Country_Name, city.City_Name
                               select new CityDTO
         {
             City_ID      = city.City_ID,
             City_Name    = city.City_Name,
             Country_ID   = city.Country_ID,
             Country_Name = city.Country.Country_Name
         };
         return(cities.ToList());
     }
 }
Exemplo n.º 29
0
    protected override void PrepareUI()
    {
        bool   isNationalTeamMatch = DataItem.HomeNationalTeam_Id.HasValue;
        string competitionFilter   = isNationalTeamMatch ? Constants.DB.CompetitionLevelCd_NationalTeam : Constants.DB.CompetitionLevelCd_Club;

        using (UaFootball_DBDataContext db = new UaFootball_DBDataContext())
        {
            BindDropdown(db, Constants.ObjectType.Competition, ddlCompetitions, true, competitionFilter);
            BindDropdown(db, Constants.ObjectType.Season, ddlSeasons, true, competitionFilter);
            BindDropdown(db, Constants.ObjectType.Stadium, ddlStadiums, true, string.Empty);
        }

        if (isNewObject)
        {
            tbDate.Text = FormatDate(DateTime.Now);
        }
    }
Exemplo n.º 30
0
 public List <CountryDTO> GetAllFromDB()
 {
     using (UaFootball_DBDataContext db = DBManager.GetDB())
     {
         IEnumerable <CountryDTO> countries = from country in db.Countries
                                              orderby country.FIFAAssociation_ID, country.Country_Name
                                  select new CountryDTO
         {
             Country_ID           = country.Country_ID,
             Country_Name         = country.Country_Name,
             Country_Code         = country.Country_Code,
             FIFAAssociation_ID   = country.FIFAAssociation_ID,
             FIFAAssociation_Name = country.FIFAAssociation.FIFAAssociation_Name
         };
         return(countries.ToList());
     }
 }