예제 #1
0
 internal AdShape(JournalPresentation owner, Shape shape, JournalAd row)
 {
     Presentation = owner;
     Shape = shape;
     Row = row;
     adType = Names.AdTypes.First(t => t.Name == row.AdType);
 }
예제 #2
0
파일: Ads.cs 프로젝트: mono/gert
		public static int InsertAd(int memberId, int categoryId, string title, string description, string url, decimal price, string location, int numDaysActive, AdLevel adLevel, AdStatus adStatus, AdType adType)
		{
			SiteSettings s = SiteSettings.GetSharedSettings();

			int numViews = 0, numResponses = 0;
			DateTime dateCreated = DateTime.Now;
			DateTime? dateApproved = null;

			if (numDaysActive > s.MaxAdRunningDays)
				numDaysActive = s.MaxAdRunningDays;

			if (numDaysActive < 1)
				numDaysActive = 1;

			DateTime expirationDate = DateTime.Today.AddDays(numDaysActive);

			if (s.AdActivationRequired)
			{
				adStatus = AdStatus.ActivationPending;
				dateApproved = null;
			}
			else
			{
				adStatus = AdStatus.Activated;
				dateApproved = dateCreated;
			}

			if (adLevel == AdLevel.Unspecified)
				adLevel = AdLevel.Normal;

			int adId = DefaultValues.IdNullValue;
			AdsDataComponent.AdsRow ad = null;

			return adId;
		}
예제 #3
0
 public AdProbability(AdType adType, int probability, string appID, string secondaryID, bool isTest)
 {
     AdType = adType;
     ProbabilityValue = probability;
     AppID = appID;
     SecondaryID = secondaryID;
     IsTest = IsTest;
 }
예제 #4
0
 public InterstitialAd(
     string appId, string adUnitId, AdType type, Action<object> readyCallback, Action<object> completedCallback,
     Action<object> cancelledCallback,
     Action<object> errorCallback)
     : this()
 {
     this.readyCallback = readyCallback;
     this.completedCallback = completedCallback;
     this.errorCallback = errorCallback;
     this.cancelledCallback = cancelledCallback;
 }
예제 #5
0
		public static string AdTypeToString(AdType adType)
		{
			switch (adType)
			{
				case AdType.ForSale:
					return "For Sale";
				case AdType.Wanted:
					return "Wanted";
				default:
					return "(other)";
			}
		}
예제 #6
0
 private void InitializeComponent()
 {
     this.SaveSearchCondition.Click += new EventHandler(this.SaveSearchCondition_Click);
     AdType thetype = new AdType();
     typeid.Items.Clear();
     typeid.Items.Add(new ListItem("全部", "0"));
     foreach (string atname in Enum.GetNames(thetype.GetType()))
     {
         string thetext = EnumCatch.GetADTpyeName(Convert.ToInt16(Enum.Parse(thetype.GetType(), atname)));
         string thevalue = Convert.ToInt16(Enum.Parse(thetype.GetType(), atname)).ToString();
         typeid.Items.Add(new ListItem(thetext, thevalue.ToString()));
     }
 }
예제 #7
0
        public static AdPod CreateAd(AdType type)
        {
            ImageResult i;
            switch (type)
            {
                case AdType.Normal:
                    i = new ImageResult("lala", 300, 250);
                    //return new AdPod(i, "10054695");
                    return new AdPod(i, "10043055");

                case AdType.Snapped:
                    i = new ImageResult("", 292, 60);
                    return new AdPod(i, "10050472");
            }

            return null;
        }
예제 #8
0
        /// <summary>
        /// 根据参数生成查询字符串
        /// </summary>
        /// <param name="pagename">页面名称</param>
        /// <param name="fid">版块id</param>
        /// <param name="adtype">广告类型</param>
        /// <returns>查询字符串</returns>
        public static string GetSelectStr(string pagename, int fid, AdType adtype)
        {
            string typestr = Convert.ToInt16(adtype).ToString();

            string selectstr = "";

            if(!Utils.StrIsNullOrEmpty(pagename) && pagename=="indexad")
                selectstr = ",首页,";
            else
            {
                if (fid > 0)
                    selectstr += "," + fid + ",";
            }

            if (selectstr == "")
                selectstr = "type='" + typestr + "'  AND [targets] Like '%全部%'";
            else
                selectstr = "type='" + typestr + "'  AND ([targets] Like '%" + selectstr + "%' OR [targets] Like '%全部%')";

            return selectstr;
        }
예제 #9
0
 private string GetSecondaryID(AdType adType)
 {
     return CurrentCulture.AdProbabilities
             .Where(x => x.AdType == adType)
             .First().SecondaryID;
 }
예제 #10
0
 public AdBannerView(AdType type)
 {
     ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("initWithAdType:"), (int)type);
     ObjC.MessageSend(Handle, Selector.GetHandle("setDelegate:"), Handle);
 }
예제 #11
0
 /// <summary>
 /// Called when <paramref name="adType"/> has failed to load
 /// </summary>
 /// <param name="adType"></param>
 private void OnAdLoadFailed(AdType adType)
 {
     OnLog(string.Format("Ads failed request for: {0}", adType.ToString()));
     if (!_failedAdTypes.Contains(adType))
     {
         _failedAdTypes.Add(adType);
     }
     Invalidate();
 }
