private string GetFileName(Nop280_Picture picture)
 {
     string extension = GetExtension(picture);
     string fileName = string.IsNullOrWhiteSpace(picture.SeoFilename)
         ? picture.Id.ToString()
         : picture.SeoFilename;
     return string.Concat(fileName, extension);
 }
 private static string GetExtension(Nop280_Picture picture)
 {
     switch (picture.MimeType)
     {
         case "image/png":
             return ".png";
         case "image/gif":
             return ".gif";
         case "image/pjpeg":
             return ".jpg";
         default:
             return ".jpeg";
     }
 }
 private Stream GetData(Nop280_Picture picture, PictureInfo pictureInfo)
 {
     string fileName = picture.Id.ToString().PadLeft(7, '0') + "_0" + GetExtension(picture);
     switch (pictureInfo.PictureLocation)
     {
         case PictureLocation.OnDisc:
             string discFolderLocation = GetOnDiscFolderLocation(pictureInfo.LocationData);
             return File.OpenRead(discFolderLocation + fileName);
         case PictureLocation.Url:
             string webFolder = GetWebFolderLocation(pictureInfo.LocationData);
             return WebRequest.Create(webFolder + fileName).GetResponse().GetResponseStream();
         case PictureLocation.Database:
             return new MemoryStream(picture.PictureBinary.ToArray());
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Beispiel #4
0
 partial void DeleteNop280_Picture(Nop280_Picture instance);
Beispiel #5
0
 partial void UpdateNop280_Picture(Nop280_Picture instance);
Beispiel #6
0
 partial void InsertNop280_Picture(Nop280_Picture instance);