示例#1
0
 //public static response RestoreFileFromDb(Models.DocumentScanat ds)
 public static response RestoreFileFromDb(dynamic ds)
 {
     try
     {
         if (ds.FILE_CONTENT == null)
         {
             ds.GetFileContent();
         }
         if (!File.Exists(Path.Combine(CommonFunctions.GetScansFolder(), ds.CALE_FISIER)))
         {
             FileStream fs = new FileStream(Path.Combine(CommonFunctions.GetScansFolder(), ds.CALE_FISIER), FileMode.CreateNew, FileAccess.ReadWrite);
             fs.Write(ds.FILE_CONTENT, 0, ds.FILE_CONTENT.Length);
             fs.Flush();
             fs.Dispose();
         }
         try
         {
             string outputThumbFile = ds.CALE_FISIER.Replace(ds.EXTENSIE_FISIER, "_Custom.jpg");
             if (!File.Exists(Path.Combine(CommonFunctions.GetScansFolder(), outputThumbFile)))
             {
                 ThumbNails.GenerateImgThumbNail(CommonFunctions.GetThumbNailSizes(ThumbNailType.Custom), ds.CALE_FISIER);
             }
         }
         catch (Exception exp) { LogWriter.Log(exp); }
         return(new response(true, "", null, null, null));
         // to do - restore thumbnails
     }catch (Exception exp) { LogWriter.Log(exp); return(new response(false, exp.Message, null, null, new List <Error>()
         {
             new Error(exp)
         })); }
 }
示例#2
0
 public static response GenerateImgThumbNail(string fileName)
 {
     return(GenerateImgThumbNail(CommonFunctions.GetThumbNailSizes(ThumbNailType.Custom), File.Exists(fileName) ? "" : CommonFunctions.GetScansFolder(), fileName));
 }
示例#3
0
 public static response GenerateImgThumbNail(string filePath, string fileName)
 {
     return(GenerateImgThumbNail(CommonFunctions.GetThumbNailSizes(ThumbNailType.Custom), filePath, fileName));
 }