示例#1
0
 public async Task UpdateBEExecution(BEExecution updatedBEExecution)
 {
     using (var db = new BEMainDBContext()) {
         db.BEExecutions.AddOrUpdate(updatedBEExecution);
         await db.SaveChangesAsync();
     }
 }
示例#2
0
        public async Task <BEExecution> GetBEExecution(int id)
        {
            BEExecution bEExecution = null;

            using (var db = new BEMainDBContext()) {
                bEExecution = await db.BEExecutions.FindAsync(id);
            }
            return(bEExecution);
        }
示例#3
0
        public async Task <BEExecution> PostBEExecution(BEExecution newBEExecution)
        {
            BEExecution createdBEExecution = null;

            using (var db = new BEMainDBContext()) {
                createdBEExecution = db.BEExecutions.Add(newBEExecution);
                await db.SaveChangesAsync();
            }
            return(createdBEExecution);
        }
        /************************* Internal  Methods *************************/

        // Creates the BEExecution, in a Reliable way (if it hasn't already been created)
        private async Task initExecution(BESearchRequest theSearchRequest)
        {
            if (theSearchRequest.hasCreatedLastExecution() == false)
            {
                BEExecution createdBEExecution = await dbHandlerService.StoreExecution(
                    new BEExecution( theSearchRequest.ID, DateTime.Now, null ));

                theSearchRequest.ActiveExecutionID = createdBEExecution.ID;
                await SaveTheSearchRequest(theSearchRequest);
            }
        }
示例#5
0
        public async Task UpdateSearchRequestFulfilled(int searchRequestID, int executionID, Results theResults)
        {
            BESearchRequest theSReq = await TheSReqsContr.GetBESearchRequest(searchRequestID);

            theSReq.TheStatus = Status.Fulfilled;
            await TheSReqsContr.UpdateBESearchRequest(theSReq);

            BEExecution theExec = await TheExecsContr.GetBEExecution(executionID);

            theExec.FinishedOn = DateTime.Now;
            await TheExecsContr.UpdateBEExecution(theExec);

            theResults.ID = executionID;
            await TheResultsContr.PostResults(theResults);
        }
示例#6
0
 /*---------- Execution Management ----------*/
 public async Task <BEExecution> StoreExecution(BEExecution newBEExecution)
 {
     return(await TheExecsContr.PostBEExecution(newBEExecution));
 }