using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ExamTry { public partial class Agent { public string GetImage { get { if (Logo == "") return Environment.CurrentDirectory + "/agents/picture.png"; else return Environment.CurrentDirectory + Logo; } } public int GetProductionYear { get { int productYear = 0; List Ps = BaseConnect.BaseModel.ProductSale.Where(x => ID == x.AgentID).ToList(); foreach (var item in Ps) { if (item.SaleDate.Year == DateTime.Now.Year) { productYear += item.ProductCount; } } return productYear; } } public int GetProductionSale { get { int summAgent = 0; List Ps = BaseConnect.BaseModel.ProductSale.Where(x => ID == x.AgentID).ToList(); foreach (var item in Ps) { int cost = (int)BaseConnect.BaseModel.Product.FirstOrDefault(x => x.ID == item.ProductID).MinCostForAgent; summAgent += item.ProductID * cost; } if (summAgent > 0 && summAgent < 10000) { return 0; }; if (summAgent > 10000 && summAgent < 50000) { return 5; }; if (summAgent > 50000 && summAgent < 150000) { return 10; }; if (summAgent > 150000 && summAgent < 500000) { return 20; }; if (summAgent > 500000) { return 25; }; return 25; } } public bool greenSale { get => GetProductionSale == 25; } } }