Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="item"></param>
        /// <param name="connectionString"></param>
        /// <param name="sessionTicket"></param>
        /// <param name="transaction"></param>
        /// <returns></returns>
        /// get id for download pdf report
        public string GetDownloadURL(Receipt_Model item, string connectionString, string sessionTicket, out TransactionalInformation transaction)
        {
            var method = MethodInfo.GetCurrentMethod();
            var ipInfo = Util.GetIPInfo(HttpContext.Current.Request);

            transaction = new TransactionalInformation();
            List <Guid> response       = new List <Guid>();
            var         securityTicket = VerifySessionToken(sessionTicket);
            var         data           = cls_Get_Account_Information_with_PracticeID.Invoke(connectionString, securityTicket).Result;

            var downloadURL = "";

            try
            {
                var  _providerFactory = ProviderFactory.Instance;
                var  documentProvider = _providerFactory.CreateDocumentServiceProvider();
                Guid id = Guid.Empty;
                Guid.TryParse(item.documentID, out id);
                downloadURL = documentProvider.GenerateImageThumbnailLink(id, sessionTicket, true, null, true);
            }
            catch (Exception ex)
            {
                Logger.LogDocAppInfo(new LogEntry(ipInfo.address, ipInfo.agent, connectionString, method, securityTicket, ex), data.PracticeName);

                transaction.ReturnMessage = new List <string>();
                string errorMessage = ex.Message;
                transaction.ReturnStatus = false;
                transaction.ReturnMessage.Add(errorMessage);
                transaction.IsAuthenicated = true;
                transaction.IsException    = true;
            }

            return(downloadURL);
        }
Ejemplo n.º 2
0
        public HttpResponseMessage DownloadDocumentItem(Receipt_Model item)
        {
            TransactionalInformation transaction = new TransactionalInformation();
            string downloadURL = receiptDataService.GetDownloadURL(item, connectionString, SessionToken, out transaction);

            if (transaction.ReturnStatus)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, downloadURL));
            }

            return(Request.CreateResponse <TransactionalInformation>(HttpStatusCode.InternalServerError, transaction));
        }
Ejemplo n.º 3
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_ARCH_UPD_1434 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();
            //Put your code here

            var documentUpload = new ORM_DOC_Document();
            documentUpload.DOC_DocumentID     = Guid.NewGuid();
            documentUpload.IsDeleted          = false;
            documentUpload.Creation_Timestamp = DateTime.Now;
            documentUpload.Tenant_RefID       = securityTicket.TenantID;
            documentUpload.Alias       = Parameter.RecepiantID.ToString();
            documentUpload.PrimaryType = Parameter.AmountNo.ToString();
            documentUpload.GlobalPropertyMatchingID = "pdf doc";
            documentUpload.Save(Connection, Transaction);


            var documentUploadRevision = new ORM_DOC_DocumentRevision();
            documentUploadRevision.DOC_DocumentRevisionID = Guid.NewGuid();
            documentUploadRevision.Creation_Timestamp     = DateTime.Now;
            documentUploadRevision.File_MIMEType          = Parameter.Mime;
            documentUploadRevision.IsDeleted           = false;
            documentUploadRevision.Tenant_RefID        = securityTicket.TenantID;
            documentUploadRevision.Document_RefID      = documentUpload.DOC_DocumentID;
            documentUploadRevision.UploadedByAccount   = securityTicket.AccountID;
            documentUploadRevision.File_ServerLocation = Parameter.DocumentID.ToString();
            documentUploadRevision.File_Name           = Parameter.DocumentName;
            documentUploadRevision.File_Description    = Parameter.Description;
            documentUploadRevision.Save(Connection, Transaction);

            var usrAccount = ORM_USR_Account.Query.Search(Connection, Transaction, new ORM_USR_Account.Query()
            {
                IsDeleted     = false,
                Tenant_RefID  = securityTicket.TenantID,
                USR_AccountID = securityTicket.AccountID
            }).Single();
            Guid DocStructureGuid = Guid.NewGuid();
            var  docStructureQ    = ORM_DOC_Structure.Query.Search(Connection, Transaction, new ORM_DOC_Structure.Query()
            {
                IsDeleted    = false,
                Tenant_RefID = securityTicket.TenantID,
                Label        = usrAccount.BusinessParticipant_RefID.ToString()
            }).SingleOrDefault();
            if (docStructureQ == null)
            {
                var docStructure = new ORM_DOC_Structure();
                docStructure.DOC_StructureID    = DocStructureGuid;
                docStructure.IsDeleted          = false;
                docStructure.Tenant_RefID       = securityTicket.TenantID;
                docStructure.Label              = usrAccount.BusinessParticipant_RefID.ToString();
                docStructure.Creation_Timestamp = DateTime.Now;
                docStructure.Save(Connection, Transaction);
            }
            else
            {
                DocStructureGuid = docStructureQ.DOC_StructureID;
            }

            var doc2docStructure = new ORM_DOC_Document_2_Structure();
            doc2docStructure.IsDeleted          = false;
            doc2docStructure.Tenant_RefID       = securityTicket.TenantID;
            doc2docStructure.Creation_Timestamp = DateTime.Now;
            doc2docStructure.AssignmentID       = Guid.NewGuid();
            doc2docStructure.Document_RefID     = documentUpload.DOC_DocumentID;
            doc2docStructure.Structure_RefID    = DocStructureGuid;
            doc2docStructure.Save(Connection, Transaction);

            Receipt_Model receipt = new Receipt_Model();
            receipt.id             = documentUpload.DOC_DocumentID.ToString();
            receipt.documentID     = Parameter.DocumentID.ToString();
            receipt.filedate       = Parameter.DocumentDate;
            receipt.filedateString = Parameter.DocumentDate.ToString("dd.MM.yyyy");
            receipt.period         = Parameter.Description;
            receipt.periodDate     = Parameter.DocumentDate;
            receipt.amount         = Parameter.Amount;
            receipt.doctorID       = Parameter.RecepiantID.ToString();
            receipt.amountNo       = Parameter.AmountNo;
            receipt.isViewed       = false;

            Add_Item_to_Receipts.Import_Receipt_Item_to_ElasticDB(new List <Receipt_Model>()
            {
                receipt
            }, securityTicket.TenantID.ToString());

            return(returnValue);

            #endregion UserCode
        }