Service/AvaloniaAppApplication/DTO/ServiceDTO.cs
Guitaras_Fingerchpoker e5d1f72e7d first commit
2025-05-15 11:20:37 +03:00

119 lines
2.8 KiB
C#

using Avalonia.Platform;
using AvaloniaAppApplication.Models;
//using Microsoft.CodeAnalysis.CSharp.Syntax;
using System;
using System.Collections.Generic;
using Avalonia.Media.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Avalonia;
using System.Collections.ObjectModel;
namespace AvaloniaAppApplication.DTO
{
public class ServiceDTO
{
private string _mainimagePath;
public ServiceDTO()
{
}
public int Id { get; set; }
public string? Title { get; set; }
public float Cost { get; set; }
public float? CostWithDiscount {
get
{
if (Discount > 0)
return Cost - (Cost * Discount / 100);
else
return Cost;
}
}
public int? Durationinseconds
{ get; set; }
public float? DurationInMinutes {
get
{
if (Durationinseconds != null)
return Durationinseconds / 60;
else
return null;
}
}
public string? Description { get; set; }
public float? Discount { get; set; }
public string? MainImagePath { get; set; }
public virtual ICollection<Clientservice> ClientServices { get; set; } = new List<Clientservice>();
public virtual ICollection<Servicephoto> ServicePhotos { get; set; } = new List<Servicephoto>();
public virtual ICollection<Product> MainProducts { get; set; } = new List<Product>();
public Bitmap ImageBitmap
{ get; set; }
public string DiscountColor
{
get
{
if (Discount > 0)
return "LightGreen";
else
return "";
}
}
public ObservableCollection<ServicePhotoDTO> ServiceBitmaps { get; set; } = new ObservableCollection<ServicePhotoDTO>();
}
public class ServicePhotoDTO
{
public int Id { get; set; }
public int ServiceId { get; set; }
public string PhotoPath { get; set; } = null!;
public Avalonia.Media.Imaging.Bitmap Bitmap { get; set; }
}
public class ClientServiceDTO
{
public int Id { get; set; }
public string Title { get; set; }
public string ClientFIO { get; set; }
public string Email { get; set; }
public string StartTime { get; set; }
public string Phone { get; set; }
public int? RemainingTime { get; set; }
public string ColorString {
get
{
if (RemainingTime < 60)
return "Red";
else
return "";
}
}
}
}