Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...Help with Documents from a databaseHelp with Documents from a database
Previous
 
Next
New Post
3/28/2013 6:43 AM
 
Rob,

in this case I would write some web service included in the other application that is able to deliver anything you need, and a DNN module that consumes the web service. The advantage of that is that you have a clean separation of the two applications and databases.

Best wishes
Michael

Michael Tobisch
DNN★MVP

dnn-Connect.org - The most vibrant community around the DNN-platform
 
New Post
3/28/2013 9:03 AM
 

Thanks Michael. That will probably work but I just tried doing it with a Generic Handler and it worked. This is what I did: (hope it helps somebody)

 Generic Handler file:

public class pdf : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            using (var ctx = Components.Data.Model.DecisionReportModel.Instance())
            {
                int docID = Convert.ToInt32(context.Request.QueryString["docID"]);
                int langID = Convert.ToInt32(context.Request.QueryString["lang"]);

                DocumentLanguage doc = null;
                List docs = ctx.DocumentLanguages.Include("Document").Where(dd => dd.DocumentID == docID).ToList();
                if (docs.Find(d => d.LanguageID == langID) != null)
                {
                    doc = docs.Find(d => d.LanguageID == langID);
                }
                else if (docs.Find(d => d.LanguageID == 1) != null) //default to English
                {
                    doc = docs.Find(d => d.LanguageID == 1);
                }
                else if (docs.Find(d => d.LanguageID == 2) != null) //French
                {
                    doc = docs.Find(d => d.LanguageID == 2);
                }

                if (doc != null)
                {
                    string strFileName = doc.Document.FileName;
                    context.Response.ContentType = "application/pdf";
                    context.Response.BinaryWrite(doc.FileContent);
                    context.Response.AddHeader("Content-Disposition", "attachment; filename=" + strFileName.ToString());
                }
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }

...and I call it from my repeater's ItemDataBound like this:

lnkPDF.NavigateUrl = "pdf.ashx?docID=" + d.DocumentID + "&lang=" + l.LanguageCultureID; 

Thanks

P.S. I Like the web service idea though!

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...Help with Documents from a databaseHelp with Documents from a database


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out