public string DisplayValue(object value, Tk5FieldInfoEx field, IFieldValueProvider rowValue) { if (DisplayUtil.IsNull(value)) { return(string.Empty); } string text = value.ToString(); int len = text.Length; if (len <= MaxLength) { return(StringUtil.EscapeXmlString(text)); } switch (DisplayMode) { case DisplayPosition.Middle: text = string.Format(ObjectUtil.SysCulture, "{0}{1}{2}", text.Substring(0, MaxLength - EndLength), AbbrString, text.Substring(len - EndLength, EndLength)); break; default: text = text.Substring(0, MaxLength) + AbbrString; break; } return(StringUtil.EscapeXmlString(text)); }
public string DisplayValue(object value, Tk5FieldInfoEx field, IFieldValueProvider rowValue) { if (DisplayUtil.IsNull(value) || string.IsNullOrEmpty(value.ToString())) { return(string.Empty); } DateTime today = DateTime.Today; DateTime dateValue = value.Value <DateTime>(); if (today == dateValue) { return(TkWebApp.Today); } else if (today.AddDays(1) == dateValue) { return(TkWebApp.Tomorrow); } else if (today.AddDays(-1) == dateValue) { return(TkWebApp.Yesterday); } else { DateTime weekDate = today.AddDays(-6); if (dateValue > weekDate && dateValue < today) { return(dateValue.ToString("dddd", ObjectUtil.SysCulture)); } else { return(dateValue.ToString(Format, ObjectUtil.SysCulture)); } } }
public string DisplayValue(object value, Tk5FieldInfoEx field, IFieldValueProvider rowValue) { TkDebug.AssertArgumentNull(field, "field", this); if (DisplayUtil.IsNull(value)) { return(string.Empty); } if (field.Upload != null) { Tk5UploadConfig upload = field.AssertUpload(); IUploadProcessor2 processor = upload.CreateUploadProcessor2(); //IFieldValueProvider provider = new DataRowFieldValueProvider(row, row.Table.DataSet); string url = processor.Display(upload, rowValue); HtmlAttribute cssAttr = string.IsNullOrEmpty(CssClass) ? null : new HtmlAttribute("class", CssClass); HtmlAttributeBuilder builder = new HtmlAttributeBuilder(); builder.Add("src", url); builder.Add(cssAttr); return(string.Format(ObjectUtil.SysCulture, "<img {0} />", builder.CreateAttribute())); } return(string.Empty); }
public string DisplayValue(object value, Tk5FieldInfoEx field, IFieldValueProvider rowValue) { if (DisplayUtil.IsNull(value) || string.IsNullOrEmpty(value.ToString())) { return(string.Empty); } DateTime date = value.Value <DateTime>(); return(date.ToString(Format, ObjectUtil.SysCulture)); }
public string DisplayValue(object value, Tk5FieldInfoEx field, IFieldValueProvider rowValue) { if (DisplayUtil.IsNull(value)) { return(string.Empty); } string format = string.Format(ObjectUtil.SysCulture, "{{0:{0}}}", Format); double dblValue = value.Value <double>(); return(string.Format(ObjectUtil.SysCulture, format, dblValue)); }
public string DisplayValue(object value, Tk5FieldInfoEx field, IFieldValueProvider rowValue) { if (DisplayUtil.IsNull(value)) { return(string.Empty); } string text = StringUtil.EscapeXmlString(value.ConvertToString()); return(string.Format(ObjectUtil.SysCulture, "<a href=\"mailto://{0}\" target=\"_blank\">{0}</a>", text)); }
public string DisplayValue(object value, Tk5FieldInfoEx field, IFieldValueProvider rowValue) { TkDebug.AssertArgumentNull(field, "field", this); if (DisplayUtil.IsNull(value)) { return(string.Empty); } string result = DisplayUtil.GetRowDecoderValue(rowValue, field.NickName).ConvertToString(); return(result); }
public string DisplayValue(object value, Tk5FieldInfoEx field, IFieldValueProvider rowValue) { if (DisplayUtil.IsNull(value)) { return(string.Empty); } string text = StringUtil.EscapeXmlString(value.ConvertToString()); string url = text.StartsWith("http", StringComparison.CurrentCultureIgnoreCase) ? text : "http://" + text; string target = string.IsNullOrEmpty(Target) ? string.Empty : string.Format(ObjectUtil.SysCulture, " target=\"{0}\"", Target); return(string.Format(ObjectUtil.SysCulture, "<a href=\"{0}\"{1}>{2}</a>", url, target, text)); }
public string DisplayValue(object value, Tk5FieldInfoEx field, IFieldValueProvider rowValue) { if (DisplayUtil.IsNull(value)) { return(string.Empty); } string strValue = value.ToString(); if (strValue == CheckValue) { return("<i class='icon-ok'></i>"); } else { return("<i class='icon-remove'></i>"); } }
public string DisplayValue(object value, Tk5FieldInfoEx field, IFieldValueProvider rowValue) { TkDebug.AssertArgumentNull(field, "field", this); if (DisplayUtil.IsNull(value)) { return(string.Empty); } if (field.Upload != null) { Tk5UploadConfig upload = field.AssertUpload(); IUploadProcessor2 processor = upload.CreateUploadProcessor2(); //IFieldValueProvider provider = new DataRowFieldValueProvider(row, row.Table.DataSet); string url = processor.Display(upload, rowValue); return(string.Format(ObjectUtil.SysCulture, "<a href=\"{2}\" target=\"_blank\">{0}{1}</a>", StringUtil.EscapeHtml(rowValue.GetValue(upload.FileNameField)), BaseUploadProcessor.FormatSize(rowValue.GetValue <int>(upload.SizeField)), StringUtil.EscapeHtmlAttribute(url))); } return(string.Empty); }
public string DisplayValue(object value, Tk5FieldInfoEx field, IFieldValueProvider rowValue) { if (DisplayUtil.IsNull(value)) { return(string.Empty); } double dblValue = value.Value <double>(); string format = string.Format(ObjectUtil.SysCulture, "{{0:{0}}}", Format); string text = string.Format(ObjectUtil.SysCulture, format, dblValue); if (dblValue > BaseValue) { return(DisplayText(text, HighColor)); } else if (dblValue < BaseValue) { return(DisplayText(text, LowColor)); } else { return(DisplayText(text, EqualColor)); } }
public string DisplayValue(object value, Tk5FieldInfoEx field, IFieldValueProvider rowValue) { if (DisplayUtil.IsNull(value)) { return(string.Empty); } string text = value.ToString(); int length = FixLength == 0 ? text.Length : FixLength; int txtLength = text.Length; int controllLength = length > txtLength ? txtLength : length; string result; int headLength = HeadLength; int endLength = EndLength; switch (DisplayMode) { case DisplayPosition.All: result = string.Empty.PadLeft(length, MaskChar); break; case DisplayPosition.Head: if (headLength >= controllLength) { headLength = 0; } result = string.Format(ObjectUtil.SysCulture, "{0}{1}", text.Substring(0, headLength), string.Empty.PadLeft(length - headLength, MaskChar)); break; case DisplayPosition.Middle: if (headLength + endLength >= controllLength) { endLength = 0; if (headLength >= controllLength) { headLength = 0; } } result = string.Format(ObjectUtil.SysCulture, "{0}{1}{2}", text.Substring(0, headLength), string.Empty.PadLeft(length - headLength - endLength, MaskChar), text.Substring(txtLength - endLength, endLength)); break; case DisplayPosition.End: if (endLength >= controllLength) { endLength = 0; } result = string.Format(ObjectUtil.SysCulture, "{0}{1}", string.Empty.PadLeft(length - endLength, MaskChar), text.Substring(txtLength - endLength, endLength)); break; default: result = string.Empty; break; } return(StringUtil.EscapeXmlString(result)); }