1234567891011121314151617181920212223242526272829303132333435363738 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace DemoexamUser11
- {
- public partial class Agent
- {
- public string ImagePath { get => Logo == "" ? "/images/picture.png" : Logo; }
- public string Type { get => AgentType.Title; }
- public string SaleYear { get => ProductSale.Where(x => x.AgentID == ID && DateTime.Now.Year - x.SaleDate.Year < 2).ToList().Count.ToString() + " продаж за год"; }
- public string PriorityText { get => "Приоритетность: " + Priority; }
- public string Descount
- {
- get
- {
- List<ProductSale> productSales = ProductSale.Where(x => x.AgentID == ID).ToList();
- int summ = 0;
- int descount = 0;
- foreach (var productSale in productSales)
- {
- summ += productSale.ProductCount;
- }
- if (summ > 10000 && summ < 50000)
- descount = 5;
- else if (summ > 50000 && summ < 150000)
- descount = 10;
- else if (summ > 150000 && summ < 500000)
- descount = 20;
- else if (summ > 500000)
- descount = 25;
- return descount.ToString();
- }
- }
- }
- }
|