Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 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";
     }
 }
Ejemplo n.º 3
0
 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();
     }
 }
Ejemplo n.º 4
0
 partial void DeleteNop280_Picture(Nop280_Picture instance);
Ejemplo n.º 5
0
 partial void UpdateNop280_Picture(Nop280_Picture instance);
Ejemplo n.º 6
0
 partial void InsertNop280_Picture(Nop280_Picture instance);