示例#1
0
 private static bool TryCastToRNT <T>(ConverterRowBase <T> row, dynamic dynamic, out T casted) where T : class, IDocumentDTO
 {
     try
     {
         casted = row.CastToRNT(dynamic);
         return(true);
     }
     catch (Exception ex)
     {
         var obj = dynamic as object;
         row.LogError(obj.ToJson(true));
         row.LogError(ex.Info(true, true));
         casted = default(T);
         return(false);
     }
 }
示例#2
0
        private static void ShowFirstDiff <T>(this ConverterRowBase <T> row) where T : class, IDocumentDTO
        {
            var diff1 = row.DiffRows.FirstOrDefault(_ => _.IsTheSame == false);

            if (diff1 == null)
            {
                row.OnAllRecordsMatch();
                return;
            }
            row.LogError(diff1.Difference);
        }
示例#3
0
 private static List <JsonComparer> AlignRecords <T>(this ConverterRowBase <T> row, List <T> byfRecs, List <T> rntRecs) where T : class, IDocumentDTO
 {
     try
     {
         return(row.AlignByIDs(byfRecs, rntRecs));
     }
     catch (Exception ex)
     {
         row.LogError(ex.Info(true, true));
         return(null);
     }
 }
示例#4
0
 private static List <T> SafeGetRntRecords <T>(this ConverterRowBase <T> row) where T : class, IDocumentDTO
 {
     try
     {
         return(row.GetRntRecords(row.Main.AppArgs));
     }
     catch (Exception ex)
     {
         row.LogError(ex.Info(true, true));
         return(null);
     }
 }
示例#5
0
        private static async Task <List <dynamic> > QueryByfServer <T>(this ConverterRowBase <T> row) where T : class, IDocumentDTO
        {
            try
            {
                await row.BeforeByfQuery();

                return(await row.GetViewsList(row.ViewsDisplayID));
            }
            catch (Exception ex)
            {
                row.LogError(ex.Info(true, true));
                return(null);
            }
        }
        public static async Task UpdateRnt <T>(this ConverterRowBase <T> row) where T : class, IDocumentDTO
        {
            row.StartBeingBusy($"Importing all {row.Label} ...");
            await Task.Delay(1);

            await Task.Run(() =>
            {
                try
                {
                    var recs = row.DiffRows.Select(_ => _.Document1 as T);
                    row.ReplaceAll(recs, row.Main.AppArgs.MarketState);
                }
                catch (Exception ex)
                {
                    row.LogError(ex.Info(true, true));
                }
            });

            await Task.Delay(500);

            row.StopBeingBusy();
            row.RefreshCmd.ExecuteIfItCan();
        }