예제 #1
0
        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
        public BOSEntityAppointmentForm(SchedulerControl schedulerControl, Appointment appointment) : base(schedulerControl, appointment)
        {
            InitializeComponent();
            _Appointment = appointment;
            BOSEntity editEntity = _Appointment.CustomFields["ENTITY"] as BOSEntity;

            bosEntityBindingSource.DataSource = editEntity;
            bosEntityBindingSource.ResetBindings(false);
        }
예제 #3
0
        SchedulerDragData GetDragData(GridView gridView)
        {
            Appointment appt = null;

            try
            {
                int[] selection = gridView.GetSelectedRows();
                if (selection == null)
                {
                    return(null);
                }

                if (gridView != null && gridView.FocusedRowHandle > -1)
                {
                    if (gridView.GetRow(gridView.FocusedRowHandle) is BOSEntity)
                    {
                        //BOSExternalEntity xdr = gridView.GetRow(gridView.FocusedRowHandle) as BOSExternalEntity;
                        BOSEntity dRec = gridView.GetRow(gridView.FocusedRowHandle) as BOSEntity;
                        appt             = schedulerDataStorage.CreateAppointment(AppointmentType.Normal);
                        appt.Description = dRec.Description;
                        appt.Duration    = TimeSpan.FromHours(dRec.Duration);
                        appt.Location    = dRec.Location;
                        appt.Subject     = dRec.ExtRefId;

                        //BOSEntity dRec = new BOSEntity();
                        appt.SetId(dRec.GuidValue);
                        //dRec.PopulateWith(dRec);
                        dRec.Id = 0;
                        //dRec.GuidValue = Guid.NewGuid().ToString();
                        //dRec.ExtRefId = xdr.Id.ToString();
                        //dRec.Description = xdr.Description;
                        dRec.ExtRefId = dRec.ExtRefId;
                        //dRec.Location = xdr.Location;
                        //dRec.LineOfWork = xdr.LineOfWork;
                        //dRec.ProgressStatus = xdr.ProgressStatus;
                        //dRec.Priority = xdr.Priority;
                        //dRec.TargetDate = xdr.TargetDate;

                        appt.CustomFields["ENTITY"] = dRec;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
                throw new Exception("GetDridData:", ex);
            }
            return(new SchedulerDragData(appt));
        }
예제 #4
0
        public async Task TestMethod1Async()
        {
            BOSEntity ent = new BOSEntity()
            {
                Id = 10
            };
            IProcessor processor = _factory.GetJarsProcessor <IProcessor>(ent.GetType().Name);

            if (processor is BOSEntityAppointmentProcessor proc)
            {
                //BOSEntityAppointmentProcessor proc = new BOSEntityAppointmentProcessor();
                await proc.LoadOrRefreshEntityDataAsync();

                var list = proc.DataList;
            }
        }
예제 #5
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);
        }
예제 #6
0
        /// <summary>
        /// Update or create a single BOSRecord or a list of BOSRecords, depending on whether the BOSRecord or BOSRecords property has got a value set.
        /// If the BOSRecord property is set the BOSRecord will be created or updated and the BOSRecords property will be ignored.
        /// To create or update more than one BOSRecord, assign a list to the BOSRecords property and make sure BOSRecord is set to nothing/null.
        /// </summary>
        /// <param name="request">The request containing the BOSRecord or BOSRecords that needs to be created or updated</param>
        /// <returns>depending on the values supplied, the updated BOSRecord or BOSRecords will be returned.</returns>
        public virtual object Any(StoreMobileBOSEntities request)
        {
            MobileBOSEntitiesResponse response = new MobileBOSEntitiesResponse();

            if (request.BOSEntities.Any())
            {
                IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> _repository = _DataRepositoryFactory.GetDataRepository <IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> >();
                List <int>        ids    = request.BOSEntities.Select(e => e.Id).ToList();
                IList <BOSEntity> oldies = _repository.Where(e => ids.Contains(e.Id)).ToList();
                foreach (var reqEntity in request.BOSEntities)
                {
                    BOSEntity old = oldies.SingleOrDefault(o => o.Id == reqEntity.Id);
                    if (old != null)
                    {
                        old.PopulateWith(reqEntity);
                    }
                }

                List <BOSEntity> updtList = _repository.CreateUpdateList(oldies, CurrentSessionUsername).ToList();

                response.BOSEntities = updtList.ConvertAllTo <MobileBOSEntityDto>().ToList();

                TrySendStoreNotificationToChannel(typeof(BOSEntity).Name, updtList.ToJson());

                //response.BOSEntities = _repository.MergeList(request.BOSEntities.ConvertAllTo<BOSEntity>().ToList(), CurrentSessionUsername).ConvertAllTo<MobileBOSEntityDto>().ToList();
            }
            return(new HttpResult(response)
            {
                ResultScope = () =>
                              JsConfig.With(new Config {
                    DateHandler = DateHandler.ISO8601
                })
            });
            //using (JsConfig.With(new Config { DateHandler = DateHandler.ISO8601 }))
            //{
            //    return response;
            //}
        }