public override void WriteJson(JsonWriter writer, T value, JsonSerializer serializer)
        {
            var jsonEmployeeTermConverter = new WorkEmployeeTermConverter();
            var jsonPositionTypeConverter = new WorkPositionTypeConverter();
            var jsonDateTimeCoverter      = new IsoDateTimeConverter()
            {
                DateTimeFormat = "d.M.yyyy"
            };

            JsonSerializer propertySerializer = new JsonSerializer();

            propertySerializer.Converters.Add(jsonEmployeeTermConverter);
            propertySerializer.Converters.Add(jsonPositionTypeConverter);
            propertySerializer.Converters.Add(jsonDateTimeCoverter);

            JToken t = JToken.FromObject(value, propertySerializer);

            JObject o = (JObject)t;

            JValue codeValue = (JValue)ArticleCodeAdapter.GetSymbol(value.Code());

            o.AddFirst(new JProperty("Code", codeValue));

            o.WriteTo(writer);
        }
        public string DecoratedError(string message)
        {
            string articleEnum = ArticleCodeAdapter.GetSymbol(InternalConfig.Code());

            string articleCode = InternalConfig.Code().ToString();

            string decoratedMessage = string.Format(RESULT_DESCRIPTION_ERROR_FORMAT, articleEnum, articleCode, message);

            return(decoratedMessage);
        }
        public override string ToString()
        {
            string articleCode = ArticleCodeAdapter.GetSymbol(InternalConfig.Code());

            string articleDesc = string.Join("\t", ResultValues.Select((v) => (v.Description())));

            if (ResultValues.Count() == 0)
            {
                articleDesc = ">>------------------------------------------------------<<";
            }

            return(string.Format("{0}\t\t{1}", articleCode, articleDesc));
        }
        public string ToResultExport(string targetSymbol)
        {
            string eresultFormat = "{0}\tNONE\tHours\tEMPTY\tDays\tEMPTY\tIncome Amount\tEMPTY\tBasis Amount\tEMPTY\tPayment\tEMPTY";
            string articleSymbol = ArticleCodeAdapter.GetSymbol(InternalConfig.Code());

            string articleFormat = string.Join("\t", targetSymbol, articleSymbol);

            string resultsFormat = string.Join("\n", ResultValues.Select((v) => (v.ToResultExport(articleFormat))));

            if (ResultValues.Count() == 0)
            {
                resultsFormat = string.Format(eresultFormat, articleFormat);
            }

            return(resultsFormat);
        }
Exemplo n.º 5
0
 private string DescriptionPath(IEnumerable <ConfigCode> articlePath)
 {
     return(articlePath.Aggregate("", (agr, a) => (string.Format("{0}{1}\n", agr, ArticleCodeAdapter.CreateEnum(a).GetSymbol()))));
 }
Exemplo n.º 6
0
 public string Description(IDictionary <ConfigCode, IEnumerable <ConfigCode> > articleSink)
 {
     return(articleSink.Aggregate("", (agr, a) => (string.Format("{0}\n{1}{2}\n", agr, ArticleCodeAdapter.CreateEnum(a.Key).GetSymbol(),
                                                                 a.Value.Aggregate("", (bgr, b) => (string.Format("{0}\n={1}", bgr, ArticleCodeAdapter.CreateEnum(b).GetSymbol())))))));
 }