示例#1
0
        private void updateDocumentLog(string reportPath, int claimID)
        {
            string appPath      = ConfigurationManager.AppSettings["appPath"].ToString();
            string documentPath = null;

            ClaimDocument objLeadDoc = new ClaimDocument();

            string ActualFileName = Path.GetFileName(reportPath);

            string FileNameWithoutExt = Path.GetFileNameWithoutExtension(reportPath);

            objLeadDoc.ClaimID = claimID;

            objLeadDoc.Description = "Invoice";

            objLeadDoc.DocumentName = ActualFileName;
            objLeadDoc.IsPrint      = false;

            objLeadDoc.DocumentDate = DateTime.Now;

            objLeadDoc = ClaimDocumentManager.Save(objLeadDoc);

            if (objLeadDoc.ClaimDocumentID > 0)
            {
                documentPath = string.Format("{0}/ClaimDocuments/{1}/{2}", appPath, claimID, objLeadDoc.ClaimDocumentID);
                if (!Directory.Exists(documentPath))
                {
                    Directory.CreateDirectory(documentPath);
                }

                File.Copy(reportPath, documentPath + "/" + ActualFileName, true);
            }
        }
示例#2
0
        public static void addReportToClaimDocument(string reportPath, int claimID, int invoiceNumber)
        {
            string claimDocumentPath   = null;
            string destinationFilePath = null;

            // get application path
            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();

            ClaimDocument claimDocument = new ClaimDocument();

            claimDocument.ClaimID      = claimID;
            claimDocument.IsPrint      = true;
            claimDocument.Description  = "Invoice";
            claimDocument.DocumentDate = DateTime.Now;
            claimDocument.DocumentName = string.Format("Invoice_{0}.pdf", invoiceNumber);

            // report category: service bill
            claimDocument.DocumentCategoryID = 9;

            claimDocument = ClaimDocumentManager.Save(claimDocument);

            claimDocumentPath = string.Format("{0}/ClaimDocuments/{1}/{2}", appPath, claimID, claimDocument.ClaimDocumentID);

            if (!Directory.Exists(claimDocumentPath))
            {
                Directory.CreateDirectory(claimDocumentPath);
            }

            destinationFilePath = claimDocumentPath + string.Format("/Invoice_{0}.pdf", invoiceNumber);

            System.IO.File.Copy(reportPath, destinationFilePath, true);

            // delete temp file
            //File.Delete(reportPath);
        }
示例#3
0
        protected void btnSaveDocumentEdit_Click(object sender, EventArgs e)
        {
            int           claimDocumentID = Convert.ToInt32(ViewState["ClaimDocumentID"]);
            ClaimDocument claimDocument   = null;

            Page.Validate("document");
            if (!Page.IsValid)
            {
                return;
            }

            claimDocument = ClaimDocumentManager.Get(claimDocumentID);

            if (claimDocument != null)
            {
                claimDocument.Description = txtDcoumentDescription.Text.Trim();

                if (ddlDocumentCategoryEdit.SelectedIndex > 0)
                {
                    claimDocument.DocumentCategoryID = Convert.ToInt32(ddlDocumentCategoryEdit.SelectedValue);
                }

                ClaimDocumentManager.Save(claimDocument);
            }

            pnlEditClaimDocument.Visible = false;
            pnlGridPanel.Visible         = true;

            gvDocuments.DataSource = ClaimDocumentManager.GetAll(this.claimID);
            gvDocuments.DataBind();
        }
示例#4
0
        protected void cbxPrint_CheckedChanged(object sender, EventArgs e)
        {
            ClaimDocument document = null;

            CheckBox cbx = sender as CheckBox;

            GridViewRow row = cbx.NamingContainer as GridViewRow;

            try {
                int documentID = (int)gvDocuments.DataKeys[row.RowIndex].Value;

                document = ClaimDocumentManager.Get(documentID);
                if (document != null)
                {
                    document.IsPrint = cbx.Checked;

                    document = ClaimDocumentManager.Save(document);

                    bindData(this.claimID);
                }
            }
            catch (Exception ex) {
                Core.EmailHelper.emailError(ex);
            }
        }
