Example #1
0
        public BaseCptEntity ToModel(string title, string name, object value)
        {
            StringEntity entity = new StringEntity();
            if (!string.IsNullOrEmpty(title))
            {
                entity.Title = title;
            }
            else
            {
                entity.Title = name;
            }
            try
            {
                if (value != null)
                {
                    if (value is Int16 || value is Int32 || value is Int64 || value is Double)
                    {
                        entity.Value = CommonHelper.ConvertNumToString(value);
                    }
                    entity.Value = value.ToString();
                }
            }
            catch { }     
 
            return entity;
        }
Example #2
0
        public BaseCptEntity ToModel(string title, string name, object value)
        {
            StringEntity entity = new StringEntity();
            if (!string.IsNullOrEmpty(title))
            {
                entity.Title = title;
            }
            else
            {
                entity.Title = name;
            }
            try
            {
                if (value != null)
                {
                    entity.Value = value.ToString();
                }
            }
            catch { }     
 
            return entity;
        }
 private string CreateItem(StringEntity item)
 {
     StringBuilder content = new StringBuilder();
     content.Append("<tr>");
     content.Append("<td style=\"width: 200px;word-wrap:break-word; \" valign=\"top\">");
     if (!string.IsNullOrEmpty(item.Link))
     {
         content.Append("<a href=\"" + item.Link + "\" target=\"_self\">" + item.Title + "</a>");
     }
     else
     {
         content.Append(item.Title);
     }
     content.Append("</td>");
     content.Append("<td style=\"width: 400px;word-wrap:break-word; \"align=\"left\" valign=\"top\">");
     content.Append(item.Value);
     content.Append("</td>");
     content.Append("<td align=\"left\" valign=\"top\">");
     content.Append(item.Detail);
     content.Append("</td>");
     content.Append("</tr>");
     return content.ToString();
 }