Ejemplo n.º 1
0
        internal static void UpdateMerchantTerminalId(string terminalId)
        {
            string[] lineData;
            string[] terminalIdEnd = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
            lineData = FileRepo.getFileData(FileRepo.Merchants);
            int linePadding = 63;

            terminalId = (terminalId + new string(' ', 8)).Substring(0, 8);
            for (int i = 0; i < lineData.Count(); i++)
            {
                if (i + 1 == lineData.Count() || i >= 23)
                {
                    terminalId = terminalId.Substring(0, 5) + "X";
                }
                else
                {
                    terminalId = terminalId.Substring(0, 5) + terminalIdEnd[i];
                }
                terminalId = (terminalId + new string(' ', 8)).Substring(0, 8);
                if (!string.IsNullOrEmpty(lineData[i]) && lineData[i].Length > 8)
                {
                    lineData[i] = (terminalId + lineData[i].Substring(8) + new string(' ', linePadding)).Substring(0,
                                                                                                                   linePadding);
                }
            }
            FileRepo.setFileData(FileRepo.Merchants, lineData);
            UpdateProviderTerminalId();
        }
Ejemplo n.º 2
0
        internal static void UpdateProviderTerminalId()
        {
            string[] lineData = FileRepo.getFileData(FileRepo.Providers);
            Dictionary <string, string> TerminalMerchantList = getTerminalMerchantList();
            int linePadding = 58;

            for (int i = 0; i < lineData.Count(); i++)
            {
                string terminalId = lineData[i].Substring(0, 6);
                string merchantId = lineData[i].Substring(8, 8);
                if (TerminalMerchantList.ContainsValue(merchantId))
                {
                    terminalId = (from p in TerminalMerchantList
                                  where p.Value == merchantId
                                  select p.Key).FirstOrDefault();
                }
                else
                {
                    terminalId = TerminalMerchantList.ElementAt(0).Key;
                    merchantId = TerminalMerchantList.ElementAt(0).Value;
                }
                lineData[i] = ((terminalId + new string(' ', 8)).Substring(0, 8) +
                               (merchantId + new string(' ', 8)).Substring(0, 8) +
                               lineData[i].Substring(16) + new string(' ', linePadding)).Substring(0, linePadding);
            }
            //TODO
            FileRepo.setFileData(FileRepo.Providers, lineData);

            return;
        }