public static void Main(string[] args) { int RecordCount = 0; int RecordSuccess = 0; int RecordError = 0; string fileNameSuffix; if (args.Length > 0) { fileNameSuffix = args[0]; } else { fileNameSuffix = "Just26"; } DeleteFile("Maindata.txt"); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string FileName = "RawData" + fileNameSuffix + ".csv"; SharedClassLibrary.UserInterface UI = new UserInterface(); SharedClassLibrary.RawData RD = new RawData(UI, FileName); SharedClassLibrary.MainData MD = new MainData(UI); UI.WriteToLog("\n***************Setup App Start***************\n"); while (RD.ReadOneCountry() != true) { if (MD.StoreOneCountry(RD)) { RecordSuccess++; } else { RecordError++; } RecordCount++; } UI.WriteToLog(string.Format("Setup complete: {0} Total records processed ({1} Successes and {2} Errors) ", RecordCount, RecordSuccess, RecordError)); UI.WriteToLog("\n***************Setup App END***************\n"); MD.FinishUp(); RD.FinishUp(); UI.FinishUp(true, false); }
public static void Main(string[] args) { Console.WriteLine("OK, starting UserApp"); // Detect whether this program is being run by AutoTesterUtility, // or manually by developer & fix fileNameSuffix accordingly. // <WRITE APPROPRIATE CODE HERE> // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int CommandCount = 0; string transFileSuffix = ""; string transFileName = "TransData"; string command = ""; if (args.Length > 0) { transFileSuffix = args[0]; } else { transFileSuffix = ""; } transFileName += transFileSuffix + ".txt"; SharedClassLibrary.UserInterface UI = new UserInterface(true, true, transFileName); SharedClassLibrary.MainData MD = new MainData(UI); UI.WriteToLog("\n***************User App Start***************\n"); while (UI.GetOneTransdata(out command) == false) { UI.WriteToLog(command); switch (command.Substring(0, 2)) { case "QI": MD.QueryByID(QueryData(command)); break; case "LI": MD.ListById(); break; case "IN": MD.InsertRecord(QueryData(command)); break; case "DI": MD.DeleteRecordByID(QueryData(command)); break; default: Console.WriteLine("No Valid Command found"); break; } CommandCount++; } MD.FinishUp(); UI.WriteToLog(string.Format("UserApp completed: {0} transactions handled", CommandCount)); UI.WriteToLog("\n***************User App END***************\n"); UI.FinishUp(true, true); }