Пример #1
0
 /// <summary>
 /// 导出日志
 /// </summary>
 /// <param name="path"></param>
 /// <param name="DateTime"></param>
 public void LogWrite(string path, string DateTime)
 {
     try
     {
         string        Tableresult = OperateIniTool.OperateIniRead("Table", "Name");
         List <string> Table       = !string.IsNullOrEmpty(Tableresult) ? Tableresult.Split(',').ToList() : new List <string>();
         StringBuilder builder     = new StringBuilder();
         foreach (var item in Table)
         {
             if (MapBLL.TableNotexistBLL($"{item}{DateTime}"))
             {
                 builder.Append(MapBLL.ExportMySqlTables($"{item}{DateTime}", "agv"));
             }
         }
         File.WriteAllText(path, builder.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception(ex.ToString());
     }
 }
Пример #2
0
        /// <summary>
        /// 导出日志
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Write_Log_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(DateTimes.Text))
            {
                MessageBoxTool.Error("请选择查询日期!");
                return;
            }
            string Times = (Convert.ToDateTime(DateTimes.Text)).ToString("yyyyMMdd");

            if (Ga_Map.TableNotexistBLL($"loginfo{Times}"))
            {
                Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog();
                sfd.Filter   = "日志文件|*.log";
                sfd.FileName = $"log_{Times}";
                if (sfd.ShowDialog() == true)
                {
                    Function.LogWrite(sfd.FileName, Times);
                }
            }
            else
            {
                MessageBoxTool.Error("暂无日志!");
            }
        }