示例#1
0
        private static bool GetTaskAndRegistration(SPWeb web, IRegistrationApprovalView view, string taskID, out Registration registration)
        {
            IRegistrationApprovalTaskRepository registrationApprovalTaskRepository = ServiceLocator.GetInstance().Get <IRegistrationApprovalTaskRepository>();
            RegistrationApprovalTask            registrationApprovalTask           = null;

            if (!String.IsNullOrEmpty(taskID))
            {
                int queryID;
                if (int.TryParse(taskID, out queryID))
                {
                    registrationApprovalTask = registrationApprovalTaskRepository.Get(queryID, web);
                }
            }

            if (registrationApprovalTask == null)
            {
                view.Message = "The Approval Task selected is not valid.";
                registration = null;
                return(false);
            }

            IRegistrationRepository registrationRepository = ServiceLocator.GetInstance().Get <IRegistrationRepository>();
            int registrationID = registrationApprovalTask.WorkflowItemId;

            registration = registrationRepository.Get(registrationID, web);
            if (registration == null)
            {
                view.Message = "The Registration associated with the selected Approval Task is not valid.";
                return(false);
            }

            return(true);
        }
示例#2
0
        private static bool GetCourseAndUser(SPWeb web, IRegistrationApprovalView view, Registration registration, out TrainingCourse course, out SPUser user)
        {
            ITrainingCourseRepository trainingCourseRepository = ServiceLocator.GetInstance().Get <ITrainingCourseRepository>();

            course = trainingCourseRepository.Get(registration.CourseId, web);
            if (course == null)
            {
                view.Message = "The Course associated with the selected Approval Task is not valid.";
                user         = null;
                return(false);
            }
            user = GetSPUser(web, registration.UserId.ToString());
            if (user == null)
            {
                view.Message = "The Employee associated with the selected Approval Task is not valid.";
                return(false);
            }
            return(true);
        }
示例#3
0
 public RegistrationApprovalPresenter(IRegistrationApprovalView view)
 {
     _view = view;
 }