Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string objIdParam = Request["id"];
                if (!string.IsNullOrEmpty(objIdParam))
                {
                    int objectId = 0;
                    if (int.TryParse(objIdParam, out objectId))
                    {
                        ClubDTOHelper clubDTOHelper = new ClubDTOHelper();
                        try
                        {
                            DataItem = clubDTOHelper.GetFromDB(objectId);
                            if (DataItem.Logo != null)
                            {
                                iClubLogo.ImageUrl = PathHelper.GetMultimediaWebPath(this, DataItem.Logo);
                            }
                        }
                        catch (Exception ex)
                        {
                            //logger
                        }

                        SearchParameters.Match searchParam = new SearchParameters.Match();
                        searchParam.Club_Id = objectId;
                        ml.DataBind(searchParam);

                        using (UaFootball_DBDataContext db = DBManager.GetDB())
                        {
                            IEnumerable <vGamesByPlayerByTeam> playersForClub = db.vGamesByPlayerByTeams.Where(d => d.IsNational == 0 && d.PlayedFor == objectId).OrderByDescending(d => d.TotalMatches).ThenByDescending(d => d.TotalMinutes);
                            rptPlayers.DataSource = playersForClub;
                            rptPlayers.DataBind();
                        }
                    }
                }
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ddlMultimediaSubType.Items.Add(new ListItem(Constants.UI.MutlimediaSubTypes.ClubLogo, Constants.DB.MutlimediaSubTypes.ClubLogo));
                ddlMultimediaSubType.Items.Add(new ListItem(Constants.UI.MutlimediaSubTypes.NationalTeamLogo, Constants.DB.MutlimediaSubTypes.NationalTeamLogo));
                ddlMultimediaSubType.Items.Add(new ListItem(Constants.UI.MutlimediaSubTypes.PlayerLogo, Constants.DB.MutlimediaSubTypes.PlayerLogo));
                ddlMultimediaSubType.Items.Add(new ListItem(Constants.UI.MutlimediaSubTypes.MatchPhoto, Constants.DB.MutlimediaSubTypes.MatchPhoto));
                ddlMultimediaSubType.Items.Add(new ListItem(Constants.UI.MutlimediaSubTypes.MatchVideo, Constants.DB.MutlimediaSubTypes.MatchVideo));

                ddlMultimediaSubType.SelectedIndex = 3;
                ddlMultimediaSubType_SelectedIndexChanged(ddlMultimediaSubType, new EventArgs());

                cbl1.Items.Add(new ListItem(Constants.UI.MultimediaTags.BadQuality, Constants.DB.MultimediaTags.BadQuality.ToString()));
                cbl1.Items.Add(new ListItem(Constants.UI.MultimediaTags.AwayTeamPhoto, Constants.DB.MultimediaTags.AwayTeamPhoto.ToString()));
                cbl1.Items.Add(new ListItem(Constants.UI.MultimediaTags.HomeTeamPhoto, Constants.DB.MultimediaTags.HomeTeamPhoto.ToString()));



                if (!string.IsNullOrEmpty(Request["id"]))
                {
                    int multimediaId = MMId;

                    if (multimediaId > 0)
                    {
                        btnDelete.Visible = true;

                        using (UaFootball_DBDataContext db = DBManager.GetDB())
                        {
                            UaFDatabase.Multimedia mm = db.Multimedias.SingleOrDefault(m => m.Multimedia_ID == multimediaId);
                            if (mm != null)
                            {
                                ddlMultimediaSubType.Enabled       = false;
                                afuUploader.Enabled                = false;
                                hfFileName.Value                   = mm.FileName;
                                ddlMultimediaSubType.SelectedValue = mm.MultimediaSubType_CD;
                                ddlMultimediaSubType_SelectedIndexChanged(ddlMultimediaSubType, new EventArgs());

                                List <MultimediaTag> tags = db.MultimediaTags.Where(m => m.Multimedia_ID == multimediaId).ToList();
                                if (tags.Count > 0)
                                {
                                    List <MultimediaTagDTO> tagsToBind = tags.Select(t => new MultimediaTagDTO {
                                        Club_ID = t.Club_ID, MatchEvent_ID = t.MatchEvent_ID, Match_ID = t.Match_ID, NationalTeam_ID = t.NationalTeam_ID, Player_ID = t.Player_ID, tmpId = t.MultimediaTag_ID, MultimediaTag_ID = t.MultimediaTag_ID
                                    }).ToList();
                                    foreach (MultimediaTagDTO mt in tagsToBind)
                                    {
                                        if (mt.Match_ID.HasValue)
                                        {
                                            mt.Type = _tagTypeGame;
                                            vwMatch match = db.vwMatches.SingleOrDefault(m => m.Match_ID == mt.Match_ID.Value);
                                            mt.Description = UIHelper.FormatMatch(match);
                                        }

                                        if (mt.Player_ID.HasValue)
                                        {
                                            mt.Type = _tagTypePlayer;
                                            PlayerDTO player = new PlayerDTOHelper().GetPlayer(mt.Player_ID.Value);
                                            mt.Description = UIHelper.FormatName(player);
                                        }

                                        if (mt.MatchEvent_ID.HasValue)
                                        {
                                            mt.Type = _tagTypeEvent;
                                            DataLoadOptions opt = new DataLoadOptions();
                                            opt.LoadWith <MatchEvent>(m => m.Player1);
                                            UaFDatabase.MatchEvent mEvent = db.MatchEvents.SingleOrDefault(m => m.MatchEvent_Id == mt.MatchEvent_ID.Value);

                                            mt.Description = string.Format("{0} мин - {1} - {2}", mEvent.Minute, UIHelper.EventCodeMap[mEvent.Event_Cd], FormatName(mEvent.Player.First_Name, mEvent.Player.Last_Name, mEvent.Player.Display_Name, mEvent.Player.Country_Id));
                                        }

                                        if (mt.Club_ID.HasValue)
                                        {
                                            mt.Type = _tagTypeClub;
                                            ClubDTO club = new ClubDTOHelper().GetFromDB(mt.Club_ID.Value);
                                            mt.Description = string.Format("{0} ({1})", club.Club_Name, club.City_Name);
                                        }

                                        if (mt.NationalTeam_ID.HasValue)
                                        {
                                            mt.Type        = _tagTypeNatTeam;
                                            mt.Description = "Украина";
                                        }
                                    }
                                    TagsCache.AddRange(tagsToBind);
                                    rptTags.DataSource = tagsToBind;
                                    rptTags.DataBind();
                                }

                                if (mm.Flags.HasValue)
                                {
                                    if (mm.Flags > 0)
                                    {
                                        foreach (ListItem li in cbl1.Items)
                                        {
                                            if ((long.Parse(li.Value) & mm.Flags.Value) > 0)
                                            {
                                                li.Selected = true;
                                            }
                                        }
                                    }
                                }

                                tbAuthor.Text      = mm.Author;
                                tbSource.Text      = mm.Source;
                                tbDescription.Text = mm.Description;
                                tbPhotoDate.Text   = FormatDate(mm.DateTaken);
                                if (mm.MultimediaType_CD == Constants.DB.MutlimediaTypes.Image)
                                {
                                    imgMultimedia.ImageUrl = PathHelper.GetWebPath(this, Constants.Paths.MutlimediaWebRoot, mm.FilePath, mm.FileName);
                                }
                            }
                        }
                    }
                }
            }
        }