コード例 #1
0
        public void CheckData()
        {
            Debug.WriteLine("---Class CheckDataLog  Method CheckData---");
            String pathR = @"F:\InputData\ERRORLOG";

            List <String> lcd = new List <String>();

            if (File.Exists(pathR))
            {
                try
                {
                    String[] read = System.IO.File.ReadAllLines(pathR);
                    Debug.WriteLine("Contents of ERRORLOG.txt = ");
                    int    length = 22, i = 0, j = 0;
                    String r2;
                    foreach (string r in read)
                    {
                        if (r.Length >= 23)
                        {
                            if (fd.validate(r.Substring(0, length)))
                            {
                                if (r.Contains("Error") || (r.IndexOf("Error") != -1))
                                {
                                    j = i;
                                    //Debug.WriteLine(read[j + 1].Count());
                                    //Debug.WriteLine(r + "\n" + read[j + 1] + " " + read[j + 1].Substring(35, read[j + 1].Count()-35 ) );
                                    spdb.InsertErrorLog(db.getServerID(), r.Substring(r.IndexOf("Error"), (r.IndexOf(",")) - r.IndexOf("Error")), read[j + 1].Substring(35, read[j + 1].Count() - 35).Replace("'", ""), read[j + 1].Substring(0, 23));
                                    //Debug.WriteLine("i = "+ i+"I = "+(i)); ตรวจสอบความถูกต้อง

                                    lcd.Add(r.Substring(r.IndexOf("Error"), (r.IndexOf(",")) - r.IndexOf("Error")));
                                }
                                else if (r.Contains("Backup"))
                                {
                                    Debug.WriteLine(r + " " + r.Substring(35, r.Count() - 35) + " " + r.Substring(0, 23));
                                    spdb.InsertBackupLog(1, r.Substring(35, r.Count() - 35), r.Substring(0, 23));
                                }
                                else
                                {
                                    // Debug.WriteLine("Not found");
                                }
                            }
                        }
                        i++;
                    }
                }
                catch (IOException e)
                {
                    Debug.WriteLine("Catch IOException =" + e);
                }
            }
            Debug.Write(lcd.Count() + "\n");
            db.setListData(lcd);
            adeab.CheckErrorInBase(lcd);
        }
コード例 #2
0
 public void QueueData(DataSet ds)
 {
     Debug.WriteLine("---Class QueueTrafficDataSolution  Method QueueData---");
     try
     {
         foreach (DataTable myTable in ds.Tables)
         {
             foreach (DataRow myRow in myTable.Rows)
             {
                 Debug.WriteLine("Solution_ID" + myRow["Solution_ID"] + "\n");
                 Debug.WriteLine("MemoryError_ID" + myRow["MemoryError_ID"] + "\n");
                 spdb.QueueDataSolution(Convert.ToInt32(myRow["Solution_ID"]), Convert.ToInt32(myRow["MemoryError_ID"]), db.getServerID());
             }
         }
     }catch (Exception e)
     {
         Debug.WriteLine("CatchException =" + e);
     }
 }