ChrisCompleteCodeTrunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
namespace BT_Statement_Merge
{
public static class Reporting
{
static bool debug = ConfigurationManager.AppSettings["DEBUG"].Equals("TRUE") ? true : false;
static string logFolder = ConfigurationManager.AppSettings["Log Folder"];
public static void Error(string message, string stack)
{
EventLog.WriteEntry("BTStatementMerge", "Error: " + message + "\nDebugging Stack Trace:\n" + (debug ? stack : ""), EventLogEntryType.Error);
}
public static void AppendLog(string CustomerNumber, string Message)
{
string logFile = Path.Combine(ConfigurationManager.AppSettings["Log Folder"].ToString(), "log.csv");
bool addHeader = false;
if (!File.Exists(logFile))
{
addHeader = true;
}
//StreamWriter sw = File.CreateText(logFile, true);
StreamWriter sw = new StreamWriter(logFile, true);
if (addHeader)
{
sw.WriteLine("\"Customer Number\",\"Invoice Number\"");
}
sw.WriteLine(CustomerNumber + "," + Message);
sw.Flush();
sw.Close();
}
}
}
|
Revision |
Author |
Commited |
Message |
1
|
BBDSCHRIS
|
Wed 22 Aug, 2018 20:08:03 +0000 |
|