Esempio n. 1
0
    public static OfferwallsLog Create(Offerwall Wall, string Username, Money SentBalance, Money CalculatedBalance, string TrackingInfo, OfferwallsLogStatus Status)
    {
        if (TrackingInfo == null)
        {
            TrackingInfo = "?";
        }

        string sent     = "-";
        string credited = "-";

        if (Wall.CreditAs == CreditAs.Points)
        {
            sent = SentBalance.GetRealTotals().ToString();

            if (CalculatedBalance != null)
            {
                credited = CalculatedBalance.GetRealTotals().ToString() + " " + AppSettings.PointsName;
            }
        }

        if (Wall.CreditAs == CreditAs.MainBalance)
        {
            sent = SentBalance.ToClearString();

            if (CalculatedBalance != null)
            {
                credited = CalculatedBalance.ToString();
            }
        }

        OfferwallsLog ol = new OfferwallsLog();

        ol.Date              = DateTime.Now;
        ol.NetworkName       = Wall.DisplayName;
        ol.SentBalance       = sent;
        ol.Status            = Status;
        ol.SentBalanceMoney  = SentBalance;
        ol.TrackingID        = TrackingInfo;
        ol.Username          = Username;
        ol.CalculatedBalance = credited;
        ol.Save();

        return(ol);
    }
Esempio n. 2
0
    public static void Release(OfferwallsLog log)
    {
        try
        {
            Offerwall Wall = TableHelper.SelectRows <Offerwall>(TableHelper.MakeDictionary("DisplayName", log.NetworkName))[0];

            //Credit
            OfferwallCrediter Crediter = new OfferwallCrediter(new Member(log.Username), Wall);
            Crediter.CreditMember(log.SentBalanceMoney, Wall);

            //Update log
            log.Status = OfferwallsLogStatus.CreditedByOfferwallPointsUnlocked;
            log.Save();
        }
        catch (Exception ex)
        {
            ErrorLogger.Log(ex);
        }
    }