/// <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 BOSEntitiesResponse Any(StoreBOSEntities request) { BOSEntitiesResponse response = new BOSEntitiesResponse(); IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> _repository = _DataRepositoryFactory.GetDataRepository <IGenericEntityRepositoryBase <BOSEntity, IDataContextBOS> >(); response.BOSEntities = _repository.CreateUpdateList(request.BOSEntities.ConvertAllTo <BOSEntity>().ToList(), CurrentSessionUsername).ConvertAllTo <BOSEntityDto>().ToList(); return(response); }
/// <summary> /// Update or create a list of EntityRules. /// </summary> /// <param name="request">The request containing the EntityRules that needs to be created or updated</param> /// <returns>the list of values updated or created will be returned.</returns> public virtual JarsRulesResponse Any(StoreJarsRules request) { //return ExecuteFaultHandledMethod(() => //{ JarsRulesResponse response = new JarsRulesResponse(); IGenericEntityRepositoryBase <JarsRule, IDataContextNhJars> _repository = _DataRepositoryFactory.GetDataRepository <IGenericEntityRepositoryBase <JarsRule, IDataContextNhJars> >(); response.Rules = _repository.CreateUpdateList(request.Rules, CurrentSessionUsername).ToList(); return(response); // }); }
/// <summary> /// Save or update aa list of records. /// </summary> /// <param name="request">The request containing the entities that needs to be stored (created or updated)</param> /// <returns></returns> public JarsDefaultAppointmentsResponse Any(StoreJarsDefaultAppointments request) { return(ExecuteFaultHandledMethod(() => { IGenericEntityRepositoryBase <JarsDefaultAppointment, IDataContextNhJars> repository = _DataRepositoryFactory.GetDataRepository <IGenericEntityRepositoryBase <JarsDefaultAppointment, IDataContextNhJars> >(); var appts = repository.CreateUpdateList(request.Appointments.ConvertAllTo <JarsDefaultAppointment>().ToList(), CurrentSessionUsername); JarsDefaultAppointmentsResponse response = new JarsDefaultAppointmentsResponse { Appointments = appts.ConvertAllTo <JarsDefaultAppointmentDto>().ToList() }; return response; })); }
/// <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; //} }