Ejemplo n.º 1
0
        public Outputs Create(Inputs inputs)
        {
            StreamLoop <Fuel> sStart = new StreamLoop <Fuel>();
            Fill fi = new Fill(inputs.SClearSale,
                               inputs.SFuelPulses, inputs.Calibration,
                               inputs.Price1, inputs.Price2, inputs.Price3,
                               sStart);
            NotifyPointOfSale np = new NotifyPointOfSale(
                new LifeCycle(inputs.SNozzle1,
                              inputs.SNozzle2,
                              inputs.SNozzle3),
                inputs.SClearSale,
                fi);

            sStart.Loop(np.SStart);
            CellLoop <bool> keypadActive = new CellLoop <bool>();
            Keypad          ke           = new Keypad(inputs.SKeypad,
                                                      inputs.SClearSale,
                                                      keypadActive);
            Preset pr = new Preset(ke.Value, fi, np.FuelFlowing);

            keypadActive.Loop(pr.KeypadActive);
            return(new Outputs()
                   .SetDelivery(pr.Delivery)
                   .SetSaleCostLcd(fi.DollarsDelivered.Map(Formatters.FormatSaleCost))
                   .SetSaleQuantityLcd(fi.LitersDelivered.Map(Formatters.FormatSaleQuantity))
                   .SetPriceLcd1(ShowDollarsPump.PriceLcd(np.FillActive, fi.Price, Fuel.One, inputs))
                   .SetPriceLcd2(ShowDollarsPump.PriceLcd(np.FillActive, fi.Price, Fuel.Two, inputs))
                   .SetPriceLcd3(ShowDollarsPump.PriceLcd(np.FillActive, fi.Price, Fuel.Three, inputs))
                   .SetSaleComplete(np.SSaleComplete)
                   .SetPresetLcd(ke.Value.Map(Formatters.FormatPresetAmount))
                   .SetBeep(np.SBeep.OrElse(ke.SBeep)));
        }
Ejemplo n.º 2
0
        public Outputs Create(Inputs inputs)
        {
            StreamLoop <Fuel> sStart = new StreamLoop <Fuel>();
            Fill fi = new Fill(
                inputs.SClearSale,
                inputs.SFuelPulses, inputs.Calibration,
                inputs.Price1, inputs.Price2, inputs.Price3,
                sStart);
            NotifyPointOfSale np = new NotifyPointOfSale(
                new LifeCycle(inputs.SNozzle1,
                              inputs.SNozzle2,
                              inputs.SNozzle3),
                inputs.SClearSale,
                fi);

            sStart.Loop(np.SStart);
            return(new Outputs()
                   .SetDelivery(np.FuelFlowing.Map(
                                    m =>
                                    m.Equals(Maybe.Some(Fuel.One)) ? Delivery.Fast1 :
                                    m.Equals(Maybe.Some(Fuel.Two)) ? Delivery.Fast2 :
                                    m.Equals(Maybe.Some(Fuel.Three)) ? Delivery.Fast3 :
                                    Delivery.Off))
                   .SetSaleCostLcd(fi.DollarsDelivered.Map(Formatters.FormatSaleCost))
                   .SetSaleQuantityLcd(fi.LitersDelivered.Map(Formatters.FormatSaleQuantity))
                   .SetPriceLcd1(ShowDollarsPump.PriceLcd(np.FillActive, fi.Price, Fuel.One, inputs))
                   .SetPriceLcd2(ShowDollarsPump.PriceLcd(np.FillActive, fi.Price, Fuel.Two, inputs))
                   .SetPriceLcd3(ShowDollarsPump.PriceLcd(np.FillActive, fi.Price, Fuel.Three, inputs))
                   .SetBeep(np.SBeep)
                   .SetSaleComplete(np.SSaleComplete));
        }
