|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace DesignPatternStudy.Learn.StrategyPattern.NoPattern
|
|
|
|
|
{
|
|
|
|
|
public class NoStrategyPattern
|
|
|
|
|
{
|
|
|
|
|
public decimal GetPrice(decimal sourcePrice, int priceType)
|
|
|
|
|
{
|
|
|
|
|
decimal discountPrice = sourcePrice;
|
|
|
|
|
switch (priceType)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
discountPrice = sourcePrice * 0.9m;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
discountPrice = sourcePrice - 10m;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
discountPrice = sourcePrice - 100m;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
discountPrice = sourcePrice;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return discountPrice;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|