protected void Insert_fields(object sender, EntityDataSourceChangingEventArgs e) { YASA_PL.CNC_Subprogram_Files c = (YASA_PL.CNC_Subprogram_Files)e.Entity; if (c != null) { if (c.filePath != null) { c.File_extension = c.filePath.Substring(c.filePath.LastIndexOf(".") + 1).ToLower(); //add file size information String fileUrl = "~/cnc_podprogram/" + c.filePath; String path = Server.MapPath(fileUrl); System.IO.FileInfo fi = null; fi = new System.IO.FileInfo(path); c.File_size = fi.Length; } } }
protected void Insert_fields(object sender, EntityDataSourceChangingEventArgs e) { YASA_PL.CNC_Subprogram_Files c = (YASA_PL.CNC_Subprogram_Files)e.Entity; if (c != null) { c.Date_created_modified = DateTime.Now; c.UserId = Convert.ToInt32(HttpContext.Current.User.Identity.Name); if (c.filePath != null) { c.File_extension = c.filePath.Substring(c.filePath.LastIndexOf(".") + 1).ToLower(); //add file size information String fileUrl = "~/cnc_podprogram/" + c.filePath; String path = Server.MapPath(fileUrl); System.IO.FileInfo fi = null; fi = new System.IO.FileInfo(path); c.File_size = fi.Length; } } }