Exemplo n.º 1
0
        private void DebugFillFiles(DragEventArgs e)
        {
            string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false);
            int      i;
            var      fields = GetReportItems();

            for (i = 0; i < s.Length; i++)
            {
                Console.WriteLine();

                using (StreamReader file = File.OpenText(s[i]))
                    using (JsonTextReader reader = new JsonTextReader(file))
                    {
                        TT_Fill fill = new TT_Fill(JToken.ReadFrom(reader));
                        FDLog.LogMessage(String.Format("Parsing fill from file {0}", s[i]));
                        var reports = FillReport.GetReports(fill, false);
                        foreach (var report in reports)
                        {
                            string row = "";
                            foreach (var field in fields)
                            {
                                try
                                {
                                    row += field.DisplayField(report) + ",";
                                }
                                catch (Exception ex)
                                {
                                    row += ",";
                                    FDLog.LogError("Error parsing fill column " + field.ColumnName + " for fill " + fill.RecordID + Environment.NewLine + ex.Message);
                                }
                            }
                            FDLog.LogMessage(row);
                        }
                    }
            }
        }
Exemplo n.º 2
0
        protected bool WriteFillsToFile(List <TT_Fill> fills)
        {
            bool errors = false;

            foreach (TT_Fill fill in fills)
            {
                bool   fill_errors = false;
                String row         = "";

                var reports = FillReport.GetReports(fill, false);
                foreach (var report in reports)
                {
                    foreach (FillColumn column in m_columns)
                    {
                        try
                        {
                            row += column.DisplayField(report) + ",";
                        }
                        catch (Exception ex)
                        {
                            row += ",";
                            FDLog.LogError("Error parsing fill column " + column.ColumnName + " for fill " + fill.RecordID + Environment.NewLine + ex.Message);
                            fill_errors = true;
                        }
                    }
                    if (fill_errors)
                    {
                        FDLog.LogError("Json for fill " + fill.RecordID + ": " + fill.JsonData() + Environment.NewLine);
                        errors = true;
                    }
                    row += Environment.NewLine;
                    m_outputFile.Write(row.ToString());
                }
            }
            return(errors);
        }
Exemplo n.º 3
0
 public String DisplayField(FillReport fill)
 {
     return(fieldDisplay(fill));
 }