예제 #12
0
        private void InitializeComponent()
        {
            this.type.SelectedIndexChanged += new EventHandler(this.type_SelectedIndexChanged);
            this.AddAdInfo.Click += new EventHandler(this.AddAdInfo_Click);

            #region 控件数据绑定

            starttime.SelectedDate = DateTime.Now;
            endtime.SelectedDate = DateTime.Now.AddDays(7);

            title.AddAttributes("maxlength", "40");
            title.AddAttributes("size", "40");

            //加载树
             AdType thetype = new AdType();
            //加载树
            type.Items.Clear();
            foreach (string tts in Enum.GetNames(thetype.GetType()))
            {
                string thetext = EnumCatch.GetADTpyeName(Convert.ToInt16(Enum.Parse(thetype.GetType(), tts)));
                string thevalue = Convert.ToInt16(Enum.Parse(thetype.GetType(), tts)).ToString();
                type.Items.Add(new ListItem(thetext, thevalue));
            }
            type.Attributes.Add("onChange", "showadhint();");
            type.SelectedIndex = 0;

            parameters.Items.Clear();
            parameters.Items.Add(new ListItem("代码", "htmlcode"));
            parameters.Items.Add(new ListItem("文字", "word"));
            parameters.Items.Add(new ListItem("图片", "image"));
            parameters.Items.Add(new ListItem("flash", "flash"));
            parameters.Attributes.Add("onChange", "showparameters();");
            parameters.SelectedIndex = 0;

            #endregion
        }
예제 #13
0
 private void RemoveAdFromFailedAds(AdType adType)
 {
     if(_failedAdTypes.Contains(adType))
     {
         _failedAdTypes.Remove(adType);
     }
 }
예제 #14
0
        private string ReturnAdID(List <AdIdsPerPlatform> adIdsPerPlatform, Platforms platform, AdType adtype)
        {
            string id = "";

            for (int i = 0; i < adIdsPerPlatform.Count; i++)
            {
                if (adIdsPerPlatform[i]._Platform.Equals(platform))
                {
                    if (adIdsPerPlatform[i]._AdType.Equals(adtype))
                    {
                        id = adIdsPerPlatform[i]._AdID;
                    }
                }
            }

            return(id);
        }
예제 #15
0
        ///<summary>Checks whether the user wants to adjust pledge amounts.</summary>
        bool CheckAdjustPledges(string actionName, AdType newType = null, IList<Pledge> newPledges = null)
        {
            var oldType = ad.AdType;
            var oldPledges = pledges.Rows;
            if (oldPledges.Count == 0) return true;		//If there weren't any pledges, there's nothing to do.

            newType = newType ?? ad.AdType;
            newPledges = newPledges ?? (IList<Pledge>)pledges.Rows;

            //If there are pledges, try adjusting the amounts
            if (newPledges.Count > 0) {
                //If there is a payment, we assume that it
                //has the correct amount and don't adjust
                //anything.  If the pledge amounts aren't
                //equal, we assume that something strange
                //is being billed, and don't adjust them.
                if (payments.Rows.Any()
                 || oldPledges.Any(p => Math.Abs(p.Amount - oldPledges[0].Amount) > 1)		//Allow off-by-one, in case it came from an indivisible pledge count
                 || oldPledges.Sum(p => p.Amount) != oldType.DefaultPrice) {
                    ShowColumnTooltip(colPledgeAmount, new ToolTipControllerShowEventArgs {
                        Rounded = true,
                        ShowBeak = true,
                        IconType = ToolTipIconType.Information,
                        ToolTipType = ToolTipType.Standard,
                        Title = actionName,
                        ToolTip = "You probably want to adjust the pledge amounts.",
                    });
                } else {
                    decimal newAmount = newType.DefaultPrice / newPledges.Count;
                    int baseAmount = (int)newAmount;	//Truncate
                    int higherAdCount = 0;		//The number of ads which should receive $(baseAmount + 1) pledges to add up correctly
                    string message;
                    if (newAmount == baseAmount)
                        message = String.Format(
                            CultureInfo.CurrentCulture,
                            "Would you like to change each pledge to {0:c} to match a {1}?",
                            baseAmount, newType.PledgeSubType.ToLowerInvariant()
                        );
                    else {
                        higherAdCount = (int)newType.DefaultPrice - (baseAmount * newPledges.Count);

                        if (higherAdCount == 1)
                            message = String.Format(
                                CultureInfo.CurrentCulture,
                                "Would you like to change the first pledge to {0:c} to and the rest to {1:c} to match a {2}?",
                                baseAmount + 1, baseAmount, newType.PledgeSubType.ToLowerInvariant()
                            );
                        else
                            message = String.Format(
                                CultureInfo.CurrentCulture,
                                "Would you like to change the first {0} pledges to {1:c} to and the rest to {2:c} to match a {3}?",
                                higherAdCount, baseAmount + 1, baseAmount, newType.PledgeSubType.ToLowerInvariant()
                            );
                    }
                    switch (Dialog.Show(message, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning)) {
                        case DialogResult.Cancel:			//Don't change the ad type.
                            return false;
                        case DialogResult.No:				//Don't change any pledges.
                            break;
                        case DialogResult.Yes:				//Adjust the pledge amounts
                            int pledgeIndex = 0;
                            foreach (var pledge in newPledges.OrderBy(p => p.Person.LastName)) {
                                if (pledgeIndex < higherAdCount)
                                    pledge.Amount = baseAmount + 1;
                                else
                                    pledge.Amount = baseAmount;
                                pledgeIndex++;
                            }
                            break;
                    }
                }
            }
            return true;
        }