示例#5
0
        private void addReportToClaimDocument(string reportPath, int claimID)
        {
            string claimDocumentPath   = null;
            string destinationFilePath = null;

            // get application path
            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();

            ClaimDocument claimDocument = new ClaimDocument();

            claimDocument.ClaimID      = claimID;
            claimDocument.IsPrint      = true;
            claimDocument.Description  = "Claim Report";
            claimDocument.DocumentDate = DateTime.Now;
            claimDocument.DocumentName = "Claim_Report.pdf";

            // report category
            claimDocument.DocumentCategoryID = 8;

            claimDocument = ClaimDocumentManager.Save(claimDocument);

            claimDocumentPath = string.Format("{0}/ClaimDocuments/{1}/{2}", appPath, claimID, claimDocument.ClaimDocumentID);

            if (!Directory.Exists(claimDocumentPath))
            {
                Directory.CreateDirectory(claimDocumentPath);
            }

            destinationFilePath = claimDocumentPath + "/Claim_Report.pdf";

            System.IO.File.Copy(reportPath, destinationFilePath, true);

            // delete temp file
            //File.Delete(reportPath);
        }
示例#6
0
        public static void saveFile(int claimID, string filePath, string documentDescription, int documentCategory)
        {
            string        claimDocumentPath   = null;
            string        destinationFilePath = null;
            ClaimDocument document            = null;

            // get application path
            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();

            // get file from temp folder
            string tempFilePath = HttpContext.Current.Server.MapPath(String.Format("~\\Temp\\{0}", filePath));

            if (claimID > 0 && File.Exists(tempFilePath))
            {
                try {
                    using (TransactionScope scope = new TransactionScope()) {
                        document                    = new ClaimDocument();
                        document.ClaimID            = claimID;
                        document.DocumentName       = filePath;
                        document.Description        = documentDescription;
                        document.DocumentDate       = DateTime.Now;
                        document.IsPrint            = true;
                        document.DocumentCategoryID = documentCategory;

                        ClaimDocumentManager.Save(document);

                        claimDocumentPath = string.Format("{0}/ClaimDocuments/{1}/{2}", appPath, claimID, document.ClaimDocumentID);

                        if (!Directory.Exists(claimDocumentPath))
                        {
                            Directory.CreateDirectory(claimDocumentPath);
                        }

                        destinationFilePath = claimDocumentPath + "/" + filePath;

                        System.IO.File.Copy(tempFilePath, destinationFilePath, true);

                        // delete temp file
                        File.Delete(tempFilePath);

                        scope.Complete();
                    }
                }
                catch (Exception ex) {
                    Core.EmailHelper.emailError(ex);
                }
                finally {
                }
            }
        }
示例#7
0
        static public void addLetterToDocumentList(int claimID, string documentPath, string documentDescription)
        {
            string appPath       = ConfigurationManager.AppSettings["appPath"].ToString();
            string directoryPath = null;

            ClaimDocument claimDocument   = new ClaimDocument();
            string        destinationPath = null;

            if (!File.Exists(documentPath))
            {
                return;
            }

            string ext = System.IO.Path.GetExtension(documentPath);

            claimDocument.ClaimID      = claimID;
            claimDocument.Description  = documentDescription;
            claimDocument.DocumentName = Core.ReportHelper.sanatizeFileName(documentDescription) + ext;

            claimDocument.DocumentDate = DateTime.Now;

            claimDocument = ClaimDocumentManager.Save(claimDocument);

            if (claimDocument.ClaimDocumentID > 0)
            {
                directoryPath = string.Format("{0}/ClaimDocuments/{1}/{2}", appPath, claimID, claimDocument.ClaimDocumentID);

                if (!Directory.Exists(directoryPath))
                {
                    Directory.CreateDirectory(directoryPath);
                }

                destinationPath = directoryPath + "/" + claimDocument.DocumentName;

                File.Copy(documentPath, destinationPath);
            }
        }