Suche senden
Hochladen
XTW_Import
•
Als DOCX, PDF herunterladen
•
0 gefällt mir
•
444 views
L
Luther Quinn
Folgen
Melden
Teilen
Melden
Teilen
1 von 12
Jetzt herunterladen
Empfohlen
C# Application program UNIT III
C# Application program UNIT III
Minu Rajasekaran
Java programs
Java programs
jojeph
The Ring programming language version 1.5.1 book - Part 12 of 180
The Ring programming language version 1.5.1 book - Part 12 of 180
Mahmoud Samir Fayed
Java practice programs for beginners
Java practice programs for beginners
ishan0019
Ejemplo radio
Ejemplo radio
lupe ga
Dagger & rxjava & retrofit
Dagger & rxjava & retrofit
Ted Liang
An Introduction to RxJava
An Introduction to RxJava
K. Matthew Dupree
DCN Practical
DCN Practical
Niraj Bharambe
Empfohlen
C# Application program UNIT III
C# Application program UNIT III
Minu Rajasekaran
Java programs
Java programs
jojeph
The Ring programming language version 1.5.1 book - Part 12 of 180
The Ring programming language version 1.5.1 book - Part 12 of 180
Mahmoud Samir Fayed
Java practice programs for beginners
Java practice programs for beginners
ishan0019
Ejemplo radio
Ejemplo radio
lupe ga
Dagger & rxjava & retrofit
Dagger & rxjava & retrofit
Ted Liang
An Introduction to RxJava
An Introduction to RxJava
K. Matthew Dupree
DCN Practical
DCN Practical
Niraj Bharambe
The Ring programming language version 1.7 book - Part 73 of 196
The Ring programming language version 1.7 book - Part 73 of 196
Mahmoud Samir Fayed
The Ring programming language version 1.5.3 book - Part 26 of 184
The Ring programming language version 1.5.3 book - Part 26 of 184
Mahmoud Samir Fayed
The Ring programming language version 1.8 book - Part 75 of 202
The Ring programming language version 1.8 book - Part 75 of 202
Mahmoud Samir Fayed
Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time API
jagriti srivastava
Into Clojure
Into Clojure
Alf Kristian Støyle
The Ring programming language version 1.5.2 book - Part 76 of 181
The Ring programming language version 1.5.2 book - Part 76 of 181
Mahmoud Samir Fayed
Registro de venta
Registro de venta
lupe ga
JJUG CCC 2011 Spring
JJUG CCC 2011 Spring
Kiyotaka Oku
The Ring programming language version 1.7 book - Part 16 of 196
The Ring programming language version 1.7 book - Part 16 of 196
Mahmoud Samir Fayed
The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.6 book - Part 15 of 189
Mahmoud Samir Fayed
The Ring programming language version 1.9 book - Part 11 of 210
The Ring programming language version 1.9 book - Part 11 of 210
Mahmoud Samir Fayed
Angular2 rxjs
Angular2 rxjs
Christoffer Noring
The Ring programming language version 1.10 book - Part 80 of 212
The Ring programming language version 1.10 book - Part 80 of 212
Mahmoud Samir Fayed
ESNext for humans - LvivJS 16 August 2014
ESNext for humans - LvivJS 16 August 2014
Jan Jongboom
Alternate JVM Languages
Alternate JVM Languages
Saltmarch Media
AJUG April 2011 Cascading example
AJUG April 2011 Cascading example
Christopher Curtin
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Sages
The Ring programming language version 1.8 book - Part 9 of 202
The Ring programming language version 1.8 book - Part 9 of 202
Mahmoud Samir Fayed
The Ring programming language version 1.5.2 book - Part 39 of 181
The Ring programming language version 1.5.2 book - Part 39 of 181
Mahmoud Samir Fayed
The Ring programming language version 1.8 book - Part 30 of 202
The Ring programming language version 1.8 book - Part 30 of 202
Mahmoud Samir Fayed
Xtive Cms6 Cms Congres2010
Xtive Cms6 Cms Congres2010
heine200
Xv Olimpiadas Ambiente 2009 2010
Xv Olimpiadas Ambiente 2009 2010
clvr
Weitere ähnliche Inhalte
Was ist angesagt?
The Ring programming language version 1.7 book - Part 73 of 196
The Ring programming language version 1.7 book - Part 73 of 196
Mahmoud Samir Fayed
The Ring programming language version 1.5.3 book - Part 26 of 184
The Ring programming language version 1.5.3 book - Part 26 of 184
Mahmoud Samir Fayed
The Ring programming language version 1.8 book - Part 75 of 202
The Ring programming language version 1.8 book - Part 75 of 202
Mahmoud Samir Fayed
Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time API
jagriti srivastava
Into Clojure
Into Clojure
Alf Kristian Støyle
The Ring programming language version 1.5.2 book - Part 76 of 181
The Ring programming language version 1.5.2 book - Part 76 of 181
Mahmoud Samir Fayed
Registro de venta
Registro de venta
lupe ga
JJUG CCC 2011 Spring
JJUG CCC 2011 Spring
Kiyotaka Oku
The Ring programming language version 1.7 book - Part 16 of 196
The Ring programming language version 1.7 book - Part 16 of 196
Mahmoud Samir Fayed
The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.6 book - Part 15 of 189
Mahmoud Samir Fayed
The Ring programming language version 1.9 book - Part 11 of 210
The Ring programming language version 1.9 book - Part 11 of 210
Mahmoud Samir Fayed
Angular2 rxjs
Angular2 rxjs
Christoffer Noring
The Ring programming language version 1.10 book - Part 80 of 212
The Ring programming language version 1.10 book - Part 80 of 212
Mahmoud Samir Fayed
ESNext for humans - LvivJS 16 August 2014
ESNext for humans - LvivJS 16 August 2014
Jan Jongboom
Alternate JVM Languages
Alternate JVM Languages
Saltmarch Media
AJUG April 2011 Cascading example
AJUG April 2011 Cascading example
Christopher Curtin
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Sages
The Ring programming language version 1.8 book - Part 9 of 202
The Ring programming language version 1.8 book - Part 9 of 202
Mahmoud Samir Fayed
The Ring programming language version 1.5.2 book - Part 39 of 181
The Ring programming language version 1.5.2 book - Part 39 of 181
Mahmoud Samir Fayed
The Ring programming language version 1.8 book - Part 30 of 202
The Ring programming language version 1.8 book - Part 30 of 202
Mahmoud Samir Fayed
Was ist angesagt?
(20)
The Ring programming language version 1.7 book - Part 73 of 196
The Ring programming language version 1.7 book - Part 73 of 196
The Ring programming language version 1.5.3 book - Part 26 of 184
The Ring programming language version 1.5.3 book - Part 26 of 184
The Ring programming language version 1.8 book - Part 75 of 202
The Ring programming language version 1.8 book - Part 75 of 202
Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time API
Into Clojure
Into Clojure
The Ring programming language version 1.5.2 book - Part 76 of 181
The Ring programming language version 1.5.2 book - Part 76 of 181
Registro de venta
Registro de venta
JJUG CCC 2011 Spring
JJUG CCC 2011 Spring
The Ring programming language version 1.7 book - Part 16 of 196
The Ring programming language version 1.7 book - Part 16 of 196
The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.9 book - Part 11 of 210
The Ring programming language version 1.9 book - Part 11 of 210
Angular2 rxjs
Angular2 rxjs
The Ring programming language version 1.10 book - Part 80 of 212
The Ring programming language version 1.10 book - Part 80 of 212
ESNext for humans - LvivJS 16 August 2014
ESNext for humans - LvivJS 16 August 2014
Alternate JVM Languages
Alternate JVM Languages
AJUG April 2011 Cascading example
AJUG April 2011 Cascading example
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
The Ring programming language version 1.8 book - Part 9 of 202
The Ring programming language version 1.8 book - Part 9 of 202
The Ring programming language version 1.5.2 book - Part 39 of 181
The Ring programming language version 1.5.2 book - Part 39 of 181
The Ring programming language version 1.8 book - Part 30 of 202
The Ring programming language version 1.8 book - Part 30 of 202
Andere mochten auch
Xtive Cms6 Cms Congres2010
Xtive Cms6 Cms Congres2010
heine200
Xv Olimpiadas Ambiente 2009 2010
Xv Olimpiadas Ambiente 2009 2010
clvr
XTM 1.0 to XTM 2.0 conversion issues
XTM 1.0 to XTM 2.0 conversion issues
tmra
xxxxqwqwxxxxx34352
xxxxqwqwxxxxx34352
cephas3
Xray collaborative research
Xray collaborative research
xuan
XXIV asamblea general por delegados
XXIV asamblea general por delegados
fediancali
Xto
Xto
Miguel Sanz
xyzmo 4 Insurance White Paper 2pages
xyzmo 4 Insurance White Paper 2pages
Namirial GmbH
X-Wi V1
X-Wi V1
Vincent Claes
xyzmo@Huber Client Quotation Signing
xyzmo@Huber Client Quotation Signing
Namirial GmbH
Xogos 1º ciclo
Xogos 1º ciclo
Chelo Alvarez Veira
Reproductive Effects Peak with Pesticide Exposure
Reproductive Effects Peak with Pesticide Exposure
School Vegetable Gardening - Victory Gardens
xsk2h.odp
xsk2h.odp
Jeff Smith
Xogodeatencion
Xogodeatencion
Olga
Xperia Wellness Spa
Xperia Wellness Spa
Jack Raquel
Xpression, UPES University Magazine
Xpression, UPES University Magazine
UPES Dehradun
Natalija Snytina
Natalija Snytina
prosvsports
Andere mochten auch
(17)
Xtive Cms6 Cms Congres2010
Xtive Cms6 Cms Congres2010
Xv Olimpiadas Ambiente 2009 2010
Xv Olimpiadas Ambiente 2009 2010
XTM 1.0 to XTM 2.0 conversion issues
XTM 1.0 to XTM 2.0 conversion issues
xxxxqwqwxxxxx34352
xxxxqwqwxxxxx34352
Xray collaborative research
Xray collaborative research
XXIV asamblea general por delegados
XXIV asamblea general por delegados
Xto
Xto
xyzmo 4 Insurance White Paper 2pages
xyzmo 4 Insurance White Paper 2pages
X-Wi V1
X-Wi V1
xyzmo@Huber Client Quotation Signing
xyzmo@Huber Client Quotation Signing
Xogos 1º ciclo
Xogos 1º ciclo
Reproductive Effects Peak with Pesticide Exposure
Reproductive Effects Peak with Pesticide Exposure
xsk2h.odp
xsk2h.odp
Xogodeatencion
Xogodeatencion
Xperia Wellness Spa
Xperia Wellness Spa
Xpression, UPES University Magazine
Xpression, UPES University Magazine
Natalija Snytina
Natalija Snytina
Ähnlich wie XTW_Import
Modul Praktek Java OOP
Modul Praktek Java OOP
Zaenal Arifin
WOTC_Import
WOTC_Import
Luther Quinn
Tdd
Tdd
Alexander Martyushev
package singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdf
amazing2001
Why following sort does not work (It does not sort last 2 - 3 numbe.pdf
Why following sort does not work (It does not sort last 2 - 3 numbe.pdf
gopalk44
code for quiz in my sql
code for quiz in my sql
JOYITAKUNDU1
Awt
Awt
Swarup Saha
Anti patterns
Anti patterns
Alex Tumanoff
The Ring programming language version 1.5.3 book - Part 77 of 184
The Ring programming language version 1.5.3 book - Part 77 of 184
Mahmoud Samir Fayed
Notepad
Notepad
Apr Jns
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
kostikjaylonshaewe47
The Ring programming language version 1.3 book - Part 50 of 88
The Ring programming language version 1.3 book - Part 50 of 88
Mahmoud Samir Fayed
TDC218SP | Trilha Kotlin - DSLs in a Kotlin Way
TDC218SP | Trilha Kotlin - DSLs in a Kotlin Way
tdc-globalcode
Js 单元测试框架介绍
Js 单元测试框架介绍
louieuser
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
julien.ponge
Fee managment system
Fee managment system
fairy9912
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
sudhirchourasia86
Java весна 2013 лекция 2
Java весна 2013 лекция 2
Technopark
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
Darwin Durand
The Ring programming language version 1.4 book - Part 18 of 30
The Ring programming language version 1.4 book - Part 18 of 30
Mahmoud Samir Fayed
Ähnlich wie XTW_Import
(20)
Modul Praktek Java OOP
Modul Praktek Java OOP
WOTC_Import
WOTC_Import
Tdd
Tdd
package singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdf
Why following sort does not work (It does not sort last 2 - 3 numbe.pdf
Why following sort does not work (It does not sort last 2 - 3 numbe.pdf
code for quiz in my sql
code for quiz in my sql
Awt
Awt
Anti patterns
Anti patterns
The Ring programming language version 1.5.3 book - Part 77 of 184
The Ring programming language version 1.5.3 book - Part 77 of 184
Notepad
Notepad
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
The Ring programming language version 1.3 book - Part 50 of 88
The Ring programming language version 1.3 book - Part 50 of 88
TDC218SP | Trilha Kotlin - DSLs in a Kotlin Way
TDC218SP | Trilha Kotlin - DSLs in a Kotlin Way
Js 单元测试框架介绍
Js 单元测试框架介绍
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Fee managment system
Fee managment system
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
Java весна 2013 лекция 2
Java весна 2013 лекция 2
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
The Ring programming language version 1.4 book - Part 18 of 30
The Ring programming language version 1.4 book - Part 18 of 30
XTW_Import
1.
using System; using System.Collections; using
System.Collections.Generic; using System.IO; using System.Text; using System.Threading; //.Tasks; using System.Xml; namespace FileInFileOut3 { class Program { private ArrayList logList = new ArrayList(); static int Main(string[] args) { Program prog = new Program(); String[] pathArgs = prog.GetConfig(args[0]); string inputPath = (string)pathArgs[0]; //InputPath string outputPath = (string)pathArgs[1]; //OutputPath String week1File = (String)pathArgs[2]; String week2File = (String)pathArgs[3]; bool success = prog.PrepareWageFiles(inputPath, outputPath, week1File, week2File); if (success == true) { Console.WriteLine("Merge success."); return 0; } else { Console.WriteLine("Merge failure."); return 1; } } private string CheckTaxWageValueFormat(string valueString, int numchar) { string outstring = ""; int valnum = valueString.Length; if (numchar - valnum == 5) { valueString = valueString.Insert(0, "00.00");
2.
} if (numchar -
valnum == 4) { valueString = valueString.Insert(0, "00.0"); } if (numchar - valnum == 3) { valueString = valueString.Insert(0, "00."); } if (numchar - valnum == 2) { valueString = valueString.Insert(0, "00"); } if (numchar - valnum == 1) { valueString = valueString.Insert(0, "0"); } outstring = valueString; valueString = ""; numchar = 0; valnum = 0; return outstring; } private bool Error() { return false; } private String[] GetConfig(String configPath) { XmlDocument xDoc; String[] filepathString; xDoc = new XmlDocument(); xDoc.Load(configPath + "/XTW_Import_settings.xml"); if (!xDoc.DocumentElement.IsEmpty) { XmlNode rootSegments = xDoc.DocumentElement.SelectSingleNode("DataFiles"); XmlNode inNode = rootSegments.ChildNodes[0]; XmlNode outNode = rootSegments.ChildNodes[1]; XmlNode Week1Node = rootSegments.ChildNodes[2]; XmlNode Week2Node = rootSegments.ChildNodes[3];
3.
if (!String.IsNullOrEmpty(inNode.InnerText) &
!String.IsNullOrEmpty(outNode.InnerText) & !String.IsNullOrEmpty(Week1Node.InnerText) & !String.IsNullOrEmpty(Week2Node.InnerText)) { filepathString = new String[] { inNode.InnerText, outNode.InnerText, Week1Node.InnerText, Week2Node.InnerText }; logList.Add("XML Settings document loaded in GetConfig ( ): "); logList.Add(" Qualified name of XmlDocument node: " + xDoc.Name); logList.Add(" Input Path : " + inNode.InnerText); logList.Add(" Output Path: " + outNode.InnerText); logList.Add(""); return filepathString; } else { return new String[] { }; } } else { logList.Add("XML Settings document in GetConfig ( ) failed to load."); logList.Add(""); return new String[] { }; } } private DateTime GetPreviousSunday(DateTime inDate) { if (inDate.DayOfWeek == DayOfWeek.Sunday) { return inDate.Date; } else { DateTime newDate = inDate.AddDays(-1); DateTime sundayDate = GetPreviousSunday(newDate); return sundayDate; } } private ArrayList MergeWageFiles(SortedDictionary<string, string> week1Dict, SortedDictionary<string, string> week2Dict, string endDate) { ArrayList outList = new ArrayList();
4.
outList.Clear(); string basestring =
" {0}XTWSCR {1} {2}{3}{4}{5}{6} "; SortedDictionary<string, string> enumDict; if (week1Dict == null) { enumDict = week2Dict; } else { enumDict = week1Dict; } foreach (KeyValuePair<string, string> kvp in enumDict) { List<string> lx = new List<string>(7); string keyHash = kvp.Key; string week1Hash; string week2Hash; if (week1Dict != null) { week1Hash = kvp.Value; if (week2Dict.ContainsKey(keyHash)) { week2Hash = week2Dict[keyHash]; } else { week2Hash = ",,"; } } else { week2Hash = kvp.Value; week1Hash = ",,"; } ArrayList keyList = SplitHashWeekKey(keyHash); ArrayList val2List = SplitHashWeekValue(week2Hash); ArrayList val1List = SplitHashWeekValue(week1Hash); lx.Add((string)keyList[0]); lx.Add((string)keyList[1]); bool isEndDateNull = true; bool isTip1Null = true; bool isTip2Null = true;
5.
bool isWage1Null =
true; bool isWage2Null = true; if (!string.IsNullOrEmpty(endDate)) { lx.Add(endDate); isEndDateNull = false; } else { lx.Add("Date Error"); } if (val1List[1] != null & !string.IsNullOrEmpty((string)val1List[1])) //Tip 1 { lx.Add(CheckTaxWageValueFormat((string)val1List[1], 5)); isTip1Null = false; } else { lx.Add("00.00"); } if (val1List[2] != null & !string.IsNullOrEmpty((string)val1List[2])) //Wage 1 { lx.Add(CheckTaxWageValueFormat((string)val1List[2], 5)); isWage1Null = false; } else { lx.Add("00.00"); } if (val2List[1] != null & !string.IsNullOrEmpty((string)val2List[1])) //Tip 2 { lx.Add(CheckTaxWageValueFormat((string)val2List[1], 5)); isTip2Null = false; } else { lx.Add("00.00"); } if (val2List[2] != null & !string.IsNullOrEmpty((string)val2List[2])) //Wage 2 { lx.Add(CheckTaxWageValueFormat((string)val2List[2], 5)); isWage2Null = false;
6.
} else { lx.Add("00.00"); } string concat =
""; concat = string.Format(basestring, lx[0], lx[1], lx[2], lx[3], lx[5], lx[4], lx[6]); outList.Add(concat); if (isEndDateNull == true | isTip1Null == true | isTip2Null == true | isWage1Null == true | isWage2Null == true) { logList.Add(""); logList.Add("Null Data: "); logList.Add(" Organization: " + (string)keyList[0]); logList.Add(" EmployeeId : " + (string)keyList[1]); if (isTip1Null == true) { logList.Add(" Week 1 Tip : NULL"); } if (isTip2Null == true) { logList.Add(" Week 2 Tip : NULL"); } if (isWage1Null == true) { logList.Add(" Week 1 Wage : NULL"); } if (isWage2Null == true) { logList.Add(" Week 2 Wage : NULL"); } logList.Add(""); } lx.Clear(); } return outList; } private bool PrepareWageFiles(String inPath, String outPath, String fileWeek1, String fileWeek2) { bool isSuccess = false; DateTime week2Date = GetPreviousSunday(DateTime.Now);
7.
DateTime week1Date =
week2Date.AddDays(-7); logList.Add("Current Date: " + DateTime.Now.ToString()); logList.Add(""); logList.Add(""); string dateFormatString = "{0:MM-dd-yyyy}"; string currentDate = string.Format(dateFormatString, DateTime.Now); DirectoryInfo diSource = new DirectoryInfo(inPath); inPath = diSource.FullName; try { ArrayList concatList1; ArrayList concatList2; if (diSource.Exists) { logList.Add("Input / Output Path : " + diSource.FullName); logList.Add("Input / Output Path Exists: TRUE"); logList.Add(""); logList.Add(""); logList.Add("Week 1 Input File Name: " + fileWeek1); logList.Add("Week 2 Input File Name: " + fileWeek2); logList.Add(""); logList.Add(""); FileInfo[] fis1 = diSource.GetFiles(fileWeek1); FileInfo[] fis2 = diSource.GetFiles(fileWeek2); if (fis1.Length < 1) { if (fis2.Length < 1) { logList.Add("Week 1 and Week 2 wage files (" + fileWeek1 + " and " + fileWeek2 + ") are missing."); logList.Add(""); } else { logList.Add("Week 1 wage file (" + fileWeek1 + ") is missing."); logList.Add(""); } } else if (fis2.Length < 1) { logList.Add("Week 2 wage file (" + fileWeek2 + ") is missing."); logList.Add(""); }
8.
else if (fis1.Length
> 1 | fis2.Length > 1) { logList.Add("Multiple wage files present in folder: " + inPath); logList.Add(""); } else { string week1EndDate = string.Format(dateFormatString, week1Date); string week2EndDate = string.Format(dateFormatString, week2Date); logList.Add("End Week 1 Date: " + week1EndDate); logList.Add("End Week 2 Date: " + week2EndDate); logList.Add(""); SortedDictionary<string, string> week1SD = ReadWeek(fis1[0], week1Date); SortedDictionary<string, string> week2SD = ReadWeek(fis2[0], week2Date); concatList1 = MergeWageFiles(week1SD, week2SD, week2EndDate); foreach (string keyString in week1SD.Keys) { if (week2SD.ContainsKey(keyString)) { week2SD.Remove(keyString); } } concatList2 = MergeWageFiles(null, week2SD, week2EndDate); string filename = outPath + "tip_wage_summary_" + currentDate + ".txt"; using (StreamWriter sw = File.CreateText(filename)) { foreach (string entryString in concatList1) { sw.WriteLine(entryString); } foreach (string entryString in concatList2) { sw.WriteLine(entryString); } } logList.Add(""); logList.Add("Output Summary File: " + filename); } isSuccess = true; } else {
9.
isSuccess = false; } } catch
(Exception ex) { logList.Add(""); logList.Add("--------------------------------------------------"); logList.Add(""); logList.Add("Exception from outer Try / Catch: "); logList.Add(" Exception Message: " + ex.Message); logList.Add(" Exception Data: " + ex.Data); logList.Add(" Exception HelpLink: " + ex.HelpLink); logList.Add(" Exception Inner Exception: " + ex.InnerException); logList.Add(" Exception Source: " + ex.Source); logList.Add(" Exception StackTrace: " + ex.StackTrace); logList.Add(" Exception TargetSite: " + ex.TargetSite); logList.Add(""); isSuccess = false; Console.WriteLine("Error: " + ex.Message); Console.Read(); } try { string logname = outPath + "tip_wage_LogFile_" + currentDate + ".txt"; logList.Add("Output Log File : " + logname); logList.Add(""); using (StreamWriter sw = File.CreateText(logname)) { foreach (string entryString in logList) { sw.WriteLine(entryString); } } isSuccess = true; } catch (Exception ex) { logList.Add(""); logList.Add("--------------------------------------------------"); logList.Add("");
10.
logList.Add("Exception from LogFIle
StreamWriter Try / Catch: "); logList.Add(" Exception Message: " + ex.Message); logList.Add(" Exception Data: " + ex.Data); logList.Add(" Exception HelpLink: " + ex.HelpLink); logList.Add(" Exception Inner Exception: " + ex.InnerException); logList.Add(" Exception Source: " + ex.Source); logList.Add(" Exception StackTrace: " + ex.StackTrace); logList.Add(" Exception TargetSite: " + ex.TargetSite); logList.Add(""); isSuccess = false; Console.WriteLine("Error: " + ex.Message); Console.Read(); } return isSuccess; } private DateTime ReadDateDSV(string hashValue) { string[] dashString = new string[] { "-" }; string[] dashSplit = hashValue.Split(dashString, StringSplitOptions.None); DateTime currentDate; try { currentDate = Convert.ToDateTime(dashSplit[1] + "/" + dashSplit[2] + "/" + dashSplit[0]); } catch (Exception) { currentDate = new DateTime(1900, 01, 01); logList.Add("Null date found in record. Check data!"); logList.Add(" : "); } return currentDate.Date; } private SortedDictionary<string, string> ReadWeek(FileInfo files, DateTime weekDate) { SortedDictionary<string, string> employeeRecord = new SortedDictionary<string, string>(); employeeRecord.Clear(); int skipRecord = 0; StreamReader reads = new StreamReader(files.FullName);
11.
while (reads.Peek() >=
0) { string lineString = reads.ReadLine(); if (skipRecord > 0) { string[] splitter = new string[] { "," }; string[] splitLine = lineString.Split(splitter, StringSplitOptions.None); DateTime inDate = ReadDateDSV(splitLine[3]); string dateFormatString = "{0:MM-dd-yyyy}"; string dateString = string.Format(dateFormatString, weekDate); string inKey = (string)splitLine[0] + "," + (string)splitLine[2]; string tipsString = CheckTaxWageValueFormat((string)splitLine[4], 5); string wageString = CheckTaxWageValueFormat((string)splitLine[5], 5); SortedDictionary<string, string>.KeyCollection keyCollx = employeeRecord.Keys; bool IsKeyInList = false; foreach (string keyString in keyCollx) { if (keyString == inKey) { IsKeyInList = true; } } if (IsKeyInList) { employeeRecord[inKey] = splitLine[3] + ",ERROR,ERROR"; logList.Add(""); logList.Add("Error: File contains more than one record for the Key for the week date."); logList.Add(" Week Date : " + dateString); logList.Add(" Key : " + inKey); logList.Add(" Record 1 Data: " + (string)employeeRecord[inKey]); logList.Add(" Record 2 Data: " + splitLine[3] + "," + tipsString + "," + wageString); logList.Add(""); } else { employeeRecord.Add(inKey, (string)splitLine[3] + "," + tipsString + "," + wageString); } Array.Clear(splitter, 0, splitter.Length); Array.Clear(splitLine, 0, splitLine.Length); } lineString = ""; skipRecord++;
12.
} reads.Close(); return employeeRecord; } private ArrayList
SplitHashWeekKey(string keyHash) { string[] splitter = new string[] { "," }; string[] splitLine = keyHash.Split(splitter, StringSplitOptions.None); ArrayList fieldList = new ArrayList(); fieldList.Clear(); fieldList.Add(splitLine[0]); fieldList.Add(splitLine[1]); Array.Clear(splitter, 0, splitter.Length); Array.Clear(splitLine, 0, splitLine.Length); return fieldList; } private ArrayList SplitHashWeekValue(string valueHash) { string[] splitter = new string[] { "," }; string[] splitLine = valueHash.Split(splitter, StringSplitOptions.None); ArrayList fieldList = new ArrayList(); fieldList.Clear(); for (int i = 0; i < splitLine.Length; i++) { fieldList.Add(splitLine[i]); } Array.Clear(splitter, 0, splitter.Length); Array.Clear(splitLine, 0, splitLine.Length); return fieldList; } } }
Jetzt herunterladen