예제 #16
0
	/// <summary>
	/// 広告を表示します
	/// </summary>
	/// <param name="spotid">スポットID</param>
	/// <param name="adType">AdType</param>
	/// <param name="left">水平方向の広告表示座標</param>
	/// <param name="top">垂直方向の広告表示座標</param>
    public static int show(string spotid, AdType adType, int left, int top){
        return show(spotid, adType, left, top, null);
	}
예제 #17
0
	/// <summary>
	/// 広告を表示します
	/// </summary>
	/// <param name="spotid">スポットID</param>
	/// <param name="adType">AdType</param>
	/// <param name="left">水平方向の広告表示座標</param>
	/// <param name="top">垂直方向の広告表示座標</param>
	/// <param name="iconParams">IMobileIconParams</param>
    public static int show(string spotid, AdType adType, int left, int top, IMobileIconParams iconParams){
		Rect adRect = IMobileSdkAdsViewUtility.getAdRect (left, top, adType, iconParams);
		return show (spotid, adType, adRect, iconParams);
	}
예제 #18
0
 public abstract void LoadAd(AdType mode = AdType.Automatic);
예제 #19
0
 public override bool IsValidPlacement(AdPlacement placement, AdType type)
 {
     return(false);
 }
예제 #20
0
 public override void LoadAd(AdType mode)
 {
     mjStartAppAd.Call("loadAd", GetJAdType(mode), new ImplementationAdEventListener(this));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SmartAdServer.Unity.Library.UI.Native.NativeAdView"/> class.
 /// </summary>
 /// <param name="type">Ad type.</param>
 public NativeAdView(AdType type)
 {
     this.Type = type;
 }
 string GetNextAdUnitId(AdType type)
 {
     return(adUnitId);
 }
예제 #23
0
        private string InvalidateAd(bool selectNextAdType = false)
        {
            string adTypeName = "";
            if (!_loaded || !_initialised)
            {
                if (!_initialised)
                {
                    LoadAdSettings();
                    return "";
                }
                else
                {
                    OnLog("Control tested before loaded");
                    return "";
                }
            }

            if (LayoutRoot == null)
            {
                return "";
            }
            
            if (!IsAdRotatorEnabled)
            {
                OnLog("Ad control disabled");
                Visibility = Visibility.Collapsed;
                return adTypeName;
            }
            else
            {
                OnLog("Ads are enabled for display");
                Visibility = Visibility.Visible;
            }


            if (LayoutRoot == null)
            {
                OnLog("No layout to attach to");
                return adTypeName;
            }

            if (SlidingAdDirection != SlideDirection.None && !_slidingAdTimerStarted)
            {
                _slidingAdTimerStarted = true;
                ResetSlidingAdTimer(SlidingAdDisplaySeconds);
            }

            RemoveEventHandlersFromAdControl();

            LayoutRoot.Children.Clear();
            AdType adType;

            if (selectNextAdType)
            {
                CurrentAdType++;
                adType = CurrentAdType;
                if (adType >= AdType.None)
                {
                    adType = AdType.None;
                }
            }
            else
            {
                adType = GetNextAdType();
            }

            OnLog(string.Format("Ads being requested for: {0}", adType.ToString()));
            switch (adType)
            {
                case AdType.PubCenter:
                    if (_currentAdControl as Microsoft.Advertising.Mobile.UI.AdControl == null)
                        _currentAdControl = CreatePubCentertAdControl();
                    break;
                case AdType.AdDuplex:
                    if (_currentAdControl as AdDuplex.AdControl == null)
                        _currentAdControl = CreateAdDuplexControl();
                    break;
                case AdType.InnerActive:
                    if (_currentAdControl as InneractiveAdSDK.InneractiveAd == null)
                        _currentAdControl = CreateInneractiveControl();
                    break;
                case AdType.AdMob:
                    if (_currentAdControl as MobFox.Ads.AdControl == null)
                        _currentAdControl = CreateMobFoxControl();
                    break;
#if(!NONLOCATION)
                case AdType.Smaato:
#if(WP8)
                    if (_currentAdControl as SOMAWP8.SomaAdViewer == null)
#else
                    if (_currentAdControl as SOMAWP7.SomaAdViewer == null)
#endif
                        _currentAdControl = CreateSmaatoControl();
                    break;
#endif
                case AdType.InMobi:
                    if (_currentAdControl as IMAdView == null)
                        _currentAdControl = CreateInMobiControl();
                    break;
                case AdType.DefaultHouseAd:
                    _currentAdControl = CreateDefaultHouseAdControl();
                    break;
                default:
                    break;

            }


            if ((_currentAdControl == null || _currentAdControl as NoneProvider != null) && _adsAvailable) 
            {
                OnAdLoadFailed(adType);
                return adTypeName;
            }

            if (_currentAdControl == null || CurrentAdType == AdType.None || _currentAdControl as NoneProvider != null)
            {
                IsAdRotatorEnabled = false;
                Visibility = Visibility.Collapsed;
                OnLog("No ads available, nothing to show");
            }
            else
            {
                Visibility = Visibility.Visible;
                AddEventHandlersToAdControl();
                LayoutRoot.Children.Add((FrameworkElement)_currentAdControl);
                OnLog(string.Format("Ads being served for: {0}", adType.ToString()));
                adTypeName = adType.ToString();
                CurrentAdType = adType;
            }


            return adTypeName;
        }
예제 #24
0
	private static int show(string spotid, AdType adType, Rect adRect, IMobileIconParams iconParams){

		iconParams = iconParams ?? new IMobileIconParams();
		
		string partnerId = IMobileSpotInfoManager.GetPartnerId(spotid);
		string mediaId = IMobileSpotInfoManager.GetMediaId(spotid);
		int adViewId = IMobileAdViewIdManager.createId();
		
		#if UNITY_IPHONE
		if(Application.platform == RuntimePlatform.IPhonePlayer) {
			imobileShowBySpotIDWithPositionAndIconParams_(spotid, 
			                                              partnerId,
			                                              mediaId,
			                                              (int)adRect.x,
			                                              (int)adRect.y,
			                                              (int)adRect.width,
			                                              (int)adRect.height,
			                                              iconParams.iconNumber,
			                                              iconParams.iconViewLayoutWidth,
			                                              iconParams.iconSize,
			                                              iconParams.iconTitleEnable,
			                                              iconParams.iconTitleFontSize,
			                                              iconParams.iconTitleFontColor,
			                                              iconParams.iconTitleOffset,
			                                              iconParams.iconTitleShadowEnable,
			                                              iconParams.iconTitleShadowColor,
			                                              iconParams.iconTitleShadowDx,
			                                              iconParams.iconTitleShadowDy,
			                                              adViewId);
		}
		#elif UNITY_ANDROID
		if(Application.platform == RuntimePlatform.Android) {
			imobileSdkAdsAndroidPlugin.CallStatic("show", partnerId, mediaId, spotid, adViewId, (int)adRect.x, (int)adRect.y,
			                                      iconParams.iconNumber, 
			                                      iconParams.iconViewLayoutWidth,
												  iconParams.iconSize,
			                                      iconParams.iconTitleEnable,
												  iconParams.iconTitleFontSize,
			                                      iconParams.iconTitleFontColor, 
												  iconParams.iconTitleOffset,
			                                      iconParams.iconTitleShadowEnable,
			                                      iconParams.iconTitleShadowColor,
			                                      iconParams.iconTitleShadowDx,
			                                      iconParams.iconTitleShadowDy
			                                      );
		}
		#endif
		
		return adViewId;
	}
예제 #25
0
 /// <summary>
 /// Checks if the placement is valid, i.e. it has non-empty
 /// associated IDs if such placement require dedicated IDs.
 /// </summary>
 /// <param name="placement">Placement.</param>
 public abstract bool IsValidPlacement(AdPlacement placement, AdType type);
예제 #26
0
 /// <summary>
 /// 広告を表示します
 /// </summary>
 /// <param name="spotid">スポットID</param>
 /// <param name="adType">AdType</param>
 /// <param name="alignPosition">AdAlignPosition</param>
 /// <param name="valignPosition">AdValignPosition</param>
 public static int show(string spotid, AdType adType, AdAlignPosition alignPosition, AdValignPosition valignPosition)
 {
     return(show(spotid, adType, alignPosition, valignPosition, null));
 }
 public bool IsEnabledAd(AdType adType)
 {
     return(CASExterns.CASUIsAdEnabledType(_managerRef, ( int )adType));
 }
예제 #28
0
    /// <summary>
    /// 広告を表示します
    /// </summary>
    /// <param name="spotid">スポットID</param>
    /// <param name="adType">AdType</param>
    /// <param name="alignPosition">AdAlignPosition</param>
    /// <param name="valignPosition">AdValignPosition</param>
    /// <param name="iconParams">IMobileIconParams</param>
    public static int show(string spotid, AdType adType, AdAlignPosition alignPosition, AdValignPosition valignPosition, IMobileIconParams iconParams)
    {
        Rect adRect = IMobileSdkAdsViewUtility.getAdRect(alignPosition, valignPosition, adType, iconParams);

        return(show(spotid, adType, adRect, iconParams));
    }
예제 #29
0
        public IInterstittialAd CreateAd(string appId, string adUnitId, AdType type, Action<object> readyCallback, Action<object> completedCallback, Action<object> cancelledCallback, Action<object> errorCallback)
        {
            InterstitialAd ad = new InterstitialAd (
                appId, adUnitId, type, readyCallback, completedCallback,  cancelledCallback , errorCallback );

            return ad;
        }
예제 #30
0
 /// <summary>
 /// 広告を表示します
 /// </summary>
 /// <param name="spotid">スポットID</param>
 /// <param name="adType">AdType</param>
 /// <param name="left">水平方向の広告表示座標</param>
 /// <param name="top">垂直方向の広告表示座標</param>
 public static int show(string spotid, AdType adType, int left, int top)
 {
     return(show(spotid, adType, left, top, null));
 }
예제 #31
0
 /// <summary>
 /// Called when <paramref name="adType"/> has failed to load
 /// </summary>
 /// <param name="adType"></param>
 private void OnAdLoadFailed(AdType adType)
 {
     if (!_failedAdTypes.Contains(adType))
     {
         _failedAdTypes.Add(adType);
     }
     Dispatcher.BeginInvoke(() =>
     {
         Invalidate();
     });
 }
예제 #32
0
    /// <summary>
    /// 広告を表示します
    /// </summary>
    /// <param name="spotid">スポットID</param>
    /// <param name="adType">AdType</param>
    /// <param name="left">水平方向の広告表示座標</param>
    /// <param name="top">垂直方向の広告表示座標</param>
    /// <param name="iconParams">IMobileIconParams</param>
    public static int show(string spotid, AdType adType, int left, int top, IMobileIconParams iconParams)
    {
        Rect adRect = IMobileSdkAdsViewUtility.getAdRect(left, top, adType, iconParams);

        return(show(spotid, adType, adRect, iconParams));
    }
 /// <summary>
 /// Builds the instance.
 /// </summary>
 /// <returns>The instance.</returns>
 /// <param name="type">Ad type.</param>
 public abstract NativeAdView BuildInstance(AdType type);
예제 #34
0
    void Start()
    {
        HeyzapAds.NetworkCallbackListener networkCallbackListener = delegate(string network, string callback) {
            this.console.Append("[" + network + "]: " + callback);
        };

        // HZDemographics.SetUserGender(HZDemographics.Gender.MALE);
        // HZDemographics.SetUserPostalCode("94103");
        // HZDemographics.SetUserHouseholdIncome(100000);
        // HZDemographics.SetUserMaritalStatus(HZDemographics.MaritalStatus.SINGLE);
        // HZDemographics.SetUserEducationLevel(HZDemographics.EducationLevel.BACHELORS_DEGREE);
        // HZDemographics.SetUserBirthDate("1990-08-05");

        // UnityEngine.Debug.Log ("calling loc service");
        // TestLocationService locServ = new TestLocationService();
        // locServ.Start(this.console);

        HeyzapAds.SetNetworkCallbackListener(networkCallbackListener);
        HeyzapAds.ShowDebugLogs();
        HeyzapAds.Start("ENTER_YOUR_PUBLISHER_ID_HERE", HeyzapAds.FLAG_NO_OPTIONS);

        HZBannerAd.SetDisplayListener(delegate(string adState, string adTag) {
            this.console.Append("BANNER: " + adState + " Tag : " + adTag);
            if (adState == "loaded")
            {
                Rect dimensions = new Rect();
                HZBannerAd.GetCurrentBannerDimensions(out dimensions);
                this.console.Append(string.Format("    (x,y): ({0},{1}) - WxH: {2}x{3}", dimensions.x, dimensions.y, dimensions.width, dimensions.height));
            }
        });

        HZInterstitialAd.SetDisplayListener(delegate(string adState, string adTag) {
            this.console.Append("INTERSTITIAL: " + adState + " Tag : " + adTag);
        });

        HZIncentivizedAd.SetDisplayListener(delegate(string adState, string adTag) {
            this.console.Append("INCENTIVIZED: " + adState + " Tag : " + adTag);
        });

        HZVideoAd.SetDisplayListener(delegate(string adState, string adTag) {
            this.console.Append("VIDEO: " + adState + " Tag : " + adTag);
        });

        HZOfferWallAd.SetDisplayListener(delegate(string adState, string adTag) {
            this.console.Append("OFFERWALL: " + adState + " Tag : " + adTag);
        });

        HZOfferWallAd.SetVirtualCurrencyResponseListener(delegate(VirtualCurrencyResponse response) {
            this.console.Append("OFFERWALL VCS Response: id:" + response.CurrencyID + " name: '" + response.CurrencyName + "' amount : " + response.DeltaOfCurrency + " trans: " + response.LatestTransactionID);
        });

        HZOfferWallAd.SetVirtualCurrencyErrorListener(delegate(string errorMsg) {
            this.console.Append("OFFERWALL VCS Error: " + errorMsg);
        });

        // UI defaults
        this.bannerPosition = HZBannerShowOptions.POSITION_TOP;
        this.SelectedAdType = AdType.Interstitial;

        this.ShowAdTypeControls();
    }
예제 #35
0
 internal AppSettings()
 {
     IsFirstTime = true;
     IsPaid      = false;
     AdType      = AdType.PopUp;
 }
예제 #36
0
 // Skapa en Annonstyp
 public string CreateAdType(AdType adType)
 {
     _context.Add(adType);
     _context.SaveChanges();
     return("OK");
 }
예제 #37
0
 /// <summary>
 /// Called when <paramref name="adType"/> has succeeded to load
 /// </summary>
 /// <param name="adType"></param>
 private void OnAdLoadSucceeded(AdType adType)
 {
     OnLog(string.Format("Ads being successfully served for: {0}", adType.ToString()));
     if (_failedAdTypes.Contains(adType))
     {
         _failedAdTypes.Remove(adType);
     }
 }
예제 #38
0
 public void InsertAdType(AdType adType)
 {
     _mongoService.Insert(adTypeCol, adType);
 }
예제 #39
0
        private bool IsAdTypeValid(AdType adType)
        {
            switch (adType)
            {
                case AdType.PubCenter:
                    return IsPubCenterValid;
                case AdType.AdDuplex:
                    return IsAdDuplexValid;
#if(!WP8)
                    case AdType.AdMob:
                    return IsAdMobValid;
                case AdType.MobFox:
                    return IsMobFoxValid;
#endif
#if(!NONLOCATION)
                case AdType.Smaato:
                    return IsSmaatoValid;
#endif
                case AdType.InnerActive:
                    return IsInnerActiveValid;
                case AdType.InMobi:
                    return IsInMobiValid;
                case AdType.DefaultHouseAd:
                    return IsDefaultHouseAdValid;

            }
            //Davide Cleopadre www.cleosolutions.com
            //if for any reason the AdType cannot be found is not valid
            //if we add new ads type the control will continue to work
            //also not updated
            return false;
        }
예제 #40
0
 public override bool IsAdTypeSupported(AdType adType)
 {
     throw new NotImplementedException();
 }
예제 #41
0
        public void Yodo1U3dMasCallbackResult(string result)
        {
            Debug.Log("[Yodo1 Mas] The SDK callback result:" + result + "\n");

            Dictionary <string, object> obj = (Dictionary <string, object>)Yodo1JSON.Deserialize(result);

            if (obj == null)
            {
                return;
            }

            if (!obj.ContainsKey("flag") || !obj.ContainsKey("data"))
            {
                return;
            }

            string jsonData = obj["data"].ToString();
            Dictionary <string, object> dataDic = (Dictionary <string, object>)Yodo1JSON.Deserialize(jsonData);

            if (dataDic == null)
            {
                return;
            }

            int flag = int.Parse(obj["flag"].ToString());

            if (flag == FLAG_INITIALIZE)
            {
                bool            success = false;
                Yodo1U3dAdError error   = new Yodo1U3dAdError();

                if (dataDic.ContainsKey("success"))
                {
                    success = int.Parse(dataDic["success"].ToString()) == EVENT_INITIALIZE_SUCCESS ? true : false;
                }
                if (dataDic.ContainsKey("error"))
                {
                    string errorStr = dataDic["error"].ToString();
                    error = Yodo1U3dAdError.createWithJson(errorStr);
                }

                if (_initializeDelegate != null)
                {
                    _initializeDelegate(success, error);
                }
            }
            else if (flag == FLAG_AD_EVENT)
            {
                AdType type = AdType.Rewarded;
                if (dataDic.ContainsKey("type"))
                {
                    type = (AdType)int.Parse(dataDic["type"].ToString());
                }
                else
                {
                    return;
                }
                Yodo1U3dAdEvent eventCode = Yodo1U3dAdEvent.AdError;
                if (dataDic.ContainsKey("code"))
                {
                    eventCode = (Yodo1U3dAdEvent)int.Parse(dataDic["code"].ToString());
                }
                string message;
                if (dataDic.ContainsKey("message"))
                {
                    message = dataDic["message"].ToString();
                }
                Yodo1U3dAdError error = new Yodo1U3dAdError();
                if (dataDic.ContainsKey("error"))
                {
                    error = Yodo1U3dAdError.createWithJson(dataDic["error"].ToString());
                }

                switch (type)
                {
                case AdType.Rewarded:
                {
                    if (_rewardedAdDelegate != null)
                    {
                        _rewardedAdDelegate(eventCode, error);
                    }
                }
                break;

                case AdType.Interstitial:
                    if (_interstitialAdDelegate != null)
                    {
                        _interstitialAdDelegate(eventCode, error);
                    }
                    break;

                case AdType.Banner:
                    if (_bannerDelegate != null)
                    {
                        _bannerDelegate(eventCode, error);
                    }
                    break;

                default:
                    break;
                }
            }
        }
예제 #42
0
 public AdBannerView(AdType type)
 {
     ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("initWithAdType:"), (int)type);
     ObjC.MessageSend(Handle, Selector.GetHandle("setDelegate:"), Handle);
 }
