private void LoadInfo() { var manager = new CustomerPointsManager(HccApp.CurrentRequestContext); var pointsIssued = manager.TotalPointsIssuedForStore(HccApp.CurrentStore.Id); lblPointsIssued.Text = pointsIssued.ToString(); lblPointsIssuedValue.Text = manager.DollarCreditForPoints(pointsIssued).ToString("c"); var pointsReserverd = manager.TotalPointsReservedForStore(HccApp.CurrentStore.Id); lblPointsReserved.Text = pointsReserverd.ToString(); lblPointsReservedValue.Text = manager.DollarCreditForPoints(pointsReserverd).ToString("c"); RewardsNameField.Text = HccApp.CurrentStore.Settings.RewardsPointsName; chkEnableRewardsPoints.Checked = HccApp.CurrentStore.Settings.RewardsPointsEnabled; chkUseForUserPrice.Checked = HccApp.CurrentStore.Settings.UseRewardsPointsForUserPrice; chkIssuePointsForUserPrice.Checked = HccApp.CurrentStore.Settings.IssuePointsForUserPrice; PointsCreditField.Text = HccApp.CurrentStore.Settings.RewardsPointsNeededPerDollarCredit.ToString(); PointsPerDollarField.Text = HccApp.CurrentStore.Settings.RewardsPointsIssuedPerDollarSpent.ToString(); }
private void LoadInfo() { CustomerPointsManager manager = CustomerPointsManager.InstantiateForDatabase(MTApp.CurrentStore.Settings.RewardsPointsIssuedPerDollarSpent, MTApp.CurrentStore.Settings.RewardsPointsNeededPerDollarCredit, MTApp.CurrentStore.Id); int pointsIssued = manager.TotalPointsIssuedForStore(MTApp.CurrentStore.Id); this.lblPointsIssued.Text = pointsIssued.ToString(); this.lblPointsIssuedValue.Text = manager.DollarCreditForPoints(pointsIssued).ToString("c"); int pointsReserverd = manager.TotalPointsReservedForStore(MTApp.CurrentStore.Id); this.lblPointsReserved.Text = pointsReserverd.ToString(); this.lblPointsReservedValue.Text = manager.DollarCreditForPoints(pointsReserverd).ToString("c"); this.RewardsNameField.Text = MTApp.CurrentStore.Settings.RewardsPointsName; this.chkPointForDollars.Checked = MTApp.CurrentStore.Settings.RewardsPointsOnPurchasesActive; this.chkPointsForProducts.Checked = MTApp.CurrentStore.Settings.RewardsPointsOnProductsActive; this.PointsCreditField.Text = MTApp.CurrentStore.Settings.RewardsPointsNeededPerDollarCredit.ToString(); this.PointsPerDollarField.Text = MTApp.CurrentStore.Settings.RewardsPointsIssuedPerDollarSpent.ToString(); }
public void CanCalculateDollarValueOfPoints() { string connectionString = string.Empty; int pointsIssuedPerDollar = 1; int pointsNeededForDollarCredit = 100; long storeId = -1; CustomerPointsManager target = CustomerPointsManager.InstantiateForMemory(pointsIssuedPerDollar, pointsNeededForDollarCredit, storeId); int points = 487; Decimal expected = 4.87m; Decimal actual; actual = target.DollarCreditForPoints(points); Assert.AreEqual(expected, actual); }