Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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);
        }
Пример #8
0
        /// <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);
        }