/// <summary>
        /// 
        /// </summary>
        /// <param name="programID"></param>
        /// <param name="templateID"></param>
        /// <returns></returns>
        public string GetQuestionFormAsXML(DBGuid programID, DBGuid templateID)
        {
            TraceCallEnterEvent.Raise();
              try
              {
            string result = "";

            ProgramService programService = new ProgramService(m_DataContext);
            Program program = programService.ProgramSelect(programID);
            if (program == null)
              throw new ApplicationException("Ezzel az azonosítóval nem létezik program.");

            TemplateContainer availableTemplates = TemplateSelectOfProgramPendingQuestionForm(programID);

            Template currentTemplate = (Template) availableTemplates[templateID.ToString()];
            if (currentTemplate == null)
              throw new ApplicationException("Ezzel az azonosítóval nem létezik kérdõív a megadott programhoz.");

            if (currentTemplate.Status.Equals("NWD") || currentTemplate.Status.Equals("UWD"))
            {
              throw new ApplicationException("A megadott kérdõív jóváhagyásra vár, nem módosítható.");
            }

            Template extendedTemplate = TemplateSelect(currentTemplate.ID);

            // feltöltjük a válaszokat
            PendingQuestionFormService pendingQuestionFormService = new PendingQuestionFormService(m_DataContext);
            QuestionFormService questionFormService = new QuestionFormService(m_DataContext);
            if (!currentTemplate.PendingQuestionFormID.IsNull)
            {
              PendingQuestionFormDetailContainer pendingAnswers =
            pendingQuestionFormService.SelectChildrenByDetailOfPendingQuestionForm(currentTemplate.PendingQuestionFormID);
              foreach (TemplateDetail d in extendedTemplate.Details.All)
              {
            string hash = currentTemplate.PendingQuestionFormID.ToString() + "<#>" +
                          d.ID.ToString() + "<#>" +
                          d.TemplateRef.ToString();
            PendingQuestionFormDetail answer = (PendingQuestionFormDetail) pendingAnswers[hash];
            if (answer != null)
            {
              d.Answer = answer.Answer;
            }
              }
            }
            else
            {
              if (!currentTemplate.QuestionFormID.IsNull)
              {
            QuestionFormDetailContainer acceptedAnswers =
              questionFormService.SelectChildrenByDetailOfQuestionForm(currentTemplate.QuestionFormID);
            foreach (TemplateDetail d in extendedTemplate.Details.All)
            {
              string hash = currentTemplate.QuestionFormID.ToString() + "<#>" +
                            d.ID.ToString() + "<#>" +
                            d.TemplateRef.ToString();
              QuestionFormDetail answer = (QuestionFormDetail) acceptedAnswers[hash];
              if (answer != null)
              {
                d.Answer = answer.Answer;
              }
            }
              }
            }

            // Build XML
            StringWriter sw = new StringWriter();
            XmlTextWriter xtw = new XmlTextWriter(sw);
            xtw.WriteStartElement("QuestionForm");
            xtw.WriteElementString("QuestionFormID", currentTemplate.QuestionFormID.AsXmlString);
            xtw.WriteElementString("PendingQuestionFormID", currentTemplate.PendingQuestionFormID.AsXmlString);
            xtw.WriteElementString("Status", currentTemplate.Status.AsXmlString);

            //	---	program paramétereinek beállítása
            ProgramCategoryService pcs = new ProgramCategoryService(m_DataContext);
            if (!program.ProgramCategoryRef.IsNull)
            {
              ProgramCategory pc = pcs.ProgramCategorySelect(program.ProgramCategoryRef);
              if (pc != null) program.ProgramCategoryName = pc.Name;
            }

            OrganisationService os = new OrganisationService(m_DataContext);
            if (!program.OrganisationRef.IsNull)
            {
              Organisation org = os.OrganisationSelect(program.OrganisationRef);
              if (org != null) program.OrganisationName = org.Name;
            }

            xtw.WriteRaw(program.AsXmlString);
            string templateXML = ConvertTemplateToXML(extendedTemplate);
            xtw.WriteRaw(templateXML);

            xtw.WriteEndElement();

            result = sw.ToString();

            TraceCallReturnEvent.Raise();
            return result;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }