12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- namespace AutoservisDrive.Entities
- {
- public partial class Service
- {
- public string DiscountText
- {
- get
- {
- if (Discount == 0 || Discount == null)
- return "";
- else
- return $"* скидка {Discount * 100} %";
- }
- }
- public string TotalCost
- {
- get
- {
- if (Discount == 0 || Discount == null)
- {
- return $"{Cost:N2} рублей за {DurationInSeconds / 60} минут";
- }
- else
- {
- return $"{CostWithDiscount:N2} рублей за {DurationInSeconds / 60} минут ";
- }
- }
- }
- public double CostWithDiscount
- {
- get
- {
- if (Discount == 0 || Discount == null)
- {
- return (double)Cost;
- }
- else
- {
- var costWithDiscount = (double)Cost * (1.00 - Discount);
- return costWithDiscount.Value;
- }
- }
- }
- public Visibility DiscountVisibility
- {
- get
- {
- if (Discount == 0 || Discount == null)
- return Visibility.Collapsed;
- else
- return Visibility.Visible;
- }
- }
- public string BackColor
- {
- get
- {
- if (Discount == 0 || Discount == null)
- return "#FFFFE1";
- else
- return "#D1FFD1";
- }
- }
- public string AdminControlsVisibility
- {
- get
- {
- if (App.CurrentUser.RoleId ==1)
- {
- return "Visible";
- }
- else
- {
- return "Collapsed";
- }
- }
- }
- }
- }
|