public void GivenValidData_WhenISearchForGridRunsGivenApplicaiton_IGetAGridRunReturned() { _gridRunRepository.Setup(g => g.GetGridRun(It.IsAny <string>(), It.IsAny <string>())); _gridRunService.GetGridRun(It.IsAny <string>(), It.IsAny <string>()); _gridRunRepository.Verify(g => g.GetGridRun(It.IsAny <string>(), It.IsAny <string>()), Times.Once()); }
public void ProcessHouseHoldingRun() { HouseHoldingRunData houseHoldingRunData = _houseHoldingFileRepository.GetHouseHoldingData(); var houseHoldingRun = new HouseHoldingRun { Grid = houseHoldingRunData.Grid, StartDate = houseHoldingRunData.StartDate, EndDate = houseHoldingRunData.EndDate }; _houseHoldingRunRepository.Create(houseHoldingRun); foreach (var grid in houseHoldingRunData.ProcessingGridRun) { var gridRun = _gridRunService.GetGridRun(grid); _gridRunService.Update(gridRun.Id, gridRun.StartDate, gridRun.EndDate, gridRun.Status, gridRun.XmlFileId, houseHoldingRun.Id); } foreach (var documentData in houseHoldingRunData.DocumentRunData) { var document = _documentService.GetDocument(documentData.DocumentId); var houseHold = new HouseHold() { HouseHoldDate = DateTime.Now, DocumentId = document.Id }; _houseHoldRepository.Create(houseHold); _documentService.Update(document.Id, houseHoldingRun.Id); } }
private void ProcessXMLFile(string dataFile) { NexdoxMessaging.SendMessage(string.Format("Processing file {0}", dataFile), true, this); XmlDataExtractor xmlDataExtractor = new XmlDataExtractor(); var grid = xmlDataExtractor.GetGrid(dataFile); var extractedDocuments = xmlDataExtractor.GetDocument(dataFile); string applicationCode = extractedDocuments.First().Application; _gridRunEngine.ProcessGridRun( string.Empty, applicationCode, string.Empty, grid, null, null, GridRunStatus.Undefined, null); var gridRun = _gridRunService.GetGridRun(applicationCode, grid); NexdoxMessaging.SendMessage(string.Format("Grid processed"), true, this); foreach (var document in extractedDocuments) { var subDocTypeData = this.GetSubDocTypeData(document.SubDocType); var manCoData = this.GetManCoData(document.ManCoCode); var autoApproval = this._documentApprovalService.GetAutoApproval(manCoData.ManCoId, subDocTypeData.DocTypeId, subDocTypeData.SubDocTypeId); SaveDocumentToDatabase(document, subDocTypeData.DocTypeId, subDocTypeData.SubDocTypeId, manCoData.ManCoId, gridRun.Id); if (autoApproval != null) { NexdoxMessaging.SendMessage(string.Format("Document {0} automatically approved", document.DocumentId), true, this); _approvalEngine.AutoApproveDocument(document.DocumentId); } else { NexdoxMessaging.SendMessage(string.Format("Document {0} requires manual approval approved", document.DocumentId), true, this); } } }
public ActionResult Status(int gridRunId) { var gridRun = _gridRunService.GetGridRun(gridRunId); return(PartialView("_GridRunStatus", new GridRunStatusViewModel(gridRun))); }