예제 #1
0
        public string Display(IFieldUpload upload, DataRow row)
        {
            TkDebug.AssertArgumentNull(upload, "upload", this);
            TkDebug.AssertArgumentNull(row, "row", this);

            return(string.Format(ObjectUtil.SysCulture, "<a href=\"{2}\" target=\"_blank\">{0}{1}</a>",
                                 row.GetString(upload.FileNameField), BaseUploadProcessor.FormatSize(row.GetValue <int>(upload.SizeField)),
                                 row.GetString(upload.ContentField)));
        }
예제 #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);
        }