Ejemplo n.º 1
0
 public JsonResult SetTextStamp(AnnoStamp stamp, string jsAnnotation)
 {
     try
     {
         var client = SvcBldr.StampsV2();
         if (jsAnnotation != null)
         {
             Mark mark = Mark.JsonDeserialize(jsAnnotation);
             stamp.MarkXML = XmlSerializerExtension.XmlSerialize <Mark>(mark);
         }
         if (stamp.Id == Guid.Empty)
         {
             var r = client.CreateTextStamp(stamp);
             return(Result(r.Result, r.Error));
         }
         else
         {
             var r = client.UpdateTextStamp(stamp);
             return(Result(stamp, r.Error));
         }
     }
     catch (Exception ex)
     {
         return(Result(stamp, ExceptionsML.GetExceptionML(ex)));
     }
 }
Ejemplo n.º 2
0
        public JsonResult GetMarkFromMarkXML(string markXML)
        {
            var          decodedXML = Uri.UnescapeDataString(markXML);
            ExceptionsML bizEx      = null;
            Mark         mark       = null;

            if (!string.IsNullOrEmpty(markXML))
            {
                try
                {
                    mark = XmlSerializerExtension.XmlDeserialize <Mark>(decodedXML);
                }
                catch (Exception ex)
                {
                    bizEx = ExceptionsML.GetExceptionML(ex);
                }
            }
            return(Result(mark, bizEx));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns RedactionsXML string and object collection for redactions.
        /// Somewhere herein, real values are rounded to integers as necessary.
        /// </summary>
        /// <param name="jsRedactions">stringified redaction objects</param>
        private object SetRedactions(string jsRedactions, ref ExceptionsML bizEx)
        {
            string           redactionsXML = null;
            List <Redaction> redactions    = new List <Redaction>();

            if (!string.IsNullOrEmpty(jsRedactions))
            {
                try
                {
                    redactions    = Redaction.JsonDeserializeList(jsRedactions);
                    redactionsXML = XmlSerializerExtension.XmlSerialize <List <Redaction> >(redactions);
                }
                catch (Exception ex)
                {
                    bizEx = ExceptionsML.GetExceptionML(ex);
                }
            }
            var result = new { redactionsXML, redactions };

            return(result);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns AnnotationsXML string and object collection for annotations.
        /// Somewhere herein, real values are rounded to integers as necessary.
        /// </summary>
        /// <param name="jsAnnotations">stringified annotation (mark) objects</param>
        /// <param name="bizEx"></param>
        private object SetMarks(string jsAnnotations, ref ExceptionsML bizEx)
        {
            string      marksXML = null;
            List <Mark> marks    = new List <Mark>();

            if (!string.IsNullOrEmpty(jsAnnotations))
            {
                try
                {
                    marks    = Mark.JsonDeserializeList(jsAnnotations);
                    marksXML = XmlSerializerExtension.XmlSerialize <List <Mark> >(marks);
                }
                catch (Exception ex)
                {
                    bizEx = ExceptionsML.GetExceptionML(ex);
                }
            }
            var result = new { marksXML, marks };

            return(result);
        }