Exemplo n.º 1
0
        /// <summary>
        /// Convert Text Message to CSV format
        /// </summary>
        /// <param name="textValue"></param>
        /// <returns></returns>
        public static string ToCsv(string textValue)
        {
            string retValue = String.Empty;

            if (!String.IsNullOrEmpty(textValue))
            {
                StringBuilder strBuilder  = null;
                Text          textObj     = UtiliMethods.populateObject(textValue);
                var           lstHeader   = getHeaders(textObj);
                var           lstSentence = getRows(textObj);

                if (lstHeader?.Count > 0 && lstSentence?.Count > 0)
                {
                    strBuilder = new StringBuilder();
                    lstHeader.ForEach(x => strBuilder.Append(x));
                    strBuilder.AppendLine();
                    lstSentence.ForEach(x => strBuilder.AppendLine(x));
                }
                retValue = strBuilder?.ToString();
            }
            return(retValue);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Convert Text to relevant Xml
        /// </summary>
        /// <param name="textValue"></param>
        /// <returns></returns>
        public static string ToXml(string textValue)
        {
            Text textObj = UtiliMethods.populateObject(textValue);

            return((textObj != null) ? ConvertTextToXml(textObj) : String.Empty);;
        }