public static string GetImageProductPathAbsolut(ProductImageType type, string photoPath) { if (string.IsNullOrWhiteSpace(photoPath)) { return(GetPathAbsolut(PhotoFoldersPath[FolderType.Product]) + ProductPhotoPrefix[type]); } return(GetPathAbsolut(PhotoFoldersPath[FolderType.Product]) + ProductPhotoPrefix[type] + Path.GetFileNameWithoutExtension(photoPath) + ProductPhotoPostfix[type] + Path.GetExtension(photoPath)); }
public ProductColorVariety(ProductColorVarietyOptions options) { ColorType = options.ColorType; ColorImage = options.ColorImageName; _images = options.Images.Select(p => new Image(p)).ToList(); ProductImageType = options.ProductImageType; ProductPrice = new ProductPrice(options.ProductAmount, options.ProductDiscountPercent); }
//_____________ #region ProductImage public static string GetImageProductPath(ProductImageType type, string photoPath, bool isForAdministration) { if (string.IsNullOrWhiteSpace(photoPath)) { return("images/nophoto" + ProductPhotoPostfix[type] + ".jpg"); } return(GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration) + ProductPhotoPrefix[type] + Path.GetFileNameWithoutExtension(photoPath) + ProductPhotoPostfix[type] + Path.GetExtension(photoPath)); }
public static Size GetImageMaxSize(ProductImageType type) { switch (type) { case ProductImageType.Big: return(new Size(SettingsPictureSize.BigProductImageWidth, SettingsPictureSize.BigProductImageHeight)); case ProductImageType.Middle: return(new Size(SettingsPictureSize.MiddleProductImageWidth, SettingsPictureSize.MiddleProductImageHeight)); case ProductImageType.Small: return(new Size(SettingsPictureSize.SmallProductImageWidth, SettingsPictureSize.SmallProductImageHeight)); case ProductImageType.XSmall: return(new Size(SettingsPictureSize.XSmallProductImageWidth, SettingsPictureSize.XSmallProductImageHeight)); default: throw new ArgumentException(@"Parameter must be ProductImageType", "type"); } }
public static void SaveResizePhotoFile(ProductImageType type, Image image, string destName) { var size = PhotoService.GetImageMaxSize(type); SaveResizePhotoFile(FoldersHelper.GetImageProductPathAbsolut(type, destName), size.Width, size.Height, image); }
//_____________ #region ProductImage public static string GetImageProductPath(ProductImageType type, string photoPath, bool isForAdministration) { /*if (string.IsNullOrWhiteSpace(photoPath)) * return "images/nophoto" + ProductPhotoPostfix[type] + ".jpg"; * return GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration) + ProductPhotoPrefix[type] + Path.GetFileNameWithoutExtension(photoPath) + ProductPhotoPostfix[type] + Path.GetExtension(photoPath); * */ if (string.IsNullOrWhiteSpace(photoPath)) { return("images/nophoto" + ProductPhotoPostfix[type] + ".jpg"); } else { //changed by Evgeni to get pictures from various folders when changing need to change Yamarket also if (photoPath.ToLower().Contains("bosch_blue_pt")) { return(String.Format(@"{0}BoschBluePt/{1}/{2}{3}", (GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration).ToLower()).Replace(type.ToString().ToLower() + @"/", ""), type, Path.GetFileNameWithoutExtension(photoPath), ProductPhotoPostfix[type] + Path.GetExtension(photoPath))); } else if (photoPath.ToLower().Contains("bosch_blue_ac")) { return(String.Format(@"{0}BoschBlueAc/{1}/{2}{3}", (GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration).ToLower()).Replace(type.ToString().ToLower() + @"/", ""), type, Path.GetFileNameWithoutExtension(photoPath), ProductPhotoPostfix[type] + Path.GetExtension(photoPath))); } else if (photoPath.ToLower().Contains("bosch_green_pt")) { return(String.Format(@"{0}BoschGreenPt/{1}/{2}{3}", (GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration).ToLower()).Replace(type.ToString().ToLower() + @"/", ""), type, Path.GetFileNameWithoutExtension(photoPath), ProductPhotoPostfix[type] + Path.GetExtension(photoPath))); } else if (photoPath.ToLower().Contains("bosch_green_ac")) { return(String.Format(@"{0}BoschGreenAc/{1}/{2}{3}", (GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration).ToLower()).Replace(type.ToString().ToLower() + @"/", ""), type, Path.GetFileNameWithoutExtension(photoPath), ProductPhotoPostfix[type] + Path.GetExtension(photoPath))); } else if (photoPath.ToLower().Contains("bosch_garden_pt")) { return(String.Format(@"{0}BoschGarden/{1}/{2}{3}", (GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration).ToLower()).Replace(type.ToString().ToLower() + @"/", ""), type, Path.GetFileNameWithoutExtension(photoPath), ProductPhotoPostfix[type] + Path.GetExtension(photoPath))); } else if (photoPath.ToLower().Contains("skill_diy_pt")) { return(String.Format(@"{0}SkillDiy/{1}/{2}{3}", (GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration).ToLower()).Replace(type.ToString().ToLower() + @"/", ""), type, Path.GetFileNameWithoutExtension(photoPath), ProductPhotoPostfix[type] + Path.GetExtension(photoPath))); //GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration) + ProductPhotoPrefix[type] + Path.GetFileNameWithoutExtension(photoPath) + ProductPhotoPostfix[type] + Path.GetExtension(photoPath) } else if (photoPath.ToLower().Contains("skill_master_pt")) { return(String.Format(@"{0}SkillMasters/{1}/{2}{3}", (GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration).ToLower()).Replace(type.ToString().ToLower() + @"/", ""), type, Path.GetFileNameWithoutExtension(photoPath), ProductPhotoPostfix[type] + Path.GetExtension(photoPath))); } else if (photoPath.ToLower().Contains("dremel")) { return(String.Format(@"{0}Dremel/{1}/{2}{3}", (GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration).ToLower()).Replace(type.ToString().ToLower() + @"/", ""), type, Path.GetFileNameWithoutExtension(photoPath), ProductPhotoPostfix[type] + Path.GetExtension(photoPath))); } else if (photoPath.ToLower().Contains("cstberger")) { return(String.Format(@"{0}CstBerger/{1}/{2}{3}", (GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration).ToLower()).Replace(type.ToString().ToLower() + @"/", ""), type, Path.GetFileNameWithoutExtension(photoPath), ProductPhotoPostfix[type] + Path.GetExtension(photoPath))); } else if (photoPath.ToLower().Contains("bosch_blue_mt")) { return(String.Format(@"{0}BoschMtPRO/{1}/{2}{3}", (GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration).ToLower()).Replace(type.ToString().ToLower() + @"/", ""), type, Path.GetFileNameWithoutExtension(photoPath), ProductPhotoPostfix[type] + Path.GetExtension(photoPath))); } else if (photoPath.ToLower().Contains("bosch_green_mt")) { return(String.Format(@"{0}BoschMtDiy/{1}/{2}{3}", (GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration).ToLower()).Replace(type.ToString().ToLower() + @"/", ""), type, Path.GetFileNameWithoutExtension(photoPath), ProductPhotoPostfix[type] + Path.GetExtension(photoPath))); } else { return(GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration) + ProductPhotoPrefix[type] + Path.GetFileNameWithoutExtension(photoPath) + ProductPhotoPostfix[type] + Path.GetExtension(photoPath)); } } }
public static System.Drawing.Size GetImageMaxSize(ProductImageType type) { switch (type) { case ProductImageType.Big: return new System.Drawing.Size(SettingsPictureSize.BigProductImageWidth, SettingsPictureSize.BigProductImageHeight); case ProductImageType.Middle: return new System.Drawing.Size(SettingsPictureSize.MiddleProductImageWidth, SettingsPictureSize.MiddleProductImageHeight); case ProductImageType.Small: return new System.Drawing.Size(SettingsPictureSize.SmallProductImageWidth, SettingsPictureSize.SmallProductImageHeight); case ProductImageType.XSmall: return new System.Drawing.Size(SettingsPictureSize.XSmallProductImageWidth, SettingsPictureSize.XSmallProductImageHeight); default: throw new ArgumentException(@"Parameter must be ProductImageType", "type"); } }
public static void SaveResizePhotoFile(ProductImageType type, Image image, string destName) { var size = PhotoService.GetImageMaxSize(type); SaveResizePhotoFile(FoldersHelper.GetImageProductPathAbsolut(type, destName), size.Width, size.Height, image); }
public static void SaveResizePhotoFile(ProductImageType type, Image image, string destName, string productPathAbsolut) { var size = PhotoService.GetImageMaxSize(type); SaveResizePhotoFile(productPathAbsolut + type + "\\" + destName + "_" + type + ".jpg", size.Width, size.Height, image); }
public static string GetImageProductPathAbsolut(ProductImageType type, string photoPath) { if (string.IsNullOrWhiteSpace(photoPath)) return GetPathAbsolut(PhotoFoldersPath[FolderType.Product]) + ProductPhotoPrefix[type]; return GetPathAbsolut(PhotoFoldersPath[FolderType.Product]) + ProductPhotoPrefix[type] + Path.GetFileNameWithoutExtension(photoPath) + ProductPhotoPostfix[type] + Path.GetExtension(photoPath); }
public static string GetImageProductPath(ProductImageType type, string photoPath, bool isForAdministration) { if (string.IsNullOrWhiteSpace(photoPath)) return "images/nophoto" + ProductPhotoPostfix[type] + ".jpg"; return GetPath(PhotoFoldersPath[FolderType.Product], isForAdministration) + ProductPhotoPrefix[type] + Path.GetFileNameWithoutExtension(photoPath) + ProductPhotoPostfix[type] + Path.GetExtension(photoPath); }