Ejemplo n.º 1
0
 protected void FavoriteAdsImageButton_Click(object sender, EventArgs e)
 {
     if (Member.IsLogged)
     {
         if (FavoriteAd.IsFavorite(Member.CurrentId, Object.Id, FavoriteAdType.PTC))
         {
             FavoriteAd.RemoveFromFavorites(Member.CurrentId, Object.Id, FavoriteAdType.PTC);
             favoriteImg.Visible  = false;
             favoriteImg2.Visible = false;
         }
         else
         {
             FavoriteAd.AddToFavorites(Member.CurrentId, Object.Id, FavoriteAdType.PTC);
             favoriteImg.Visible  = true;
             favoriteImg2.Visible = true;
         }
     }
 }
Ejemplo n.º 2
0
    public override void DataBind()
    {
        base.DataBind();

        if (Member.IsLogged)
        {
            Member user = Member.CurrentInCache;

            UserEarnedMoney   = PtcAdvert.CalculateNormalMemberEarnings(user, Object);
            EarningsDR        = PtcAdvert.CalculateEarningsFromDirectReferral(user, Object);
            EarningsRR        = PtcAdvert.CalculateEarningsFromRentedReferral(user, Object);
            EarningsPoints    = user.Membership.AdvertPointsEarnings;
            EarningsAdCredits = user.Membership.PTCCreditsPerView;
        }
        else
        {
            //Public ad view
            UserEarnedMoney   = PtcAdvert.CalculateNormalMemberEarnings(Membership.Standard, Object);
            EarningsDR        = PtcAdvert.CalculateEarningsFromDirectReferral(Membership.Standard, Object);
            EarningsRR        = PtcAdvert.CalculateEarningsFromRentedReferral(Membership.Standard, Object);
            EarningsPoints    = Membership.Standard.AdvertPointsEarnings;
            EarningsAdCredits = Membership.Standard.PTCCreditsPerView;
        }

        //Display PTC Advert Type
        if (AppSettings.PtcAdverts.CashLinkViewEnabled == AppSettings.PTCViewMode.PTC)
        {
            //Starred Ads
            if (Object.IsStarredAd)
            {
                starImg.Visible  = true;
                starImg2.Visible = true;
            }
            else
            {
                starImg.Visible  = false;
                starImg2.Visible = false;
            }

            //Favorite Ads
            if (AppSettings.PtcAdverts.FavoriteAdsEnabled && Member.IsLogged &&
                FavoriteAd.IsFavorite(Member.CurrentId, Object.Id, FavoriteAdType.PTC))
            {
                favoriteImg.Visible  = true;
                favoriteImg2.Visible = true;
                FavoriteCssClass     = " fav";
            }
            else
            {
                favoriteImg.Visible  = false;
                favoriteImg2.Visible = false;
            }

            if (IsActive)
            {
                ActiveAdvertPlaceHolder.Visible = true;
            }
            else
            {
                InactiveAdvertPlaceHolder.Visible = true;
            }

            if (ImageUrl != null)
            {
                //    PtcImage.ImageUrl = PtcImage2.ImageUrl = ImageUrl;
                ImageBackgroundStyle = "background: url(" + ResolveUrl(ImageUrl) + ");";
            }


            if (AppSettings.PtcAdverts.PTCImagesEnabled)
            {
                ImageClass = "has-image";
            }
            else
            {
                ImageClass = "";
            }

            CashLinkPlaceHolder.Visible = false;
        }
        //Display Cash Links Advert Type
        else if (AppSettings.PtcAdverts.CashLinkViewEnabled == AppSettings.PTCViewMode.CashLink)
        {
            ActiveAdvertPlaceHolder.Visible   = false;
            InactiveAdvertPlaceHolder.Visible = false;
            if (IsActive)
            {
                CashLinkPlaceHolder.Visible = true;
            }
            else
            {
                CashLinkPlaceHolderInActive.Visible = true;
            }

            if (IsPreview) //Preview fix
            {
                CashLinkDiv.Attributes["class"] = "Abox CashLinkBox";
            }
        }
    }