コード例 #1
0
ファイル: BOSEntityService.cs プロジェクト: CobyC/JaRS
        public virtual object Any(StoreMobileBOSEntity request)
        {
            MobileBOSEntityResponse response = new MobileBOSEntityResponse();
            IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> _repository = _DataRepositoryFactory.GetDataRepository <IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> >();

            if (request.BOSEntity != null)
            {
                BOSEntity old  = _repository.GetById(request.BOSEntity.Id);
                BOSEntity updt = old.PopulateWith(request.BOSEntity);
                updt = _repository.CreateUpdate(updt, CurrentSessionUsername);

                response.BOSEntity = updt.ConvertTo <MobileBOSEntityDto>();

                TrySendStoreNotificationToChannel(typeof(BOSEntity).Name, new List <BOSEntity> {
                    updt
                }.ToJson());
            }

            return(new HttpResult(response)
            {
                ResultScope = () =>
                              JsConfig.With(new Config {
                    DateHandler = DateHandler.ISO8601
                })
            });
            //using (JsConfig.With(new Config { DateHandler = DateHandler.ISO8601 }))
            //{
            //    return response;
            //}
        }
コード例 #2
0
        void CreateDefaultRecord(FindApptLabels request, IGenericEntityRepositoryBase <ApptLabel, IDataContextNhJars> repository)
        {
            ApptLabel lbl = new ApptLabel()
            {
                UseInterfaceType = request.InterfaceTypeName,
                ViewName         = request.ViewType,
                LabelCriteria    = ""
            };

            lbl = repository.CreateUpdate(lbl, "SYSTEM");

            Type t = Type.GetType(request.InterfaceTypeName);

            if (t == typeof(IEntityWithStatusLabels))
            {
                lbl.LabelCriteria = $"([LabelKey] = '{lbl.Id}')";
                lbl = repository.CreateUpdate(lbl, "SYSTEM");
            }
        }
コード例 #3
0
ファイル: ApptStatusService.cs プロジェクト: CobyC/JaRS
        void CreateDefaultRecord(FindApptStatuses request, IGenericEntityRepositoryBase <ApptStatus, IDataContextNhJars> repository)
        {
            ApptStatus sts = new ApptStatus()
            {
                UseInterfaceType = request.InterfaceTypeName,
                ViewName         = request.ViewType,
                StatusCriteria   = ""
            };

            sts = repository.CreateUpdate(sts, "SYSTEM");

            Type t = Type.GetType(request.InterfaceTypeName);

            if (t == typeof(IEntityWithStatusLabels))
            {
                sts.StatusCriteria = $"([StatusKey] = '{sts.Id}')";
                repository.CreateUpdate(sts, "SYSTEM");
            }
        }
コード例 #4
0
ファイル: BOSEntityService.cs プロジェクト: CobyC/JaRS
        public virtual BOSEntityResponse Any(StoreBOSEntity request)
        {
            BOSEntityResponse response = new BOSEntityResponse();
            IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> _repository = _DataRepositoryFactory.GetDataRepository <IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> >();

            if (request.BOSEntity != null)
            {
                response.BOSEntity = _repository.CreateUpdate(request.BOSEntity.ConvertTo <BOSEntity>(), CurrentSessionUsername).ConvertTo <BOSEntityDto>();
            }
            return(response);
        }
コード例 #5
0
        public void Create_Generic_Repository_Objects_With_Mef()
        {
            //IGenericEntityReadOnlyRepositoryBase<BOSExternalEntity, IDataContextExternalBOS> _ro_repository = _DataRepositoryFactory.GetDataRepository<IGenericEntityReadOnlyRepositoryBase<BOSExternalEntity, IDataContextExternalBOS>>();
            //var ro = _ro_repository.GetAll();

            IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> _repository = _DataRepositoryFactory.GetDataRepository <IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> >();
            var crud = _repository.CreateUpdate(new BOSEntity(), "TEST");

            Assert.IsNotNull(_bosContext);
            //Assert.IsNotNull(_bosExternalContext);
        }
コード例 #6
0
ファイル: JarsRuleService.cs プロジェクト: CobyC/JaRS
        /// <summary>
        /// Update or create a single EntityRule.
        /// </summary>
        /// <param name="request">The request containing the EntityRule to be created or updated</param>
        /// <returns>the updated value</returns>
        public virtual JarsRuleResponse Any(StoreJarsRule request)
        {
            //return ExecuteFaultHandledMethod(() =>
            //{
            JarsRuleResponse response = new JarsRuleResponse();
            IGenericEntityRepositoryBase <JarsRule, IDataContextNhJars> _repository = _DataRepositoryFactory.GetDataRepository <IGenericEntityRepositoryBase <JarsRule, IDataContextNhJars> >();

            response.Rule = _repository.CreateUpdate(request.Rule, CurrentSessionUsername);
            return(response);
            // });
        }
コード例 #7
0
        /// <summary>
        /// Save or update the a  single records.
        /// </summary>
        /// <param name="request">The request containing the entity that needs to be stored (created or updated)</param>
        /// <returns></returns>
        public JarsDefaultAppointmentResponse Any(StoreJarsDefaultAppointment request)
        {
            return(ExecuteFaultHandledMethod(() =>
            {
                IGenericEntityRepositoryBase <JarsDefaultAppointment, IDataContextNhJars> repository = _DataRepositoryFactory.GetDataRepository <IGenericEntityRepositoryBase <JarsDefaultAppointment, IDataContextNhJars> >();

                var appts = repository.CreateUpdate(request.Appointment.ConvertTo <JarsDefaultAppointment>(), CurrentSessionUsername);

                JarsDefaultAppointmentResponse response = new JarsDefaultAppointmentResponse
                {
                    Appointment = appts.ConvertTo <JarsDefaultAppointmentDto>()
                };

                return response;
            }));
        }
コード例 #8
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);
        }