예제 #43
0
 public AdBannerView(AdType type)
 {
     ObjC.MessageSendIntPtr(Handle, "initWithAdType:", (int)type);
     ObjC.MessageSend(Handle, "setDelegate:", Handle);
 }
예제 #44
0
 private void RemoveAdFromFailedAds(AdType AdType)
 {
     _settings.RemoveAdFromFailedAds(AdType);
     OnLog(string.Format("Ads failed request for: {0}", AdType.ToString()));
 }
예제 #45
0
 public void HideAds(AdType adType)
 {
     //Since no other type of ads can be hidden, only banner view ads are getting hidden.
     bannerView.Hide();
 }
예제 #46
0
 public Ad(AdType type, bool isRewarded = false, Action <AdState, Ad> callback = null) : base(type, isRewarded)
 {
     _callback = callback;
 }
 public string GetLastActiveMediation(AdType adType)
 {
     return(CASExterns.CASUGetLastActiveMediationWithType(_managerRef, ( int )adType));
 }
예제 #48
0
        /// <summary>
        /// 根据参数生成查询字符串
        /// </summary>
        /// <param name="pagename">页面名称</param>
        /// <param name="fid">版块id</param>
        /// <param name="adtype">广告类型</param>
        /// <returns>查询字符串</returns>
        public static string GetSelectStr(string pagename, int fid, AdType adtype)
        {
            string typestr = Convert.ToInt16(adtype).ToString();

            string selectstr = "";
            //if ((pagename != null) && (pagename != "") && (pagename == "indexad"))
            if(!string.IsNullOrEmpty(pagename) && (pagename=="indexad"))
            {
                selectstr = ",首页,";
            }
            else
            {
                if (fid > 0)
                {
                    selectstr += "," + fid + ",";
                }
            }

            if (selectstr == "")
            {
                selectstr = "type='" + typestr + "'  AND [targets] Like '%全部%'";
            }
            else
            {
                selectstr = "type='" + typestr + "'  AND ([targets] Like '%" + selectstr + "%' OR [targets] Like '%全部%')";
            }

            return selectstr;
        }
