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));
        }
示例#2
0
        static void Main(string[] args)
        {
            ContextStrategy contextStrategy;

            contextStrategy = new ContextStrategy(new ConcreteStrategyA());
            contextStrategy.ContextInterface();

            Console.ReadLine();
        }
示例#3
0
    void Start()
    {
        ContextStrategy context = new ContextStrategy();

        context.strategy = new ConcreatStrategyA();
        context.CanDo();

        context.strategy = new ConcreatStrategyB();
        context.CanDo();
    }
示例#4
0
    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);
            }
        }
    }
示例#5
0
        //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));
        }
示例#6
0
        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>();
        }
示例#7
0
        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));
        }
示例#8
0
 public LogConfigSetup WithContextStrategy(ContextStrategy strategy)
 {
     ContextStrategy = strategy;
     return(this);
 }
示例#9
0
        protected BuilderBase()
        {
            var repository = IocManager.Instance.Resolve <IRepository <TContent> >();

            Context = new ContextStrategy <TContent>(repository.GetAll());
        }