Beispiel #1
0
        private JobIndex createJobIndexInPeriod(Period period)
        {
            JobIndex jobIndex = null;

            using (var session = PMSSession.GetSession())
                using (session.BeginTransaction())
                {
                    var jiRep = new PMS.Persistence.NH.JobIndexRepository(new NHUnitOfWork(session));
                    var id    = jiRep.GetNextId();
                    jobIndex = new JobIndex(id, period, getSharedJobIndex(), jiRep.GetJobIndexGroupById(new Domain.Model.JobIndices.AbstractJobIndexId(1)), true);
                    session.Save(jobIndex);
                    session.Transaction.Commit();
                }
            return(jobIndex);
        }
Beispiel #2
0
        public void isFullInquiryForms()//Period period)
        {
            JobIndex jobIndex = null;

            using (var session = PMSSession.GetSession())
                using (session.BeginTransaction())
                {
                    //var jiRep = new PMS.Persistence.NH.JobIndexRepository(new NHUnitOfWork(session));
                    var jiRep  = new PMS.Persistence.NH.InquiryJobIndexPointRepository(new NHUnitOfWork(session));
                    var pRep   = new PMS.Persistence.NH.PeriodRepository(new NHUnitOfWork(session));
                    var period = pRep.GetAll().First();
                    var has    = jiRep.IsAllInquiryJobIndexPointsHasValue(period);
                    //var id = jiRep.GetNextId();
                    //jobIndex = new JobIndex(id, period, getSharedJobIndex(),jiRep.GetJobIndexGroupById(new Domain.Model.JobIndices.AbstractJobIndexId(1)),true);
                    //session.Save(jobIndex);
                    session.Transaction.Commit();
                }
        }
Beispiel #3
0
 public virtual bool SameIdentityAs(JobIndex other)
 {
     return((other != null) && Id.Equals(other.Id));
 }