예제 #49
0
 /// <summary>
 /// 返回聚合首页广告
 /// </summary>
 /// <param name="adType">广告类型</param>
 /// <returns>返回帖间通栏广告</returns>
 public static string GetWebSiteAd(AdType adType)
 {
     string result = "";
     AdShowInfo[] adshowArray = GetAdsTable(GetSelectStr("", 0, adType));
     if (adshowArray.Length > 0)
     {
         int number = new Random().Next(0, adshowArray.Length);
         result = adshowArray[number].Code;
     }
     return result;
 }
예제 #50
0
        /// <summary>
        /// Updates an ad. Requires author email.
        /// </summary>
        /// <param name="authorEmail"></param>
        /// <param name="id"></param>
        /// <param name="title"></param>
        /// <param name="content"></param>
        /// <param name="locationName"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public Ad UpdateAd(string authorEmail, string id, string title, string content, string locationName = null, AdType type = AdType.Other)
        {
            using (var db = DbContextControl.GetNew())
            {
                Ad  ad    = db.Ads.FirstOrDefault(a => a.Id == id);
                var entry = db.Entry(ad);

                if (ad.Author.Email != authorEmail)
                {
                    throw new InvalidOperationException("Can not edit another person's ad!");
                }

                if (title != null && title != ad.Title)
                {
                    ad.Title = title;
                    entry.Property("Title").IsModified = true;
                }

                //Find a location and attach it to the DB context and to the Ad
                if (locationName != null && locationName != ad.Location.Name)
                {
                    var locationFull = db.Locations.Attach(new Location {
                        Name = locationName
                    });
                    //ad.Location = locationFull;
                    entry.Reference("Location").CurrentValue = locationFull;
                }

                if (content != null && content != ad.Content)
                {
                    ad.Content = content;
                    entry.Property("Content").IsModified = true;
                }

                ad.LastEdited = DateTime.Now;
                entry.Property("LastEdited").IsModified = true;

                db.SaveChanges();

                return(ad);
            }
        }
