Ejemplo n.º 1
0
 protected void Insert_fields(object sender, EntityDataSourceChangingEventArgs e)
 {
     YASA_PL.CMM_Program_Files c = (YASA_PL.CMM_Program_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 = "~/cmm_program/" + c.filePath;
             String             path    = Server.MapPath(fileUrl);
             System.IO.FileInfo fi      = null;
             fi          = new System.IO.FileInfo(path);
             c.File_size = fi.Length;
         }
     }
 }
Ejemplo n.º 2
0
 protected void Insert_fields(object sender, EntityDataSourceChangingEventArgs e)
 {
     YASA_PL.CMM_Program_Files c = (YASA_PL.CMM_Program_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 = "~/cmm_program/" + c.filePath;
             String             path    = Server.MapPath(fileUrl);
             System.IO.FileInfo fi      = null;
             fi          = new System.IO.FileInfo(path);
             c.File_size = fi.Length;
         }
     }
 }