示例#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)));
            }));
        }
 public OutgoingCall(
     string originalLine,
     DateTime dateTime,
     InternalNumber internalNumber,
     OutgoingNumber externalNumber,
     CoCode coCode,
     Option <CdCode> cdCode,
     Duration duration,
     Cost cost)
 {
     CallData       = new CallData(originalLine, dateTime, internalNumber, coCode, cdCode, duration, cost);
     ExternalNumber = externalNumber;
 }
示例#3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = DateTime.GetHashCode();
         hashCode = (hashCode * 397) ^ (InternalNumber != null ? InternalNumber.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CoCode != null ? CoCode.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CdCode.GetHashCode();
         hashCode = (hashCode * 397) ^ (Duration != null ? Duration.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Cost != null ? Cost.GetHashCode() : 0);
         return(hashCode);
     }
 }
示例#4
0
 public CallData(
     string originalLine,
     DateTime dateTime,
     InternalNumber internalNumber,
     CoCode coCode,
     Option <CdCode> cdCode,
     Duration duration,
     Cost cost)
 {
     OriginalLine   = originalLine;
     DateTime       = dateTime;
     InternalNumber = internalNumber;
     CoCode         = coCode;
     CdCode         = cdCode;
     Duration       = duration;
     Cost           = cost;
 }
 protected bool Equals(CoCode other)
 {
     return(Value == other.Value);
 }