예제 #51
0
 public void Request(string appId, string adUnitId, AdType type)
 {
     hasPendingAdRequest = true;
     AppCallbacks.Instance.InvokeOnUIThread(() =>
     {
         try
         {
             _ad.RequestAd((Microsoft.Advertising.WinRT.UI.AdType) type, appId, adUnitId);
         }
         catch (Exception ex)
         {
             System.Diagnostics.Debug.WriteLine(ex.Message);
             hasPendingAdRequest = false;
         }
     }, true);
 }
예제 #52
0
        /// <summary>
        /// A VERY expensive operation that searches through ad content. Use with caution.
        /// </summary>
        /// <param name="skip">Skip amount of ads (for paging)</param>
        /// <param name="amount">Take amount of ads (for paging)</param>
        /// <param name="location">General location of ad</param>
        /// <param name="searchQuery">A search query, like a few words that describe what is searched</param>
        /// <returns>A page of ads that match the criteria.</returns>
        public IList <Ad> FindAds(int skip, int amount, string location, string searchQuery, AdType type = AdType.All)
        {
            //Throttle amount of ads found, to reduce load
            if (amount > Throttle)
            {
                amount = Throttle;
            }

            //Get a DB context
            var db = DbContextControl.GetNew();

            //Get all locations that the ad is within
            IList <string> possibleLocations;

            try
            {
                possibleLocations = GetPossibleLocationNames(location);
            }
            catch (LocationNotFoundException)
            {
                possibleLocations = new List <string>();
            }

            //Get the keywords for searching in ad content
            var keywords = searchQuery.GetKeywords();

            //Delimit to ads that are within a location, use this as base for the search query
            //Also order by date posted
            IQueryable <Ad> query = db.Ads.Include(a => a.Location);

            //A complex and heavy SQL query to find the searchQuery string within ad titles, contents and categories
            //We are using the keywords list instead of the searchQuery directly
            query = (from ad in query
                     where (type == AdType.All || ad.Type == type) && //Check type, all or one
                     (possibleLocations.Count == 0 || //Check location, ignore if none apply
                      possibleLocations.Any(loc => ad.Location.Name == loc)) &&
                     (keywords.Count == 0 || //Check for keywords, ignore if none apply
                      keywords.Any(kw => ad.Title.ToLower().Contains(kw) ||
                                   ad.Content.ToLower().Contains(kw)))
                     ///TODO: Add category search
                     //|| ad.Categories.Contains(kw)))
                     select ad);

            //Order the query by list
            //Delimit the query to take only a page of results and append the Authors to the ads
            var pagedQuery = query.OrderByDescending(a => a.DatePosted)
                             .Skip(skip)
                             .Take(amount)
                             .Include(a => a.Author)
                             .Include(a => a.ReservedBy)
                             .Include(a => a.Price)
                             .ToList();

            return(pagedQuery);
        }
