コード例 #1
0
        //--------------------------------------------------------------------------------------
        private void approveDenyHourlyMission(bool isApprove, Domain.User currentUser, TimeSheetManager timeSheetManager, HourlyMissionManager dlm, HourlyMission dailyLeave, string userDescription)
        {
            if (dailyLeave.WorkflowStage.Type == "Final")
            {
                throw new Exception("هم اکنون تایید نهایی می باشد");
            }
            var isManager = timeSheetManager.IsUserOrganisationMnager(dailyLeave.UserID, currentUser);

            if (dailyLeave.WorkflowStage.Type == "Manager" && !isManager)
            {
                throw new Exception("آیتم منتظر تایید مدیر ستادی است");
            }

            var data = new ApproveAndDenyJson()
            {
                id              = dailyLeave.ID.ToString(),
                date            = DateTime.Now,
                description     = userDescription,
                workflowStageID = dailyLeave.WorkflowStageID
            };

            if (isApprove)
            {
                dlm.Approve(dailyLeave);
                HistoryUtilities.RegisterApproveHistory(data, this._uow, currentUser);
            }
            else
            {
                dlm.Deny(dailyLeave);
                HistoryUtilities.RegisterApproveHistory(data, this._uow, currentUser);
            }
        }
コード例 #2
0
        public ActionResult ApproveConfirmed(Guid id)
        {
            HourlyMissionManager dlm = new HourlyMissionManager(UOW);
            var result = dlm.GetByID(id);

            dlm.Approve(result);
            UOW.SaveChanges();

            return(RedirectToAction("ApproveIndex", new { ac = "Approve" }));
        }
コード例 #3
0
        public ActionResult ApproveAll()
        {
            HourlyMissionManager dlm = new HourlyMissionManager(UOW);
            var hourlyMissions       = dlm.GetByOrganisationID(this.CurrentUser.OrganizationUnitID).
                                       Where(x => x.WorkflowStage.Order == 3);

            foreach (var Mission in hourlyMissions)
            {
                dlm.Approve(Mission);
            }
            UOW.SaveChanges();
            return(RedirectToAction("ApproveIndex", new { ac = "ApproveAll" }));
        }