protected void Insert_fields(object sender, EntityDataSourceChangingEventArgs e) { YASA_PL.Standard_Files c = (YASA_PL.Standard_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 = "~/standard_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); } } }
protected void Insert_fields(object sender, EntityDataSourceChangingEventArgs e) { YASA_PL.Standard_Files c = (YASA_PL.Standard_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 = "~/standard_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 prawidłowo"; redirectlink = "~/StandardSet/Details.aspx?Id=" + c.StandardId; } }