public DirectReportsPresenter(IDirectReportsView view)
        {
            ServiceLocator serviceLocator = ServiceLocator.GetInstance();

            this.view = view;
            this.hr   = serviceLocator.Get <IHRManager>();
        }
        public TrainingBudgetPresenter(ITrainingBudgetView view)
        {
            ServiceLocator serviceLocator = ServiceLocator.GetInstance();

            this.view = view;
            this.acct = serviceLocator.Get <IAccountingManager>();
            this.hr   = serviceLocator.Get <IHRManager>();
        }
Esempio n. 3
0
        /// <summary>
        /// Populates the SPWorkflowTaskProperties with Title and AssignedTo data.
        /// </summary>
        /// <param name="taskProperties">SPWorkflowTaskProperties to populate.</param>
        /// <param name="web">The SPWeb in the current workflow context.</param>
        /// <param name="workflowItem">The SPListItem that the workflow instance is associated with.</param>
        public void PopulateManagerApprovalTaskProperties(SPWorkflowTaskProperties taskProperties, SPWeb web, SPListItem workflowItem)
        {
            IHRManager hrManager = serviceLocator.Get <IHRManager>();
            IRegistrationRepository   registrationRepository   = serviceLocator.Get <IRegistrationRepository>();
            ITrainingCourseRepository trainingCourseRepository = serviceLocator.Get <ITrainingCourseRepository>();

            //get registration and training course related to this task.
            Registration   registration   = registrationRepository.Get(workflowItem.ID, web);
            TrainingCourse trainingCourse = trainingCourseRepository.Get(registration.CourseId, web);

            //get the user and manager related to this registration.
            SPUser user    = GetSPUser(web, registration.UserId);
            SPUser manager = GetSPUser(web, hrManager.GetManager(user.LoginName));

            taskProperties.AssignedTo = manager.LoginName;
            taskProperties.Title      = String.Format("Approve new registration request from {0} for {1}.", user.Name, trainingCourse.Code);
        }
Esempio n. 4
0
        /// <summary>
        /// Charges the Accounting service for the cost of the course registration.
        /// </summary>
        /// <param name="web">The SPWeb in the current workflow context.</param>
        /// <param name="workflowItem">The SPListItem that the workflow instance is associated with.</param>
        public void ChargeAccounting(SPWeb web, SPListItem workflowItem)
        {
            IHRManager                hrManager                = serviceLocator.Get <IHRManager>();
            IAccountingManager        accountingManager        = serviceLocator.Get <IAccountingManager>();
            IRegistrationRepository   registrationRepository   = serviceLocator.Get <IRegistrationRepository>();
            ITrainingCourseRepository trainingCourseRepository = serviceLocator.Get <ITrainingCourseRepository>();

            //get registration and training course related to this task.
            Registration   registration   = registrationRepository.Get(workflowItem.ID, web);
            TrainingCourse trainingCourse = trainingCourseRepository.Get(registration.CourseId, web);

            //get the user related to this registration
            SPUser user = GetSPUser(web, registration.UserId);

            //construct the transaction related to this approved registration
            Transaction tran = new Transaction();

            tran.Amount      = trainingCourse.Cost;
            tran.CostCenter  = hrManager.GetCostCenter(user.LoginName);
            tran.Bucket      = trainingBucketString;
            tran.Description = String.Format("{0} training course registration by {1}.", trainingCourse.Title, user.Name);

            accountingManager.SaveTransaction(tran);
        }
Esempio n. 5
0
 public HRController(IHRManager hrManager)
 {
     this.hrManager = hrManager;
 }