1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Media.Imaging;
- namespace OOO_WriteAndClear.DBModels
- {
- public partial class Product
- {
- public BitmapImage ProductImage
- {
- get
- {
- BitmapImage image = new BitmapImage();
- if (this.ProductPhoto is null || this.ProductPhoto.Length == 0)
- {
- image.BeginInit();
- image.UriSource = new Uri(Environment.CurrentDirectory + "\\Assets\\Pictures\\ProductPictures\\picture.png", UriKind.RelativeOrAbsolute);
- image.CacheOption = BitmapCacheOption.OnLoad;
- image.EndInit();
- return image;
- }
- image.BeginInit();
- image.UriSource = new Uri(Environment.CurrentDirectory + "\\Assets\\Pictures\\ProductPictures\\" + ProductPhoto, UriKind.RelativeOrAbsolute);
- image.CacheOption = BitmapCacheOption.OnLoad;
- image.EndInit();
- return image;
- }
- }
- public decimal CurrentPrice
- {
- get
- {
- decimal Discount = ProductDiscountMax is null? 0m : (decimal)ProductDiscountMax;
- return ProductCost * ((100m - Discount) / 100m);
- }
- }
- public bool IsBiggerThan15PercentDiscount => ProductDiscountMax > 15;
-
- }
- }
|