public List <Product> Calulate(string c) { var tmp = new List <Product>(); tmp = ProductSingleton.Instance.GetProduct(); ContextStrategy context = null; switch (c) { case "Zloty": context = new ContextStrategy(new Zloty()); break; case "Dolar": context = new ContextStrategy(new Dolar()); break; case "Euro": context = new ContextStrategy(new Euro()); break; case "Funt": context = new ContextStrategy(new Funt()); break; default: break; } return(context.Calculate(tmp)); }
static void Main(string[] args) { ContextStrategy contextStrategy; contextStrategy = new ContextStrategy(new ConcreteStrategyA()); contextStrategy.ContextInterface(); Console.ReadLine(); }
void Start() { ContextStrategy context = new ContextStrategy(); context.strategy = new ConcreatStrategyA(); context.CanDo(); context.strategy = new ConcreatStrategyB(); context.CanDo(); }
public void GenerarInforme() { ContextStrategy cs = new ContextStrategy(new Madres()); madres = cs.SepararMadres(datos); using (StreamWriter outputFile = new StreamWriter(@"C:\Users\Jeison\Desktop\" + "Madres.txt")) { foreach (string linea in madres) { outputFile.WriteLine(linea); } } }
//Strategy public void Strategy() { ContextStrategy context = new ContextStrategy(); context.setStrategy(new StrategySort()); List <string> lista = new List <string>(); lista.Add("Marcus"); lista.Add("Ernane"); lista.Add("Carlos"); context.Ordernar(lista); context.setStrategy(new StrategyReverse()); context.Ordernar(lista); lista.ForEach(item => Console.WriteLine(item)); }
public DataHandler() { _fileHandler = new FileHandler(); _directoryOut = $@"{_fileHandler.GetDataDirectory()}\out"; _directoryProcessed = $@"{_fileHandler.GetDataDirectory()}\processed"; _fileHandler.CreateDirectory(_directoryOut); _fileHandler.CreateDirectory(_directoryProcessed); _contextStrategy = new ContextStrategy(); _termination = $"-Processed-in-{DateTimeHelper.DateTimeBrazil("yyyy-MM-dd-HHmmss")}.txt"; Output = new Output(); SalesmanList = new List <Salesman>(); CustomerList = new List <Customer>(); SaleList = new List <Sale>(); }
public List <Car> Calulate(string c) { var tmp = new List <Car>(); tmp = CarSingleton.Instance.GetCar(); ContextStrategy context = null; switch (c) { case "Kmh": context = new ContextStrategy(new Kmh()); break; case "Mph": context = new ContextStrategy(new Mph()); break; default: break; } return(context.Calculate(tmp)); }
public LogConfigSetup WithContextStrategy(ContextStrategy strategy) { ContextStrategy = strategy; return(this); }
protected BuilderBase() { var repository = IocManager.Instance.Resolve <IRepository <TContent> >(); Context = new ContextStrategy <TContent>(repository.GetAll()); }