Beispiel #1
0
        public async virtual Task <ActionResult> Index(FormCollection formCollection)
        {
            Arg.IsNotNull(() => formCollection);
            var displayAll = formCollection["SelectAll"];

            var allPayouts = await PointsReportCollection.GetAllPayoutsToApproveAsync(true);

            if (formCollection.AllKeys.Any(k => k == "CheckedValues"))
            {
                var parts  = formCollection["CheckedValues"].Split(',');
                var values = parts.Select(int.Parse);

                var pointsReports = allPayouts.Where(pri => values.Contains(pri.EmployeeId));
                foreach (var pointsReport in pointsReports)
                {
                    pointsReport.Payout(AuthenticatedUser.EmployeeId, DateTime.UtcNow);
                }

                if (await SaveObjectAsync(allPayouts, true))
                {
                    return(RedirectToAction("Index", "PointsReport"));
                }
            }

            return(View(allPayouts));
        }
Beispiel #2
0
        public async virtual Task <ActionResult> ListPayouts(bool displayAll = false)
        {
            Session["DisplayAll"] = displayAll;
            var pointsReportCollection = await PointsReportCollection.GetAllPayoutsToApproveAsync(displayAll);

            return(PartialView(pointsReportCollection));
        }
Beispiel #3
0
        public async virtual Task <ActionResult> Index()
        {
            var displayAll = Session["DisplayAll"] != null ? (bool)Session["DisplayAll"] : false;

            var pointsReportCollection = await PointsReportCollection.GetAllPayoutsToApproveAsync(displayAll);

            ViewBag.DisplayAll = displayAll;
            return(View(pointsReportCollection));
        }
Beispiel #4
0
        public async Task GetAllEmployeesToPayout()
        {
            Csla.ApplicationContext.User = await CustomPrincipal.LogOnAsync(Constants.ReneeBUserName, "");

            var pointsReport = await PointsReportCollection.GetAllPayoutsToApproveAsync();

            Assert.IsNotNull(pointsReport);
            Assert.IsTrue(pointsReport.Count >= 0);

            Csla.ApplicationContext.User = new UnauthenticatedPrincipal();
        }
Beispiel #5
0
        public async virtual Task <ActionResult> Export()
        {
            var contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            var fileName    = "PointsReportExport.xlsx";

            var pointsReportCollection = await PointsReportCollection.GetAllPayoutsToApproveAsync();

            var badgeAwardCollection = await BadgeAwardEditCollection.GetAllBadgeAwards();

            using (var pointsReportExportModel = new PointsReportExportModel(pointsReportCollection, badgeAwardCollection))
            {
                var fileBytes = pointsReportExportModel.CreateSpreadsheet();
                return(File(fileBytes, contentType, fileName));
            }
        }
Beispiel #6
0
        public async Task PayoutAllEmployees()
        {
            Csla.ApplicationContext.User = await CustomPrincipal.LogOnAsync(Constants.ReneeBUserName, "");

            var pointsReport = await PointsReportCollection.GetAllPayoutsToApproveAsync();

            pointsReport[0].Payout(((ICustomPrincipal)Csla.ApplicationContext.User).CustomIdentity().EmployeeId, DateTime.UtcNow);
            var count = pointsReport.Count;

            pointsReport = (IPointsReportCollection)pointsReport.Save();

            Assert.IsNotNull(pointsReport);
            Assert.IsTrue(pointsReport.Count == (count - 1));

            Csla.ApplicationContext.User = new UnauthenticatedPrincipal();
        }