Beispiel #4
0
        public void JobIndexPointTest()
        {
            PMSAdmin.Domain.Model.JobIndices.JobIndex      jobIndex;
            PMSAdmin.Domain.Model.JobPositions.JobPosition jobPosition;
            PMSAdmin.Domain.Model.Jobs.Job   job;
            PMSAdmin.Domain.Model.Units.Unit unit;
            RuleEngineBasedPolicy            policy;
            long x = 190;

            using (var tr = new TransactionScope())
                using (var adminSession = PMSAdminSession.GetSession())
                {
                    policy = new RuleEngineBasedPolicy(new PolicyId(x), Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
                    adminSession.Save(policy);
                    var jobIndexCategory = new PMSAdmin.Domain.Model.JobIndices.JobIndexCategory(
                        new PMSAdmin.Domain.Model.JobIndices.AbstractJobIndexId(x + 1), null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
                    adminSession.Save(jobIndexCategory);
                    jobIndex = new PMSAdmin.Domain.Model.JobIndices.JobIndex(
                        new PMSAdmin.Domain.Model.JobIndices.AbstractJobIndexId(x + 2), jobIndexCategory, Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
                    adminSession.Save(jobIndex);

                    unit = new PMSAdmin.Domain.Model.Units.Unit(new PMSAdmin.Domain.Model.Units.UnitId(x + 3), Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
                    adminSession.Save(unit);
                    job = new PMSAdmin.Domain.Model.Jobs.Job(new PMSAdmin.Domain.Model.Jobs.JobId(x + 4), Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
                    adminSession.Save(job);
                    jobPosition = new JobPosition(new PMSAdmin.Domain.Model.JobPositions.JobPositionId(x + 5)
                                                  , Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
                    adminSession.Save(jobPosition);

                    adminSession.Flush();
                    tr.Complete();
                }

            long     y = x - 4;
            Employee emp;

            using (var tr = new TransactionScope())
                using (var session = PMSSession.GetSession())
                {
                    var policy2 = session.Get <MITD.PMS.Domain.Model.Policies.RuleEngineBasedPolicy>(
                        new MITD.PMS.Domain.Model.Policies.PolicyId(policy.Id.Id));
                    var period = new Period(new PeriodId(y), Guid.NewGuid().ToString(), DateTime.Now, DateTime.Now, 91);

                    //period.Activate(null);
                    session.Save(period);
                    emp = new Employee(Guid.NewGuid().ToString(), period, Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
                    session.Save(emp);
                    var calc = new Calculation(new CalculationId(y), period, policy2, Guid.NewGuid().ToString(), DateTime.Now, "1");
                    session.Save(calc);
                    var jobIndexGroup = new JobIndexGroup(new AbstractJobIndexId(y), period, null, Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
                    session.Save(jobIndexGroup);
                    var ji = new JobIndex(new AbstractJobIndexId(y + 1), period, new SharedJobIndex(
                                              new SharedJobIndexId(jobIndex.Id.Id), jobIndex.Name, jobIndex.DictionaryName), jobIndexGroup, true);
                    session.Save(ji);
                    var j = new Job(period, new SharedJob(new SharedJobId(job.Id.Id), job.Name, job.DictionaryName));
                    session.Save(j);
                    var u = new Unit(period, new SharedUnit(new SharedUnitId(unit.Id.Id), unit.Name, unit.DictionaryName), null);
                    session.Save(u);
                    var jp = new Domain.Model.JobPositions.JobPosition(period, new SharedJobPosition(
                                                                           new SharedJobPositionId(jobPosition.Id.Id), jobPosition.Name, jobPosition.DictionaryName), null, j, u);
                    session.Save(jp);
                    EmployeePoint p = new JobIndexPoint(new CalculationPointId(y), period, emp, calc, jp, ji, "hh", 10);
                    session.Save(p);
                    p = new SummaryEmployeePoint(new CalculationPointId(y + 1), period, emp, calc, "ff", 10);
                    session.Save(p);
                    session.Flush();
                    tr.Complete();
                }
            using (var tr = new TransactionScope())
                using (var session = PMSSession.GetSession())
                {
                    var lst = session.Query <EmployeePoint>().ToList();
                    session.Flush();
                    tr.Complete();
                }
        }
Beispiel #5
0
        public void JobIndexInPeriodTest()
        {
            long nextAbsIndexId;
            long jobIndexId;

            using (var session = PMSSession.GetSession())
                using (session.BeginTransaction())
                {
                    var period = session.Query <Period>().FirstOrDefault();

                    nextAbsIndexId =
                        session.CreateSQLQuery("Select next value for dbo.Periods_AbstractJobIndexSeq").UniqueResult <long>();
                    var rootJobIndexCat = new JobIndexGroup(new AbstractJobIndexId(nextAbsIndexId), period, null,
                                                            Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
                    session.Save((AbstractJobIndex)rootJobIndexCat);

                    SharedJobIndex            sharedJobIndex;
                    SharedJobIndexCustomField sharedJobIndexCustomField;

                    using (var sessionAdmin = PMSAdminSession.GetSession())
                    {
                        var pmsAdminJobIndex =
                            sessionAdmin.Query <MITD.PMSAdmin.Domain.Model.JobIndices.JobIndex>().FirstOrDefault();
                        sharedJobIndex = new SharedJobIndex(new SharedJobIndexId(pmsAdminJobIndex.Id.Id),
                                                            pmsAdminJobIndex.Name, pmsAdminJobIndex.DictionaryName);

                        var customFld = sessionAdmin.Query <CustomFieldType>().SingleOrDefault();
                        sharedJobIndexCustomField =
                            new SharedJobIndexCustomField(new SharedJobIndexCustomFieldId(customFld.Id.Id), customFld.Name,
                                                          customFld.DictionaryName, 1, 100);
                    }

                    nextAbsIndexId =
                        session.CreateSQLQuery("Select next value for dbo.Periods_AbstractJobIndexSeq").UniqueResult <long>();
                    var jobIndex = new JobIndex(new AbstractJobIndexId(nextAbsIndexId), period, sharedJobIndex,
                                                rootJobIndexCat, true);
                    jobIndex.UpdateCustomFields(new Dictionary <SharedJobIndexCustomField, string>()
                    {
                        { sharedJobIndexCustomField, "asdasdasdasd" }
                    });

                    session.Save(jobIndex);
                    session.Transaction.Commit();
                }
            using (var session = PMSSession.GetSession())
                using (session.BeginTransaction())
                {
                    var jobIndex =
                        session.Query <JobIndex>().SingleOrDefault(j => j.Id == new AbstractJobIndexId(nextAbsIndexId));

                    //    var rootJobIndexCat = session.Query<JobIndexCategory>().SingleOrDefault(p => p.Id == new AbstractJobIndexId(nextAbsIndexId));



                    //    nextAbsIndexId = session.CreateSQLQuery("Select next value for dbo.AbstractJobIndexSeq").UniqueResult<long>();
                    //    var jobIndexCat = new JobIndexCategory(new AbstractJobIndexId(nextAbsIndexId), rootJobIndexCat, Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
                    //    session.Save((AbstractJobIndex)jobIndexCat);

                    //    jobIndexId = session.CreateSQLQuery("Select next value for dbo.AbstractJobIndexSeq").UniqueResult<long>();
                    //    var jobIndex = new JobIndex(new AbstractJobIndexId(jobIndexId), jobIndexCat, Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
                    //    session.Save((AbstractJobIndex)jobIndex);

                    //    session.Transaction.Commit();
                }
        }