public static GenerateStandardCCBills GetInstance() { lock (_lock) { if (_generateStandardCCBillsInstance == null) { _generateStandardCCBillsInstance = new GenerateStandardCCBills(); } return(_generateStandardCCBillsInstance); } }
/// <summary> /// Method to get bank name from user /// </summary> /// <param name="userInput">input provided by user</param> public void GetBankNameFromUser(string userInput) { bool inputProvided = Utility.CheckUserInput(userInput); if (inputProvided) { string bkName = userInput.Trim().ToLower(); string getDirectoryPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\InputBills\"; string[] inputFiles = Utility.GetAllCsvFiles(getDirectoryPath); var bankStatementExists = Utility.CheckInputStatmentExists(inputFiles, bkName); if (bankStatementExists.Item1) { Stopwatch sw = Stopwatch.StartNew(); string inputStatmentPath = bankStatementExists.Item2; string stdStatementPath = CreateOutputStatementPath(inputStatmentPath); //Check if output file is already opened, if exists. if (File.Exists(stdStatementPath)) { FileInfo fi = new FileInfo(stdStatementPath); bool fileOpened = Utility.IsFileOpened(fi); } IStandardizeBill genStandardizeStatement = GenerateStandardCCBills.GetInstance(); genStandardizeStatement.StandardizeStatement(inputStatmentPath, stdStatementPath); sw.Stop(); Console.WriteLine("Time taken by app to complete the process: " + sw.ElapsedMilliseconds + " msec."); Console.ReadLine(); } else { Console.WriteLine("No Statement present or incorrect bankname provided. Please enter another bankname and press any key to continue."); UserInputBankName(); } } else { Console.WriteLine("No bank name provided, please enter again."); Console.WriteLine("Please enter your bank name like Axis, HDFC, ICICI, etc and press any key to continue."); UserInputBankName(); } }