DomainModels.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. namespace TradeApp.WinForms.V08;
  2. public sealed record AppUser(int UserId, string FullName, string RoleName)
  3. {
  4. public bool IsAdmin => RoleName.Contains("администратор", StringComparison.CurrentCultureIgnoreCase);
  5. public bool IsManager => RoleName.Contains("менеджер", StringComparison.CurrentCultureIgnoreCase);
  6. public bool IsClient => RoleName.Contains("клиент", StringComparison.CurrentCultureIgnoreCase);
  7. public bool CanSearch => IsAdmin || IsManager;
  8. public bool CanEditProducts => IsAdmin;
  9. public bool CanEditOrders => IsAdmin;
  10. public bool CanViewOrders => IsAdmin || IsManager;
  11. }
  12. public sealed class ProductView
  13. {
  14. public int ProductId { get; set; }
  15. public string Article { get; set; } = "";
  16. public string Name { get; set; } = "";
  17. public string Category { get; set; } = "";
  18. public string Description { get; set; } = "";
  19. public string Manufacturer { get; set; } = "";
  20. public string Supplier { get; set; } = "";
  21. public decimal Price { get; set; }
  22. public decimal DiscountPercent { get; set; }
  23. public decimal FinalPrice => Math.Round(Price * (100 - DiscountPercent) / 100, 2);
  24. public string Unit { get; set; } = "";
  25. public int StockQuantity { get; set; }
  26. public string ImagePath { get; set; } = "picture.png";
  27. }
  28. public sealed class OrderView
  29. {
  30. public int OrderId { get; set; }
  31. public string Customer { get; set; } = "";
  32. public string PickupPoint { get; set; } = "";
  33. public string Status { get; set; } = "";
  34. public DateTime? OrderDate { get; set; }
  35. public DateTime? DeliveryDate { get; set; }
  36. public string ReceiveCode { get; set; } = "";
  37. public string Articles { get; set; } = "";
  38. }