예제 #1
0
 private InTextAdvert(int userId, InTextAdvertPack pack, string title, string description, string url, PurchaseBalances targetBalance)
 {
     UserId         = userId;
     ClicksBought   = pack.Clicks;
     ClicksReceived = 0;
     PricePaid      = pack.Price;
     Title          = title;
     Description    = description;
     Url            = url;
     Status         = AdvertStatus.Active;
     TargetBalance  = targetBalance;
 }
예제 #2
0
        public static void Buy(Member user, InTextAdvertPack pack, string title, string description, string url, PurchaseBalances targetBalance, List <string> tags)
        {
            if (tags.Count > pack.MaxNumberOfTags)
            {
                throw new MsgException(string.Format(U6002.TOOMANYTAGS, pack.MaxNumberOfTags));
            }

            if (tags.Count == 0)
            {
                throw new MsgException(U6002.MUSTADDTAGS);
            }

            PurchaseOption.ChargeBalance(user, pack.Price, PurchaseOption.Features.InTextAds.ToString(), targetBalance, "InText Ad");
            var ad = new InTextAdvert(user.Id, pack, title, description, url, targetBalance);

            ad.Save();

            MapTags(ad.Id, tags);

            MatrixBase.TryAddMemberAndCredit(user, pack.Price, AdvertType.InText);
        }
예제 #3
0
        public static void Create(int clicks, Money price, int maxNumberOfTags)
        {
            var pack = new InTextAdvertPack(clicks, price, maxNumberOfTags);

            pack.Save();
        }