ServicePartialClass.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using Avalonia.Media.Imaging;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Reflection.Metadata.Ecma335;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace kuzminIVProjectWorkOnDemo.Models
  9. {
  10. public partial class Sevice
  11. {
  12. public Bitmap ImageBitmap { get => new Bitmap(Environment.CurrentDirectory + "\\" + Image.Substring(1)); }
  13. private static bool isvisibleforadmin = false;
  14. public string PriceBackround { get {
  15. if (Discount == 0)
  16. {
  17. return "White";
  18. }
  19. else
  20. {
  21. return "#FFE7FABF";
  22. }
  23. } }
  24. public string LessonDuration { get {
  25. float totalcost = (float)((1 - Discount) * Cost);
  26. totalcost = (float)Math.Round(totalcost);
  27. string strTotalCost = totalcost.ToString() + " рублей за " + (Duration / 60) + "минут";
  28. return strTotalCost;
  29. } }
  30. public string DiscountStr { get {
  31. return "* скидка " + Math.Round((Double)Discount * 100, 0) + "%";
  32. } }
  33. public bool VisibleBlock { get {
  34. if (Discount == 0)
  35. {
  36. return false;
  37. }
  38. else
  39. {
  40. return true;
  41. }
  42. } }
  43. public float CostWithDiscount { get {
  44. if (Discount != 0)
  45. {
  46. float cost = (1 - (float)Discount);
  47. return (float)Cost * cost;
  48. }
  49. else {
  50. return (float)Cost;
  51. }
  52. } }
  53. public static bool IsVisibleAdmin { get {
  54. return isvisibleforadmin;
  55. } set {
  56. isvisibleforadmin = value;
  57. }
  58. }
  59. }
  60. }