Beispiel #1
0
        public static Validation <Error, ICentralinoLine> Of(string line)
        {
            return(LineDto.Of(line).ToValidation().Bind(lineDto =>
            {
                var internalNumber = new InternalNumber(lineDto.InternalNumberStr);
                var externalNumber = ExternalNumber.Of(lineDto.ExternalNumberStr);
                var coCode = new CoCode(lineDto.CoCodeStr);
                var cdCode = string.IsNullOrWhiteSpace(lineDto.CdCodeStr) ? None : Some(new CdCode(lineDto.CdCodeStr));

                Validation <Error, DateTime> dateTimeValue = ReadDate(lineDto.DateTimeStr).MapFail(error => EnrichError(error, line));
                Validation <Error, Cost> costValue = ReadCost(lineDto.CostStr).MapFail(error => EnrichError(error, line));;
                Validation <Error, Duration> durationValue = ReadDuration(lineDto.DurationStr).MapFail(error => EnrichError(error, line));;

                return (dateTimeValue, costValue, durationValue).Apply((dateTime, cost, duration) =>
                                                                       (ICentralinoLine)externalNumber
                                                                       .CreateCall(new CallData(
                                                                                       line,
                                                                                       dateTime,
                                                                                       internalNumber,
                                                                                       coCode,
                                                                                       cdCode,
                                                                                       duration,
                                                                                       cost)));
            }));
        }
Beispiel #2
0
        public NumberInputNode() : base(new ExternalNumberOperator())
        {
            //Source.Data = new PNumber(15);
            var d   = new ExternalNumber(15);
            var ext = new ExternalData(d);

            Source.ConnectToData(new List <ExternalData>()
            {
                ext
            });
            d.RequestChange(15);
        }
Beispiel #3
0
        public static void GraphTest()
        {
            var n      = new AddNode();
            var n2     = new NumberInputNode();
            var numer  = 152.2;
            var exNum  = new ExternalNumber(numer);
            var exData = new ExternalData(exNum);

            n2.ConnectToData(new List <ExternalData>()
            {
                exData
            });

            Print(n2.OutputSockets[0].Data);
            exNum.RequestChange(130);
            Print(n2.OutputSockets[0].Data);

            n.InputSockets[0].ConnectTo(n2.OutputSockets[0]);
        }