Esempio n. 1
0
        public static IFreeDocument Transform(this IColumnDataTransformer ge,
                                              IFreeDocument item, AnalyzeItem analyzeItem)
        {
            if (item == null)
            {
                return(new FreeDocument());
            }

            var dict = item;

            object res = null;

            try
            {
                if (ge.OneOutput && dict[ge.Column] == null)
                {
                    if (analyzeItem != null)
                    {
                        analyzeItem.EmptyInput += 1;
                    }
                }
                else
                {
                    res = ge.TransformData(dict);
                }
            }
            catch (Exception ex)
            {
                res = ex.Message;
                if (analyzeItem != null)
                {
                    analyzeItem.Error++;
                    analyzeItem.Analyzer.AddErrorLog(item, ex, ge);
                }

                XLogSys.Print.Error(string.Format(GlobalHelper.Get("key_208"), ge.Column, ge.TypeName, res));
            }

            if (ge.OneOutput)
            {
                if (!string.IsNullOrWhiteSpace(ge.NewColumn))
                {
                    if (res != null)
                    {
                        dict.SetValue(ge.NewColumn, res);
                    }
                }
                else
                {
                    if (res != null)
                    {
                        dict.SetValue(ge.Column, res);
                    }
                }
            }


            return(dict);
        }
Esempio n. 2
0
        public static IFreeDocument Transform(this IColumnDataTransformer ge,
                                              IFreeDocument item, AnalyzeItem analyzeItem)
        {
            if (item == null)
            {
                return(new FreeDocument());
            }

            var dict = item;

            object res = null;

            try
            {
                if (ge.OneOutput && dict[ge.Column] == null)
                {
                    analyzeItem.EmptyInput++;
                }
                else
                {
                    res = ge.TransformData(dict);
                }
            }
            catch (Exception ex)
            {
                res = ex.Message;
                analyzeItem.Error++;
                XLogSys.Print.Error($"位于{ge.ETLIndex}, 作用在{ge.Column}的模块 {ge.TypeName} 转换出错, 信息{res}");
            }

            if (ge.OneOutput)
            {
                if (!string.IsNullOrWhiteSpace(ge.NewColumn))
                {
                    if (res != null)
                    {
                        dict.SetValue(ge.NewColumn, res);
                    }
                }
                else
                {
                    dict.SetValue(ge.Column, res);
                }
            }


            return(dict);
        }
Esempio n. 3
0
        private IFreeDocument Transform(IColumnDataTransformer ge,
                                        IFreeDocument item)
        {
            if (item == null)
            {
                return(new FreeDocument());
            }

            var dict = item;

            object res = null;

            try
            {
                if (ge.OneOutput && dict[ge.Column] == null)
                {
                }
                else
                {
                    res = ge.TransformData(dict);
                }
            }
            catch (Exception ex)
            {
                res = ex.Message;
                XLogSys.Print.Error(ex.ToString());
            }

            if (ge.OneOutput)
            {
                if (!string.IsNullOrWhiteSpace(ge.NewColumn))
                {
                    if (res != null)
                    {
                        dict.SetValue(ge.NewColumn, res);
                    }
                }
                else
                {
                    dict.SetValue(ge.Column, res);
                }
            }


            return(dict);
        }
Esempio n. 4
0
        private IFreeDocument Transform(IColumnDataTransformer ge,
            IFreeDocument item)
        {
            if (item == null)
                return new FreeDocument();

            var dict = item;

            object res = null;
            try
            {
                if (ge.OneOutput && dict[ge.Column] == null)
                {
                }
                else
                {
                    res = ge.TransformData(dict);
                }
            }
            catch (Exception ex)
            {
                res = ex.Message;
            }

            if (ge.OneOutput)
            {
                if (!string.IsNullOrWhiteSpace(ge.NewColumn))
                {
                    if (res != null)
                    {
                        dict.SetValue(ge.NewColumn, res);
                    }
                }
                else
                {
                    dict.SetValue(ge.Column, res);
                }
            }

            return dict;
        }