예제 #53
0
 public static void ShowAdvert(AdType type)
 {
     Global.Utils.StartCoroutineOnUtils(ShowAd(type));
 }
예제 #54
0
 private void RemoveAdFromFailedAds(AdType AdType)
 {
     _settings.RemoveAdFromFailedAds(AdType);
     OnLog(string.Format("Ads failed request for: {0}", AdType.ToString()));
 }
예제 #55
0
 private bool IsAdTypeValid(AdType adType)
 {
     switch (adType)
     {
         case AdType.PubCenter:
             return IsPubCenterValid;
         case AdType.AdDuplex:
             return IsAdDuplexValid;
         case AdType.AdMob:
             return IsAdMobValid;
     }
     return true;
 }
 public void Request(string appId, string adUnitId, AdType type)
 {
     hasPendingRequests = true;
     if( fireError )
         StartCoroutine(PrepareError());
     else
         StartCoroutine(PrepareRequest());
 }
예제 #57
0
 /// <summary>
 /// Called when <paramref name="adType"/> has succeeded to load
 /// </summary>
 /// <param name="adType"></param>
 private void OnAdLoadSucceeded(AdType adType)
 {
     if (_failedAdTypes.Contains(adType))
     {
         _failedAdTypes.Remove(adType);
     }
 }
