예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        protected override IUploadProcessor2 CreateUploadProcessor(IFieldInfoEx info, UpdateKind status)
        {
            Tk5UploadConfig upload = info.AssertUpload();

            return(upload.CreateUploadProcessor2());
        }