public OrderService(IRepositoryProvider repositoryProvider) : base(repositoryProvider) { ordeRepository = repositoryProvider.GetRepository <Order>(); detailRepository = repositoryProvider.GetRepository <OrderDetail>(); useRepository = repositoryProvider.GetRepository <User>(); }
public object LoadModel(string entryId) { var assetEntry = repositoryProvider.GetRepository <IDbAsset>().GetById(entryId); if (assetEntry == null) { throw new Exception($"Asset error: {entryId}"); } var formatType = formatMan.GetFormatType(assetEntry.FormatType); if (formatType == null) { throw new Exception($"Unknown format {assetEntry.FormatType}"); } var ds = dataSources.GetDataSource(assetEntry.DataSourceRef); if (ds == null) { throw new Exception($"Unknown DataSourceRef {assetEntry.DataSourceRef}"); } return(formatType.Load(ds, assetEntry.Parameters)); }
public MapModel GetMap(string id) { var entry = repositoryProvider.GetRepository <IDbMap>().GetById(id); if (entry == null) { throw new Exception("Map error: " + id); } if (entry.DataRef == null) { return(null); } var map = provider.GetModel <MapModel>(entry.DataRef); if (entry.TileSetRef != null) { map.TileSet = tileAtlasDataProvider.GetTileAtlas(entry.TileSetRef); } map.Palettes.Clear(); foreach (var paletteRef in entry.PaletteRefs) { map.Palettes.Add(palettes.GetPalette(paletteRef)); } if (entry.ActionSetRef != null) { map.ActionSet = actionSets.GetActionSet(entry.ActionSetRef); } return(map); }
public Task <IList <T> > GetAll <T>() where T : class { var tcs = new TaskCompletionSource <IList <T> >(); Action onRun = () => { var result = _context.GetRepository <T>().GetAll(); tcs.SetResult(result); }; Action onCancelled = () => tcs.SetCanceled(); Action <Exception> onException = (ex) => tcs.SetException(ex); _taskqueue.Add(new WorkItem(onRun, onCancelled, onException, null)); return(tcs.Task); }
public LinksController( UserManager <ApplicationUser> userManager, IRepositoryProvider repositoryProvider, ILogger <LinksController> logger) { this.repository = repositoryProvider.GetRepository <TaggedLink>("links"); this.userManager = userManager; this.logger = logger; }
public void Execute(SystemTask selectedTask) { var repository = _repositoryProvider.GetRepository <SystemTask>(); var taskToRemove = repository.Find(selectedTask.Id); repository.Remove(taskToRemove); _repositoryProvider.SaveChanges(); }
public PaletteModel GetPalette(string id) { var entry = repositoryProvider.GetRepository <IDbPalette>().GetById(id); if (entry == null) { throw new Exception("Palette error: " + id); } return(GetModel(entry)); }
public SpriteSetModel GetSpriteSet(string id) { var entry = repositoryProvider.GetRepository <IDbSpriteAtlas>().GetById(id); if (entry == null) { throw new Exception("SpriteSet error: " + id); } return(GetModel(entry)); }
public EntityTemplateModel GetEntityTemplate(string id) { var entry = repositoryProvider.GetRepository <IDbEntityTemplate>().GetById(id); if (entry == null) { throw new Exception("Script error: " + id); } return(GetModel(entry)); }
public TextModel GetText(string id) { var entry = repositoryProvider.GetRepository <IDbText>().GetById(id); if (entry == null) { throw new Exception("Text error: " + id); } return(GetModel(entry)); }
public IRepository <TEntity> Create <TEntity>() where TEntity : class { var repository = _repositoryProvider.GetRepository <TEntity>(_sessionProvider.CurrentSession); if (repository != null) { return((IRepository <TEntity>)repository); } return(new NhRepository <TEntity>(_sessionProvider.CurrentSession)); }
public void Init(string[] propertyNames, IRepositoryProvider rep, string whereClause) { this.KeyDown += new KeyEventHandler(ListLookupTextbox_KeyDown); this.DoubleClick += new EventHandler(ListLookupTextbox_DoubleClick); this.ReadOnly = true; _propertyNames = propertyNames; //here this is much easier to do because we know T; in DynamicEdit we need to use reflection/emit/expressions... Func <IList <T> > getlist = () => { return(rep.GetRepository <T>().SearchFor(whereClause).ToList()); }; _getList = getlist; }
/// <summary> /// Retrieve the test data for the patient's admittance history /// </summary> /// <param name="admittances">Patient Admittance history</param> /// <param name="patientId">Patient ID</param> /// <returns>Admittance History with test results data</returns> private AdmittanceCollection GetAdmittanceHistoryTests(IRepositoryProvider factory, AdmittanceCollection admittances, string patientId) { AdmittanceCollection admittanceHistory = admittances; // factory.Get<IRepository<Test>>("TestRepository"); IRepository <Test> testRepository = factory.GetRepository <Test>("TestRepository"); IRepository <ClinicalNote> clinicalNoteRepository = factory.GetRepository <ClinicalNote>("ClinicalNoteRepository"); foreach (Admittance admittance in admittanceHistory) { CommandCriteria criteria = new CommandCriteria(); criteria.Add("PatientId", patientId); criteria.Add("AdmittanceId", admittance.ID.ToString()); admittance.Tests = new TestCollection(testRepository.SelectCollection(criteria)); admittance.ClinicalNotes = new ClinicalNotesCollection(clinicalNoteRepository.SelectCollection(criteria)); } return(admittanceHistory); }
public void Execute(SystemTask selectedTask) { var repository = _repositoryProvider.GetRepository <SystemTask>(); var taskToEdit = repository.Find(selectedTask.Id); taskToEdit.Title = selectedTask.Title; taskToEdit.Description = selectedTask.Description; taskToEdit.Executors = selectedTask.Executors; taskToEdit.RegisterDate = selectedTask.RegisterDate; taskToEdit.CompletionDate = selectedTask.CompletionDate; _repositoryProvider.SaveChanges(); }
internal MqttClientImpl(IPacketChannelFactory channelFactory, IProtocolFlowProvider flowProvider, IRepositoryProvider repositoryProvider, IPacketIdProvider packetIdProvider, MqttConfiguration configuration) { receiver = new Subject <MqttApplicationMessage>(); this.channelFactory = channelFactory; this.flowProvider = flowProvider; sessionRepository = repositoryProvider.GetRepository <ClientSession>(); this.packetIdProvider = packetIdProvider; this.configuration = configuration; clientSender = TaskRunner.Get(); }
public void Init(string[] propertyNames, IRepositoryProvider rep, string whereClause) { this.DataSource = rep.GetRepository <T>().SearchFor(whereClause).ToList(); //defaults this.DisplayMember = propertyNames[1]; //IMPORTANT: This will throw an error if the ID property is decorated with [Browsable(false)]!!!! this.ValueMember = propertyNames[0]; //this.Enabled = false; //this.DropDownStyle = ComboBoxStyle.Simple; this.SelectedValueChanged += new EventHandler(LookupComboBox_SelectedValueChanged); }
public SoundModel GetSound(string id) { var entry = repositoryProvider.GetRepository <IDbSound>().GetById(id); if (entry == null) { throw new Exception("Sound error: " + id); } if (entry.DataRef == null) { return(null); } return(dataProvider.GetModel <SoundModel>(entry.DataRef)); }
public Image GetImage(string id) { var entry = repositoryProvider.GetRepository <IDbImage>().GetById(id); if (entry == null) { throw new Exception("Image error: " + id); } if (entry.DataRef == null) { return(null); } return(dataProvider.GetModel <Image>(entry.DataRef)); }
/// <summary> /// Logic for the Change Patient Command /// </summary> /// <param name="criteria">Criteria for the command</param> /// <returns>Result from executing the command</returns> /// <remarks>This command updates the admittance/patient object based in.</remarks> protected override object ProcessCommand(CommandCriteria criteria) { Patient patient = null; // Get the admittance from criteria - This will be the object that gets updated. Admittance admittance = criteria["Admittance"] as Admittance; if (admittance != null) { // Setup the criteria required by the repositories criteria.Add("PatientId", admittance.EDPatient.PatientID.ToString()); criteria.Add("AdmittanceId", admittance.ID.ToString()); // Get the Repository Provider IRepositoryProvider factory = DIManager.Current.Get <IRepositoryProvider>(); // Load the patient related data patient = admittance.EDPatient; patient.Admittances = new AdmittanceCollection( factory.GetRepository <Admittance>("AdmittanceRepository").SelectCollection(criteria)); patient.Allergies = new AllergyCollection( factory.GetRepository <PatientAllergy>("AlleryRepository").SelectCollection(criteria)); // Load the admittance related data admittance.Orders = new MedicationOrdersCollection( factory.GetRepository <Order>("OrderRepository").SelectCollection(criteria)); admittance.Tests = new TestCollection( factory.GetRepository <Test>("TestRepository").SelectCollection(criteria)); admittance.Vitals = new VitalsCollection( factory.GetRepository <Vital>("VitalRepository").SelectCollection(criteria)); admittance.ClinicalNotes = new ClinicalNotesCollection( factory.GetRepository <ClinicalNote>("ClinicalNoteRepository").SelectCollection(criteria)); this.GetAdmittanceHistoryTests(factory, patient.Admittances, admittance.EDPatient.PatientID.ToString()); } else { // If an admittance is not based in notify the caller throw new ApplicationException("Command requires a criteria parameter called Admittance."); } return(patient); }
public void Execute(SystemTask createdTask) { var repository = _repositoryProvider.GetRepository <SystemTask>(); SystemTask task = new SystemTask { Title = createdTask.Title, Description = createdTask.Description, Executors = createdTask.Executors, Status = TaskStatus.Appointed, RegisterDate = DateTime.Now, ParentSystemTask = null }; repository.Add(task); _repositoryProvider.SaveChanges(); }
public void Execute(SystemTask parentTask) { var repository = _repositoryProvider.GetRepository <SystemTask>(); //SystemTask task = new SystemTask //{ // Title = childTask.Title, // Description = childTask.Descriptiion, // Executors = childTask.Executors, // Status = TaskStatus.Appointed, // RegisterDate = childTask.RegisterDate, // CompletionDate = childTask.CompletionDate, // ParentSystemTask = parentTask //}; //repository.Find(parentTask.Id).ChildSystemTasks.Add(task); //_repositoryProvider.SaveChanges(); }
internal MqttClientImpl(IMqttChannel <IPacket> packetChannel, IProtocolFlowProvider flowProvider, IRepositoryProvider repositoryProvider, IPacketIdProvider packetIdProvider, MqttConfiguration configuration) { receiver = new ReplaySubject <MqttApplicationMessage> (window: TimeSpan.FromSeconds(configuration.WaitTimeoutSecs)); sender = new ReplaySubject <IPacket> (window: TimeSpan.FromSeconds(configuration.WaitTimeoutSecs)); this.packetChannel = packetChannel; this.flowProvider = flowProvider; sessionRepository = repositoryProvider.GetRepository <ClientSession> (); this.packetIdProvider = packetIdProvider; this.configuration = configuration; clientSender = TaskRunner.Get(); packetListener = new ClientPacketListener(packetChannel, flowProvider, configuration); packetListener.Listen(); ObservePackets(); }
public DataSourceBase GetDataSource(string name) { DataSourceBase ds = null; if (_openedDataSources.TryGetValue(name, out ds)) { return(ds); } var entry = repositoryProvider.GetRepository <IDbDataSource>().GetById(name); if (entry == null) { throw new Exception($"Data source error: {name}"); } ds = CreateDataSource(entry); return(ds); }
internal EntryEditorVM OpenEntryEditor(string tableName, string entryId) { var repository = repositoryProvider.GetRepository(tableName); string entryEditorKey = $"{tableName}#{entryId}"; EntryEditorVM entryEditor = null; if (!_openedEntryEditors.TryGetValue(entryEditorKey, out entryEditor)) { entryEditor = dbEntryEditorFactory.Create(repository); _openedEntryEditors.Add(entryEditorKey, entryEditor); entryEditor.ClosedAction = () => OnEntryEditorClosed(entryEditor); entryEditor.EditEntry(entryId); EntryEditorOpeningAction?.Invoke(entryEditor); } else { entryEditor.Activate(); } return(entryEditor); }
private T GetRepo <T>() where T : class { return(RepositoryProvider.GetRepository <T>()); }
public T GetRepository <T>() where T : class { return(_repositoryProvider.GetRepository <T>()); }
public Service(IRepositoryProvider repositoryProvider) { repository = repositoryProvider.GetRepository <TEntity>(); }
public RegisterUserCommandHandler(IRepositoryProvider provider) { _usersRepository = provider.GetRepository <IUsersRepository>(); }
public IRepository <TEntity> GetRepository <TEntity>() where TEntity : class { return(_repositoryProvider.GetRepository <TEntity>()); }
public async Task <TEntity> Get <TEntity>(Query <TEntity> query) where TEntity : BaseEntity { return(await _repositoryProvider.GetRepository <TEntity>().Get(query)); }