Ejemplo n.º 3
0
        public Outputs Create(Inputs inputs)
        {
            EventLoop <Fuel> eStart = new EventLoop <Fuel>();
            Fill             fi     = new Fill(
                inputs.EClearSale.Map(u => Unit.UNIT),
                inputs.EFuelPulses, inputs.Calibration,
                inputs.Price1, inputs.Price2, inputs.Price3,
                eStart);
            NotifyPointOfSale np = new NotifyPointOfSale(
                new LifeCycle(inputs.ENozzle1,
                              inputs.ENozzle2,
                              inputs.ENozzle3),
                inputs.EClearSale,
                fi);

            eStart.Loop(np.EStart);
            return(new Outputs()
                   .SetDelivery(np.FuelFlowing.Map(
                                    of =>
                                    of.Equals(Optional <Fuel> .Of(Fuel.ONE))   ? Delivery.FAST1 :
                                    of.Equals(Optional <Fuel> .Of(Fuel.TWO))   ? Delivery.FAST2 :
                                    of.Equals(Optional <Fuel> .Of(Fuel.THREE)) ? Delivery.FAST3 :
                                    Delivery.OFF))
                   .SetSaleCostLcd(fi.DollarsDelivered.Map(
                                       q => Formatters.FormatSaleCost(q)))
                   .SetSaleQuantityLcd(fi.LitersDelivered.Map(
                                           q => Formatters.FormatSaleQuantity(q)))
                   .SetPriceLcd1(ShowDollarsPump.PriceLCD(np.FillActive, fi.Price,
                                                          Fuel.ONE, inputs))
                   .SetPriceLcd2(ShowDollarsPump.PriceLCD(np.FillActive, fi.Price,
                                                          Fuel.TWO, inputs))
                   .SetPriceLcd3(ShowDollarsPump.PriceLCD(np.FillActive, fi.Price,
                                                          Fuel.THREE, inputs))
                   .SetBeep(np.EBeep)
                   .SetSaleComplete(np.ESaleComplete));
        }
Ejemplo n.º 4
0
        public Outputs Create(Inputs inputs)
        {
            EventLoop <Fuel> eStart = new EventLoop <Fuel>();
            Fill             fi     = new Fill(inputs.EClearSale.Map(u => Unit.UNIT),
                                               inputs.EFuelPulses, inputs.Calibration,
                                               inputs.Price1, inputs.Price2, inputs.Price3,
                                               eStart);
            NotifyPointOfSale np = new NotifyPointOfSale(
                new LifeCycle(inputs.ENozzle1,
                              inputs.ENozzle2,
                              inputs.ENozzle3),
                inputs.EClearSale,
                fi);

            eStart.Loop(np.EStart);
            BehaviorLoop <bool> keypadActive = new BehaviorLoop <bool>();
            Keypad ke = new Keypad(inputs.EKeypad,
                                   inputs.EClearSale,
                                   keypadActive);
            Preset pr = new Preset(ke.Value,
                                   fi,
                                   np.FuelFlowing,
                                   np.FillActive.Map(o => o.IsPresent));

            keypadActive.Loop(pr.KeypadActive);
            return(new Outputs()
                   .SetDelivery(pr.Delivery)
                   .SetSaleCostLcd(fi.DollarsDelivered.Map(q => Formatters.FormatSaleCost(q)))
                   .SetSaleQuantityLcd(fi.LitersDelivered.Map(q => Formatters.FormatSaleQuantity(q)))
                   .SetPriceLcd1(ShowDollarsPump.PriceLCD(np.FillActive, fi.Price, Fuel.ONE, inputs))
                   .SetPriceLcd2(ShowDollarsPump.PriceLCD(np.FillActive, fi.Price, Fuel.TWO, inputs))
                   .SetPriceLcd3(ShowDollarsPump.PriceLCD(np.FillActive, fi.Price, Fuel.THREE, inputs))
                   .SetSaleComplete(np.ESaleComplete)
                   .SetPresetLcd(ke.Value.Map(v => Formatters.FormatSaleCost((double)v)))
                   .SetBeep(np.EBeep.Merge(ke.EBeep)));
        }