Beispiel #1
0
 Control GetBinaryImage(String name)
 {
     return(new ASPxBinaryImage()
     {
         ID = "Editor",
         ContentBytes = LocalHelper.ReadFileAsBytes(name)
     });
 }
Beispiel #2
0
 Control GetHtmlEditor(String name)
 {
     return(new ASPxHtmlEditor()
     {
         ID = "Editor",
         Html = LocalHelper.ReadFileAsString(name)
     });
 }
Beispiel #3
0
 protected void grid_CancelRowEditing(Object sender, ASPxStartRowEditingEventArgs e)
 {
     if (IsFileUploaded)
     {
         var filepath = LocalHelper.ResolveFilePath(Filename);
         File.Delete(filepath);
         Filename = null;
     }
 }
Beispiel #4
0
 Control GetMemo(String name)
 {
     return(new ASPxMemo()
     {
         ID = "Editor",
         Height = 200,
         Width = 250,
         Text = LocalHelper.ReadFileAsString(name)
     });
 }
Beispiel #5
0
        protected void grid_RowDeleting(Object sender, ASPxDataDeletingEventArgs e)
        {
            var id       = Int32.Parse(e.Keys["ID"].ToString());
            var data     = FindData(id);
            var filepath = LocalHelper.ResolveFilePath(data.Name);

            Data.Remove(data);
            File.Delete(filepath);
            e.Cancel = true;
        }
Beispiel #6
0
 protected void upload_FileUploadComplete(Object sender, FileUploadCompleteEventArgs e)
 {
     if (IsFileUploaded)
     {
         e.ErrorText = "Unable to unload more than one file. Update or cancel previous unload operation.";
         e.IsValid   = false;
         return;
     }
     if (e.IsValid)
     {
         var name     = e.UploadedFile.FileName;
         var filepath = LocalHelper.ResolveFilePath(name);
         e.UploadedFile.SaveAs(filepath, true);
         Filename = name;
     }
 }
Beispiel #7
0
 void UpdateFile(Control editor, String name)
 {
     if (editor is ASPxHtmlEditor)
     {
         var control = editor as ASPxHtmlEditor;
         var html    = control.Html;
         LocalHelper.SaveToFile(html, name);
         return;
     }
     if (editor is ASPxMemo)
     {
         var control = editor as ASPxMemo;
         var text    = control.Text;
         LocalHelper.SaveToFile(text, name);
     }
 }
Beispiel #8
0
 protected void grid_RowInserting(Object sender, ASPxDataInsertingEventArgs e)
 {
     if (IsFileUploaded)
     {
         var data = new Data {
             ID       = GetNewID(),
             Date     = DateTime.Now,
             Name     = Filename,
             Comment  = e.NewValues["Comment"].ToString(),
             FileType = LocalHelper.GetFileType(Filename)
         };
         Data.Add(data);
         Filename = null;
         grid.CancelEdit();
     }
     e.Cancel = true;
 }