예제 #1
0
 public void EmployeeJobInsexPointTest()
 {
     using (var session = PMSSession.GetSession())
         using (session.BeginTransaction())
         {
             var jpRep          = new MITD.PMS.Persistence.NH.JobPositionRepository(new NHUnitOfWork(session));
             var empRep         = new EmployeeRepository(new NHUnitOfWork(session));
             var inquiryRep     = new InquiryJobIndexPointRepository(new NHUnitOfWork(session));
             var jobRep         = new PMS.Persistence.NH.JobRepository(new NHUnitOfWork(session));
             var jobIndexRep    = new PMS.Persistence.NH.JobIndexRepository(new NHUnitOfWork(session));
             var inquiryService = new JobPositionInquiryConfiguratorService(jpRep);
             var jobPosition    = jpRep.GetBy(new JobPositionId(new PeriodId(1), new SharedJobPositionId(19)));
             var inquirerId     = jobPosition.ConfigurationItemList.Select(c => c.Id.InquirerId).FirstOrDefault();
             var inquirer       = empRep.GetBy(inquirerId);
             var employees      = inquiryService.GetJobPositionInquiryConfigurationItemBy(inquirer);
             foreach (var itm in employees)
             {
                 var job = jobRep.GetById(itm.JobPosition.JobId);
                 foreach (var jobIndexId in job.JobIndexList)
                 {
                     var jobIndex          = jobIndexRep.GetById(jobIndexId.JobIndexId);
                     var id                = inquiryRep.GetNextId();
                     var inquiryIndexPoint = new InquiryJobIndexPoint(new InquiryJobIndexPointId(id), itm, jobIndex as JobIndex,
                                                                      Guid.NewGuid().ToString());
                     session.Save(inquiryIndexPoint);
                 }
             }
             session.Transaction.Commit();
         }
 }
예제 #2
0
 public void ConfigeJobPositionInquiry()
 {
     using (var session = PMSSession.GetSession())
         using (session.BeginTransaction())
         {
             JobPosition jp    = createJobPositions();
             var         jpRep = new MITD.PMS.Persistence.NH.JobPositionRepository(new NHUnitOfWork(session));
             var         jobPositionForConfig = jpRep.GetBy(jp.Id);
             var         configService        = new JobPositionInquiryConfiguratorService(new MITD.PMS.Persistence.NH.JobPositionRepository(new NHUnitOfWork(session)));
             jobPositionForConfig.ConfigeInquirer(configService, true);
             session.Save(jobPositionForConfig);
             session.Transaction.Commit();
         }
 }
예제 #3
0
        private void assignJobPositionToEmployees(Period period, JobPosition jPosition)
        {
            var empList = createEmployees(period);

            using (var session = PMSSession.GetSession())
                using (session.BeginTransaction())
                {
                    var empRep = new EmployeeRepository(new NHUnitOfWork(session));
                    var jpRep  = new MITD.PMS.Persistence.NH.JobPositionRepository(new NHUnitOfWork(session));
                    foreach (var emp in empList)
                    {
                        var employee    = empRep.GetBy(emp.Id);
                        var jobPosition = jpRep.GetBy(jPosition.Id);
                        employee.AssignJobPosition(jobPosition, DateTime.Now, DateTime.Now, 0, 1,
                                                   null);
                        session.Save(employee);
                    }
                    session.Transaction.Commit();
                }
        }