Пример #1
0
 protected void Insert_fields(object sender, EntityDataSourceChangingEventArgs e)
 {
     YASA_PL.FormTemplate_Files c = (YASA_PL.FormTemplate_Files)e.Entity;
     if (c != null)
     {
         c.Date_created_modified = DateTime.Now;
         if (c.filePath != null)
         {
             c.File_extension = c.filePath.Substring(c.filePath.LastIndexOf(".") + 1).ToLower();
             //add file size information
             String             fileUrl = "~/formfiles/" + c.filePath;
             String             path    = Server.MapPath(fileUrl);
             System.IO.FileInfo fi      = null;
             fi          = new System.IO.FileInfo(path);
             c.File_size = Math.Round(Convert.ToDecimal(fi.Length / 1048576), 2);
         }
     }
 }
Пример #2
0
 protected void Insert_fields(object sender, EntityDataSourceChangingEventArgs e)
 {
     YASA_PL.FormTemplate_Files c = (YASA_PL.FormTemplate_Files)e.Entity;
     if (c != null)
     {
         c.Date_created_modified = DateTime.Now;
         if (c.filePath != null)
         {
             c.File_extension = c.filePath.Substring(c.filePath.LastIndexOf(".") + 1).ToLower();
             //add file size information
             String             fileUrl = "~/files/" + c.filePath;
             String             path    = Server.MapPath(fileUrl);
             System.IO.FileInfo fi      = null;
             fi          = new System.IO.FileInfo(path);
             c.File_size = Math.Round(Convert.ToDecimal(fi.Length / 1048576), 2);
         }
         Session["Record_Info"] = "Edycja pliku zakończona poprawnie";
         redirectlink           = "~/FormTemplatesSet/Details.aspx?Id=" + c.FormTemplatesId;
     }
 }