示例#1
0
        private static void ExecuteJRN(string filename, string machineCode)
        {
            try
            {
                Console.WriteLine("Start read file :" + filename);
                using (TransactionScope scope = new TransactionScope())
                {
                    string DataLogID     = string.Empty;
                    var    listTransInfo = ReadFileATM.ReadFileJRN(filename);

                    DataLogController.FinalReadFile(Constants.FileData_JRN, Path.GetFileNameWithoutExtension(filename).Substring(Path.GetFileNameWithoutExtension(filename).Length - 8, 8), machineCode + Path.GetFileName(filename), out DataLogID);
                    if (!string.IsNullOrEmpty(DataLogID))
                    {
                        ReadFileATMController.ReadFileJRN(listTransInfo, machineCode, DataLogID);
                        scope.Complete();
                        Console.WriteLine("End read file Success:" + filename);
                        BackUpFile(filename, machineCode, Constants.READFILE_SUCCESS);
                    }
                }
            }
            catch (TransactionAbortedException ex)
            {
                BackUpFile(filename, machineCode, Constants.READFILE_FAIL);
                ErrorUtils.WriteLog("ReadFileJDATA : TransactionAbortedException File: " + filename + " MsgErr:" + ex.Message);
                //throw ex;
            }
            catch (Exception ex)
            {
                BackUpFile(filename, machineCode, Constants.READFILE_FAIL);
                Console.WriteLine(filename + "-" + ex.Message);
                ErrorUtils.WriteLog(filename + "-" + ex.Message);
            }
        }
示例#2
0
 private static void ExecuteReadFileJDATA(string filename, string machineCode)
 {
     try
     {
         Console.WriteLine("Start read file :" + filename);
         var listTransInfo = ReadFileATM.ReadFileEJDATA(filename);
         if (listTransInfo.Count > 0)
         {
             using (TransactionScope scope = new TransactionScope())
             {
                 string trandate  = listTransInfo[0].CARD_INSERTED.Substring(0, 8);
                 string DataLogID = string.Empty;
                 DataLogController.FinalReadFile(Constants.FileData_LOG, DateTime.Parse(trandate).ToString("ddMMyyyy"), machineCode + Path.GetFileName(filename), out DataLogID);
                 if (!string.IsNullOrEmpty(DataLogID))
                 {
                     ReadFileATMController.ReadFileEJDATA(listTransInfo, machineCode, DataLogID);
                     scope.Complete();
                     Console.WriteLine("End read file Success:" + filename);
                     BackUpFile(filename, machineCode, Constants.READFILE_SUCCESS);
                 }
             }
         }
         else
         {
             BackUpFile(filename, machineCode, Constants.READFILE_FAIL);
         }
     }
     catch (TransactionAbortedException ex)
     {
         BackUpFile(filename, machineCode, Constants.READFILE_FAIL);
         ErrorUtils.WriteLog("ReadFileJDATA : TransactionAbortedException File: " + filename + " MsgErr:" + ex.Message);
         //throw ex;
     }
     catch (Exception ex)
     {
         BackUpFile(filename, machineCode, Constants.READFILE_FAIL);
         Console.WriteLine(filename + "-" + ex.Message);
         ErrorUtils.WriteLog(filename + "-" + ex.Message);
     }
 }