예제 #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);
 }
예제 #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";
     }
 }
예제 #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();
     }
 }
예제 #4
0
 partial void DeleteNop280_Picture(Nop280_Picture instance);
예제 #5
0
 partial void UpdateNop280_Picture(Nop280_Picture instance);
예제 #6
0
 partial void InsertNop280_Picture(Nop280_Picture instance);