Пример #1
0
        public SimpleSchedForm(Core.Interfaces.Repositories.IDataRepositoryFactory _repFactory)
        {
            InitializeComponent();
            _repoFactory = _repFactory;
            processor    = new StandardAppointmentProcessor();

            IGenericEntityRepositoryBase <JarsResource, IDataContextNhJars> jarsRepo = _repFactory.GetDataRepository <IGenericEntityRepositoryBase <JARS.Entities.JarsResource, IDataContextNhJars> >();

            List <JarsResource> ResList = jarsRepo.GetAll().ToList();

            resourceBindingSource.DataSource = ResList;
        }
Пример #2
0
        /// <summary>
        /// Find a list of appointments depending on the criteria given in the Find request.
        /// If the request does not contain any values for filtering all the records will be returned.
        /// </summary>
        /// <param name="request">The request containing the search criteria.</param>
        /// <returns>a list of StandardAppointmentDefault entities.</returns>
        public JarsDefaultAppointmentsResponse Any(FindJarsDefaultAppointments request)
        {
            IGenericEntityRepositoryBase <JarsDefaultAppointment, IDataContextNhJars> repository = _DataRepositoryFactory.GetDataRepository <IGenericEntityRepositoryBase <JarsDefaultAppointment, IDataContextNhJars> >();
            JarsDefaultAppointmentsResponse response = new JarsDefaultAppointmentsResponse();

            if (request.DescriptionLike != null)
            {
                response.Appointments = repository.Where(d => d.Description.IsLike(request.DescriptionLike)).ToList().ConvertAll(s => s.ConvertTo <JarsDefaultAppointmentDto>());
            }
            else
            {
                response.Appointments = repository.GetAll().ToList().ConvertAll(s => s.ConvertTo <JarsDefaultAppointmentDto>());
            }

            return(response);
        }
Пример #3
0
        public void obtain_generic_repository_using_MEF_and_read_and_create_records()
        {
            //now only using mef test the obtainment
            IGenericEntityRepositoryBase <JarsJob, IDataContextNhJars> jarsRep = _repFactory.GetDataRepository <IGenericEntityRepositoryBase <JarsJob, IDataContextNhJars> >();
            IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS>  extRep  = _repFactory.GetDataRepository <IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> >();

            //assert creation
            //Assert.IsNotNull(qlRep);
            Assert.IsNotNull(jarsRep);
            Assert.IsNotNull(extRep);

            //list the jobs from each repository
            IList <JarsJob> jarsJobs = jarsRep.GetAll();

            Assert.IsTrue(jarsJobs != null);

            IList <BOSEntity> extHeads = extRep.GetAll();

            Assert.IsTrue(extHeads != null);


            //greate a record
            JarsJob jj = jarsRep.CreateUpdate(new JarsJob(), "MEF_GEN_TEST");

            Assert.IsTrue(jj.Id > 0);

            BOSEntity xj = extRep.CreateUpdate(new BOSEntity(), "MEF_GEN_TEST");

            Assert.IsTrue(xj.Id > 0);


            //get a record from each repository
            JarsJob job = jarsRep.GetById((long)1);

            Assert.IsTrue(job.Id == 1);

            BOSEntity header = extRep.GetById(1);

            Assert.IsTrue(header.Id == 1);
        }