예제 #58
0
        private void InitializeComponent()
        {
            this.type.SelectedIndexChanged += new EventHandler(this.type_SelectedIndexChanged);

            this.UpdateADInfo.Click += new EventHandler(this.UpdateADInfo_Click);
            this.DeleteADInfo.Click += new EventHandler(this.DeleteADInfo_Click);

            title.AddAttributes("maxlength", "40");
            title.AddAttributes("size", "40");
            AdType thetype = new AdType();
            //加载树
            type.Items.Clear();
            type.Items.Add(new ListItem("请选择     ", "-1"));
            foreach (string tts in Enum.GetNames(thetype.GetType()))
            {
                string thetext = EnumCatch.GetADTpyeName(Convert.ToInt16(Enum.Parse(thetype.GetType(), tts)));
                string thevalue = Convert.ToInt16(Enum.Parse(thetype.GetType(), tts)).ToString();
                type.Items.Add(new ListItem(thetext, thevalue));
            }

            type.Attributes.Add("onChange", "showadhint();");

            if (SASRequest.GetString("advid") == "")
            {
                Response.Redirect("advertisementsgrid.aspx");
            }
            else
            {
                LoadAnnounceInf(SASRequest.GetInt("advid", -1));
            }
        }
예제 #59
0
        /// <summary>
        /// Posts an Ad, persists to the database
        /// </summary>
        /// <param name="authorEmail"></param>
        /// <param name="title"></param>
        /// <param name="content"></param>
        /// <param name="locationName"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public Ad PostAd(string authorEmail, string title, string content, string locationName = null, AdType type = AdType.Other)
        {
            var db = DbContextControl.GetNew();

            Ad ad = new Ad
            {
                Content    = content,
                DatePosted = DateTime.Now,
                LastEdited = DateTime.Now,
                ExpDate    = DateTime.Now,
                Views      = 0,
                Title      = title,
                Location   = null,
                Price      = null,
                Type       = type,
            };

            //Find a user and attach him to the DB context
            var authorFull = db.Users.Attach(
                db.Users.FirstOrDefault(u => u.Email == authorEmail));

            //Attach the user to the Ad
            ad.Author = authorFull;

            //Find a location and attach it to the DB context and to the Ad
            if (locationName != null)
            {
                var locationFull = db.Locations.Attach(new Location {
                    Name = locationName
                });
                ad.Location = locationFull;
            }

            ad.Price = new Price {
                Id = ad.Id, Type = PriceType.Free, High = 0, Low = 0
            };

            db.Ads.Add(ad);
            db.SaveChanges();

            return(ad);
        }
예제 #60
0
 /// <summary>
 /// Kiểm tra sự provider id có hỗ trợ ad hay không. Từ provider Id không lấy ra được instance
 /// nên phải dùng cách này trên editor
 /// </summary>
 /// <returns></returns>
 bool IsSuportAd(ProviderID id, AdType type)
 {
     return(ProvidersConfig.IsSupport(id, type));
 }