Example #1
0
        private void WriteRQKos(Mvc5RQ.Models.RQKosBranch rqKos, Stream writeStream)
        {
            if (rqKos != null)
            {
                var dSer = new XmlSerializer(typeof(Mvc5RQ.Models.RQKosBranch));

                try
                {
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    var xTrf = new System.Xml.Xsl.XslCompiledTransform();
                    var xSet = new System.Xml.Xsl.XsltSettings(enableDocumentFunction: true, enableScript: true);

                    dSer.Serialize(ms, rqKos);
                    //dSer.WriteObject(ms, rqKos);
                    //TESTDATEI(EZEUGEN)
                    //System.Xml.XmlDocument Doc = new System.Xml.XmlDocument();
                    //ms.Seek(0, System.IO.SeekOrigin.Begin);
                    //Doc.Load(ms);
                    //Doc.Save("D:/MVCTest.xml");
                    //ENDE TESTDATEI 
                    System.IO.TextReader tr = new System.IO.StringReader(System.Text.Encoding.UTF8.GetString(ms.GetBuffer(), 0, (int)ms.Position));
                    xTrf.Load(rqKos.FormatPreprocessor.XmlTransformPath, xSet, new System.Xml.XmlUrlResolver());
                    xTrf.Transform(new System.Xml.XPath.XPathDocument(tr), rqKos.FormatPreprocessor.XslTransformArg, writeStream);
                }
                catch
                {
                    throw new NotImplementedException("Could not find a RiQuest item with requested document number.");
                }
            }
        }
Example #2
0
 internal static MyJsonResult CreateError(Mvc5RQ.Models.RQKosBranch.RQKosBranchStatus status)
 {
     return new MyJsonResult()
     {
         message = status.message,
         isSuccess = false,
         hints = status.hints,
     };
 }
Example #3
0
        public static HttpResponseMessage Create(Mvc5RQ.Models.RQKosBranch.RQKosBranchStatus status)
        {
            MyJsonResult json = MyJsonResult.CreateError(status);

            return new HttpResponseMessage(System.Net.HttpStatusCode.OK)
            {
                Content = new JsonContent(json),
            };
        }
Example #4
0
 public static HttpResponseMessage Create(Mvc5RQ.Models.RQKosBranch.RQKosBranchStatus status) 
 { 
     Mvc5RQ.Areas.MyJsonResult result = Mvc5RQ.Areas.MyJsonResult.CreateError(status);
     string json = new JavaScriptSerializer().Serialize(result);
     return new HttpResponseMessage(System.Net.HttpStatusCode.OK)
     {
         Content = new StringContent(json),
     };
 }
        private void WriteXhtmlList(Mvc5RQ.Models.RQItemModel rqItemModel, Stream writeStream)
        {
            if (rqItemModel != null)
            {
                System.Xml.XmlTextReader r = rqItemModel.RQItems.ConvertTo("rqi", 1, 0);

                try
                {
                    var xTrf = new System.Xml.Xsl.XslCompiledTransform(true);
                    var xSet = new System.Xml.Xsl.XsltSettings(enableDocumentFunction:true, enableScript:true);

                    r.MoveToContent();
                    xTrf.Load(rqItemModel.RQItems.FormatPreprocessor.XmlTransformPath, xSet, new System.Xml.XmlUrlResolver());
                    xTrf.Transform(new System.Xml.XPath.XPathDocument(r), rqItemModel.RQItems.FormatPreprocessor.XslTransformArg, writeStream);
                }
                catch (Exception ex)
                {
                    //throw new NotImplementedException("Could not find a RiQuest item with requested document number.");
                    throw new HttpResponseException(JsonErrorResponse.Create(ex, "Add operation failed."));
                }
            }
        }
        private void WriteXhtmlItem(Mvc5RQ.Models.RQItem rqItem, Stream writeStream)
        {
            if (rqItem != null)
            {
                var dSer = new DataContractSerializer(typeof(Mvc5RQ.Models.RQItem));

                try
                {
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    var xTrf = new System.Xml.Xsl.XslCompiledTransform();
                    var xSet = new System.Xml.Xsl.XsltSettings(enableDocumentFunction:true, enableScript:true);

                    dSer.WriteObject(ms, rqItem);
                    System.IO.TextReader tr = new System.IO.StringReader(System.Text.Encoding.UTF8.GetString(ms.GetBuffer(), 0, (int)ms.Position));
                    xTrf.Load(rqItem.FormatPreprocessor.XmlTransformPath, xSet, new System.Xml.XmlUrlResolver());
                    xTrf.Transform(new System.Xml.XPath.XPathDocument(tr), rqItem.FormatPreprocessor.XslTransformArg, writeStream);
                }
                catch
                {
                    throw new NotImplementedException("Could not find a RiQuest item with requested document number.");
                }
            }
        }
 private Task GetWriteTask(Stream writeStream, Mvc5RQ.Models.RQItem value)
 {
     return new Task(() =>
         WriteXhtmlItem(value, writeStream));
 }
Example #8
0
 private Task GetWriteTask(Stream writeStream, Mvc5RQ.Models.RQItemModel value)
 {
     return new Task(() =>
         WriteXmlList(value, writeStream));
 }
Example #9
0
 private Task GetWriteTask(Stream writeStream, Mvc5RQ.Models.RQKosBranch value)
 {
     return new Task(() =>
         WriteRQKos(value, writeStream));
 }