public List <Document> GetDocumentsForSync(string InspectionID, string projectID) { List <Document> documents = new List <Document>(); try { documents = DocumentDO.getDocumentsList(conn, InspectionID, projectID); } catch (Exception ex) { Debug.WriteLine("Exception Occured in DeleteInspection method due to " + ex.Message); } return(documents); }
public int DeleteDocumentItemsForSync(string InspectionID, string projectID) { int result = 0; try { result = DocumentDO.DeleteDocument(conn, InspectionID, projectID); } catch (Exception ex) { Debug.WriteLine("Exception Occured in DeleteInspection method due to " + ex.Message); } return(result); }
public int DeleteDocumentItems(Document document) { int result = 0; try { DocumentDO documentDO = Converter.GetDocumentDO(document); result = docRepository.DeleteEntity(documentDO.ID); } catch (Exception ex) { Debug.WriteLine("Exception Occured in DeleteInspection method due to " + ex.Message); } return(result); }
public static Document GetDocument(DocumentDO documentDO) { Document document = new Document() { ID = documentDO.ID, inspectionID = documentDO.InspectionID, inspectionDocumentType = (DocumentType)documentDO.DocumentTypeID, documentDisplayName = documentDO.DocumentName, documentArray = documentDO.DocumentDesc, documentID = documentDO.ServiceDocID, projectID = documentDO.ProjectID, DocumentPath = documentDO.DocumentPath }; return(document); }
public static DocumentDO GetDocumentDO(Document document) { DocumentDO documentDO = new DocumentDO() { ID = document.ID, InspectionID = document.inspectionID, DocumentTypeID = (int)document.inspectionDocumentType, DocumentName = document.documentDisplayName, DocumentDesc = document.documentArray, ServiceDocID = document.documentID, ProjectID = document.projectID, DocumentPath = document.DocumentPath }; return(documentDO); }
public Document GetLastItem() { Document document = new Document(); try { DocumentDO DocumentDo = docRepository.GetEntities().LastOrDefault(); if (DocumentDo != null) { document = Converter.GetDocument(DocumentDo); } } catch (Exception ex) { Debug.WriteLine("Exception Occured in GetLastItem method due to " + ex.Message); } return(document); }
public int DeleteInspectionTransactionNotSync(Inspection inspection) { int inspectionTransactionResult = 0; try { IEnumerable <InspectionTransactionDO> inspections = inspectionTransactionRepository.GetEntities(); InspectionTransactionDO inspectionTransactionDO = inspections.FirstOrDefault(ins => ins.InspectionID == inspection.inspectionID && ins.ProjectID == inspection.projectID); inspectionTransactionResult = inspectionTransactionRepository.DeleteEntity(inspectionTransactionDO.ID); LocationImageDo.DeleteImage(conn, inspectionTransactionDO.ID); DocumentDO.DeleteDocument(conn, inspection.inspectionID, inspection.projectID); PunchListDO.DeletePunchList(conn, inspection.inspectionID, inspection.projectID); PunchListImageDO.DeletePunchListImageList(conn, inspection.ID); ReportDO.DeleteReports(conn, inspection.ID); using (var optService = new OptionTransactionService(conn)) { var optIds = optService.GetOptionTransactionsForInspection(inspection.ID).Select(s => s.ID); OptionTransactionDO.DeleteInspectionOptions(conn, inspection.ID); if (optIds != null && optIds.Count() > 0) { foreach (var optID in optIds) { var chkTransIDs = CheckListTransactionDO.GetCheckListTransaction(conn, optID).Select(s => s.ID); CheckListTransactionDO.DeletecheckList(conn, optID); OptionTransactionImageDO.DeleteOptionImagesSync(conn, optID); if (chkTransIDs != null && chkTransIDs.Count() > 0) { foreach (var chkId in chkTransIDs) { GuildedPhotoDO.DeleteGuidedImageList(conn, chkId); } } } } } } catch (Exception ex) { Debug.WriteLine("Exception Occured in DeleteInspectionTransaction method due to " + ex.Message); } return(inspectionTransactionResult); }
/// <summary> /// Gets the document. /// </summary> /// <returns>The document.</returns> /// <param name="documentID">Document I.</param> /// <param name="token">Token.</param> public Document GetDocument(int documentID, string token) { Document document = new Document(); try { DocumentDO documentDo = docRepository.GetEntity(documentID); if (documentDo != null) { document = Converter.GetDocument(documentDo); } if (document.DocumentPath == null) { ServiceResonse = new Model.ServiceModel.DocumentRes(); IServices service = new Services(); ServiceResonse = service.FetchDocument(new Model.ServiceModel.DocumentReq() { documentID = document.documentID, documentType = document.inspectionDocumentType, token = token }); if (ServiceResonse != null && ServiceResonse.result.code == 0) { document.documentArray = ServiceResonse.document; document.documentID = ServiceResonse.documentID; } } } catch (Exception ex) { Debug.WriteLine("Exception Occured in GetDocument method due to " + ex.Message); } return(document); }