private Money CreditGeneral(Money Input, CreditAs As, string OfferwallName, bool RequiresConversion = false, bool IsReversal = false) { Money Calculated = Money.MultiplyPercent(Input, base.User.Membership.OfferwallsProfitPercent); //Conversion? if (RequiresConversion) { if (As == CreditAs.Points) { Calculated = new Money(PointsConverter.ToPoints(Calculated)); } if (As == CreditAs.MainBalance) { Calculated = PointsConverter.ToMoney(Calculated.ToDecimal()); } } if (As == CreditAs.Points) { base.CreditPoints(Calculated.GetRealTotals(), "CrowdFlower", BalanceLogType.Other); base.CreditReferersPoints(Calculated.GetRealTotals(), "CrowdFlower /ref/ " + User.Name, BalanceLogType.Other); } if (As == CreditAs.MainBalance) { base.CreditMainBalance(Calculated, "CrowdFlower", BalanceLogType.Other); base.CreditReferersMainBalance(Calculated, "CrowdFlower /ref/ " + User.Name, BalanceLogType.Other); } History.AddOfferwalCompleted(User.Name, OfferwallName, Calculated, As); return(Calculated); }
public static Money CalculatedAndConversion(Money Input, Member member, Offerwall Wall) { Money Calculated = new Money(Input.ToDecimal()); //Money to Money in diffrent Currency if (Wall.WhatIsSent == WhatIsSent.Money && Wall.CreditAs == CreditAs.MainBalance && AppSettings.Site.CurrencyCode != Wall.CurrencyCode) { Calculated = Calculated.ExchangeFrom(Wall.CurrencyCode); } //Poinst to Money else if (Wall.WhatIsSent == WhatIsSent.Points && Wall.CreditAs == CreditAs.MainBalance) { if (AppSettings.Points.PointsEnabled && Wall.UseVirtualCurrencySetting) { Calculated = PointsConverter.ToMoney(Calculated.ToDecimal()); Calculated = Calculated.ExchangeFrom(Wall.CurrencyCode); } else { Calculated = PointsConverter.ToMoney(Calculated.ToDecimal(), Wall.MoneyToPointsRate.ToDecimal()); Calculated = Calculated.ExchangeFrom(Wall.CurrencyCode); } } //Money to Points else if (Wall.WhatIsSent == WhatIsSent.Money && Wall.CreditAs == CreditAs.Points) { Calculated = Calculated.ExchangeFrom(Wall.CurrencyCode); Calculated = new Money(PointsConverter.ToPoints(Calculated)); } //Points to Points in diffrent Currency else if (Wall.WhatIsSent == WhatIsSent.Points && Wall.CreditAs == CreditAs.Points && AppSettings.Site.CurrencyCode != Wall.CurrencyCode) { Calculated = PointsConverter.ToMoney(Calculated.ToDecimal(), Wall.MoneyToPointsRate.ToDecimal()); Calculated = Calculated.ExchangeFrom(Wall.CurrencyCode); Calculated = new Money(PointsConverter.ToPoints(Calculated)); } //No conversion //Modify by credit percentage Calculated = Money.MultiplyPercent(Calculated, Wall.CreditPercentage); ///Membership fee Calculated = Money.MultiplyPercent(Calculated, member.Membership.OfferwallsProfitPercent); return(Calculated); }