Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
        public async Task ApproveBadge()
        {
            Csla.ApplicationContext.User = await CustomPrincipal.LogOnAsync(Constants.ReneeBUserName, "");

            var approveBadgeItem = await ApproveBadgeItem.GetBadgesToApproveByIdAsync(1);

            approveBadgeItem.ApproveBadge(Constants.ReneeBUserId);

            approveBadgeItem = (IApproveBadgeItem)approveBadgeItem.Save();

            Assert.IsNotNull(approveBadgeItem);
            Csla.ApplicationContext.User = new UnauthenticatedPrincipal();
        }
Ejemplo n.º 3
0
        public async Task ApproveActivity()
        {
            Csla.ApplicationContext.User = await CustomPrincipal.LogOnAsync(Constants.ScottDUserName, "");

            var approveActivityCollection = await ApproveActivityCollection.GetAllActivitiesToApproveAsync(Constants.ScottDUserId);

            approveActivityCollection[0].ApproveActivitySubmission(2);
            var count = approveActivityCollection.Count;

            approveActivityCollection = (IApproveActivityCollection)approveActivityCollection.Save();

            Assert.IsTrue((approveActivityCollection.Count + 1) == count);
            Csla.ApplicationContext.User = new UnauthenticatedPrincipal();
        }
Ejemplo n.º 4
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();
        }
        public virtual async Task <ActionResult> LogOn(LogOnViewModel logOnViewModel, string returnUrl)
        {
            Arg.IsNotNull(() => logOnViewModel);

            try
            {
                var customPrincipal = await CustomPrincipal.LogOnAsync(logOnViewModel.UserName, logOnViewModel.Password);

                ApplicationContext.User = customPrincipal;
                FormsAuthentication.RedirectFromLoginPage(customPrincipal.Identity.Name, logOnViewModel.RememberMe);
            }
            catch (DataPortalException dataPortalException)
            {
                // TODO: do we add logging here?
                ModelState.AddModelError("*", dataPortalException.BusinessException.Message);
            }

            return(View(logOnViewModel));
        }