Ejemplo n.º 1
0
        public override UploadInfo CreateValue(IFieldUpload upload, IFieldValueProvider provider)
        {
            TkDebug.AssertArgumentNull(upload, "upload", this);
            TkDebug.AssertArgumentNull(provider, "provider", this);

            string fileName = provider.GetValue(upload.FileNameField);

            if (string.IsNullOrEmpty(fileName))
            {
                return(null);
            }

            UploadInfo info = new UploadInfo
            {
                FileName    = fileName,
                ContentType = provider.GetValue(upload.MimeTypeField),
                ServerPath  = provider.GetValue(upload.ServerPathField),
                FileSize    = provider.GetValue <int>(upload.SizeField),
                WebPath     = provider.GetValue(upload.ContentField)
            };

            return(info);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public override string Display(IFieldUpload upload, IFieldValueProvider provider)
 {
     return(provider.GetValue(upload.ContentField));
 }
Ejemplo n.º 4
0
        public override string Display(IFieldUpload upload, IFieldValueProvider provider)
        {
            string url = GetWebPath(provider.GetValue(upload.ContentField));

            return(url);
        }
Ejemplo n.º 5
0
        public override string Display(IFieldUpload upload, IFieldValueProvider provider)
        {
            string url = provider.GetValue(upload.ServerPathField);

            return(WebUtil.ResolveUrl(url));
        }