Beispiel #1
0
 public static void printDoc_PrintPage(Object sender, PrintPageEventArgs e)
 {
     try
     {
         if (IPayBox.FRS.RemoteFR && !IPayBox.IncassCheck)
         {
             PrintString = remoteFR.RemoteFiscalRegister.tryFormFicsalCheck(
                 IPayBox.Terminal.jur_name.Trim(),
                 IPayBox.FRS.headertext,
                 PrintString,
                 "Сотовая св.",
                 IPayBox.Terminal.terminal_id.Trim(),
                 IPayBox.Terminal.terminal_pass,
                 IPayBox.curPay.txn_id,
                 IPayBox.curPay.from_amount.ToString(),
                 "1",
                 IPayBox.FRS.RemoteFiscalRegisterURL,
                 IPayBox.FRS.checkWidth,
                 IPayBox.FRS.remoteFRtimeout);
         }
     }
     catch (Exception ex)
     {
         IPayBox.AddToLog(Logs.Main, ex.Message);
     }
 }
Beispiel #2
0
        //Определение параметров порта и попытка открытия порта модема
        private static bool OpenPort(string portName, int writeTimeOut, int readTimeOut, int baudRate,
                                     Parity parity, int dataBits, StopBits stopBits, Handshake handshake, bool dtrEnable, bool rtsEnable,
                                     string newLine)
        {
            //Попытка инициализировать порт
            try
            {
                port.PortName     = portName;
                port.WriteTimeout = 500;
                port.ReadTimeout  = 500;
                port.BaudRate     = 115200;
                port.Parity       = System.IO.Ports.Parity.None;
                port.DataBits     = 8;
                port.StopBits     = System.IO.Ports.StopBits.One;
                port.Handshake    = System.IO.Ports.Handshake.RequestToSend;
                port.DtrEnable    = true;
                port.RtsEnable    = true;
                port.NewLine      = System.Environment.NewLine;
            }
            catch (Exception ex)
            {
                IPayBox.AddToLog(IPayBox.Logs.Main, ex.Message);
                return(false);
            }

            //Попытка открытия порта
            try
            {
                port.Open();
            }
            catch
            {
                return(false);
            }

            //Попытка записи в порт
            try
            {
                port.WriteLine("AT");
                System.Threading.Thread.Sleep(100);
                string portans = port.ReadExisting().Trim();

                if (portans.IndexOf("OK") == -1)
                {
                    port.Close();
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                IPayBox.AddToLog(IPayBox.Logs.Main, ex.Message);
                port.Close();
                return(false);
            }
        }
Beispiel #3
0
 public static void InitiateSSLTrust()
 {
     try
     {
         ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return(true); });
     }
     catch (Exception ex)
     {
         IPayBox.AddToLog(IPayBox.Logs.Main, "Не удалось инциализировать SSL: " + ex.Message);
     }
 }
Beispiel #4
0
 private void dialer_StateChanged(object obj, StateChangedEventArgs args)
 {
     if (IPayBox.Debug)
     {
         IPayBox.AddToLog(IPayBox.Logs.Main, "Модем State: " + args.State.ToString() + " Message:" + args.ErrorMessage);
     }
     if (args.State == RasConnectionState.Connected)
     {
         Connected = true;
     }
     else
     {
         Connected = false;
     }
 }
Beispiel #5
0
 private static void ClosePort()
 {
     try
     {
         if (port.IsOpen)
         {
             IPayBox.AddToLog(IPayBox.Logs.Main, "Закрытие порта " + port.PortName);
             port.Close();
         }
     }
     catch (Exception ex)
     {
         IPayBox.AddToLog(IPayBox.Logs.Main, "БАХ2!");
         throw ex;
     }
 }
Beispiel #6
0
        private void dialer_DialCompleted(object obj, DialCompletedEventArgs args)
        {
            Connected = args.Connected;

            if (IPayBox.Debug)
            {
                if (Connected)
                {
                    IPayBox.AddToLog(IPayBox.Logs.Main, "Соединение установлено.");
                }
                else
                {
                    IPayBox.AddToLog(IPayBox.Logs.Main, "Соединение НЕ установлено.");
                }
            }
        }
Beispiel #7
0
        private void CheckExistProcess()
        {
            try
            {
                System.Diagnostics.Process[] n = System.Diagnostics.Process.GetProcessesByName("zeus");

                for (int i = 0; i < n.Length - 1; i++)
                {
                    n[i].Kill();
                    n[i].WaitForExit();
                }
            }
            catch (Exception ex)
            {
                IPayBox.AddToLog(IPayBox.Logs.Main, "Не удалось завершить процесс zeus: " + ex.Message);
            }
        }
Beispiel #8
0
        public modem()
        {
            try
            {
                dialer    = new RasDialer();
                phonebook = new RasPhoneBook();

                dialer.DialCompleted += new EventHandler <DialCompletedEventArgs>(dialer_DialCompleted);
                dialer.StateChanged  += new EventHandler <StateChangedEventArgs>(dialer_StateChanged);
                phonebook.Open();

                Entry = new string[phonebook.Entries.Count];

                for (int i = 0; i < phonebook.Entries.Count; i++)
                {
                    Entry[i] = phonebook.Entries[i].Name;
                }
            }
            catch (Exception ex)
            {
                IPayBox.AddToLog(IPayBox.Logs.Main, "Не удалось инициализировать класс работы с GPRS;" + ex.Message);
            }
        }
Beispiel #9
0
 public void Connect(string entry)
 {
     try
     {
         if (!IsConnected(entry))
         {
             if (IPayBox.Debug)
             {
                 IPayBox.AddToLog(IPayBox.Logs.Main, "Попытка соединения через " + entry);
             }
             dialer.PhoneBookPath = phonebook.Path;
             dialer.EntryName     = entry;
             dialer.DialAsync();
         }
     }
     catch (Exception ex)
     {
         if (IPayBox.Debug)
         {
             IPayBox.AddToLog(IPayBox.Logs.Main, "Соединение НЕ установлено: " + ex.Message);
         }
         Connected = false;
     }
 }
Beispiel #10
0
        public static bool SendSMS(string cellNumber)
        {
            bool res = false;

            cellNumber = cellNumber.Replace("+", "");

            try
            {
                //Разорвать соединение
                IPayBox.Devices.Modem.Disconnect(IPayBox.Settings.NetModemName);
            }
            catch { }

            try
            {
                OpenPort(IPayBox.Settings.modemPort, 500, 500, 115200, Parity.None, 8, StopBits.One, Handshake.RequestToSend, true, true, Environment.NewLine);

                if (port != null)
                {
                    if (port.IsOpen)
                    {
                        try
                        {
                            string s = string.Empty;

                            List <SMS.SMS.CompositeSMS> CS = SMS.SMS.FormSMS(cellNumber, "ЗЕВС. IMSI=" + IPayBox.Info.IMSI);

                            for (int i = 0; i < CS.Count; i++)
                            {
                                s = port.ReadExisting();
                                s = string.Empty;

                                //1. Подготовка к отправке
                                port.Write("AT+CMGS=" + Convert.ToString(CS[i].TPDULength) + "\r");
                                //port.WriteLine("AT+CMGS=" + Convert.ToString(CS[i].TPDULength));
                                //2. Задержка, чтобы модем успел переварить то, что ему скормили
                                System.Threading.Thread.Sleep(500);
                                s = port.ReadExisting().Trim();

                                //3. Ну и, собственно, само уже сформированное сообщение
                                s = string.Empty;
                                port.Write(CS[i].FullPDUString + (char)(26));
                                System.Threading.Thread.Sleep(1000);

                                int j = 0;

                                while (s == string.Empty && j < 3)
                                {
                                    s = port.ReadExisting().Trim();
                                    System.Threading.Thread.Sleep(1500);
                                    j++;
                                }

                                if (s.IndexOf("ERROR") != -1 || s == string.Empty)
                                {
                                    IPayBox.AddToLog(IPayBox.Logs.Main, "\r\nНе удалось отправить СМС \r\nна номер:" + cellNumber + "\r\n" + res);
                                    return(false);
                                }
                            }

                            IPayBox.AddToLog(IPayBox.Logs.Main, "\r\nОтправлено СМС на номер: " + cellNumber + "\r\n" + res);
                            return(true);
                        }
                        catch (Exception ex)
                        {
                            IPayBox.AddToLog(IPayBox.Logs.Main, ex.Message);
                            return(false);
                        }
                        finally
                        {
                            port.Close();
                            port.Dispose();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                IPayBox.AddToLog(IPayBox.Logs.Main, ex.Message);
                return(false);
            }

            return(res);
        }
Beispiel #11
0
        public static void Init()
        {
            string res;

            string[] ComPorts = SerialPort.GetPortNames();

            for (int i = 0; i < ComPorts.Length; i++)
            {
                try
                {
                    //Разорвать соединение
                    IPayBox.Devices.Modem.Disconnect(IPayBox.Settings.NetModemName);
                }
                catch { }

                try
                {
                    if (OpenPort(ComPorts[i], 500, 500, 115200, Parity.None, 8, StopBits.One, Handshake.RequestToSend, true, true, Environment.NewLine))
                    {
                        if (port.IsOpen)
                        {
                            IPayBox.AddToLog(IPayBox.Logs.Main, "Модем подключен к порту " + port.PortName);
                            IPayBox.Settings.modemPort = ComPorts[i];

                            try
                            {
                                //Определение оператора связи
                                port.WriteLine("AT+COPS?");
                                IPayBox.AddToLog(IPayBox.Logs.Main, "Команда " + "AT+COPS?");
                                System.Threading.Thread.Sleep(500);
                                res = port.ReadExisting().Trim();
                                IPayBox.AddToLog(IPayBox.Logs.Main, "Ответ " + res.Trim());

                                Match m = Regex.Match(res, "\"(?<val>.*?)\"");

                                if (m.Success)
                                {
                                    IPayBox.Info.OpsosName = m.Groups["val"].ToString().Trim();
                                }

                                //Определение IMSI
                                port.WriteLine("AT+CIMI");
                                IPayBox.AddToLog(IPayBox.Logs.Main, "Команда " + "AT+CIMI");
                                System.Threading.Thread.Sleep(1000);
                                res = port.ReadExisting().Trim();
                                IPayBox.AddToLog(IPayBox.Logs.Main, "Ответ " + res.Trim());

                                if (res.Trim().IndexOf("ERROR") == -1)
                                {
                                    m = Regex.Match(res, "[0-9]+", RegexOptions.Singleline);

                                    if (m.Success)
                                    {
                                        IPayBox.Info.IMSI = m.Groups[0].ToString().Trim();
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                IPayBox.AddToLog(IPayBox.Logs.Main, ex.Message);
                            }
                            finally
                            {
                                port.Close();
                                port.Dispose();
                            }

                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    IPayBox.AddToLog(IPayBox.Logs.Main, ex.Message);
                }
            }
        }
Beispiel #12
0
        private void main_Load(object sender, EventArgs e)
        {
            flush.Show();
            Application.DoEvents();

            FileInfo updaterFI = new FileInfo(IPayBox.Settings.StartupPath + "\\updater.exe.update");

            if (updaterFI.Exists)
            {
                try
                {
                    Remove(IPayBox.Settings.StartupPath + "\\updater.exe.update", IPayBox.Settings.StartupPath + "\\updater.exe");
                }
                catch (Exception ex)
                {
                    IPayBox.AddToLog(IPayBox.Logs.Main, "Не удалось переименовать файл updater.exe.update: " + ex.Message);
                }
            }

            try
            {
                FileInfo fi = new FileInfo(IPayBox.Settings.StartupPath + @"\debug");
                IPayBox.Debug = fi.Exists;
                InitiateSSLTrust();
                LoadUrl();
                _cursor.Hide();

                if (!IPayBox.Debug)
                {
                    IPayBox.HideExplorer();
                }
            }
            catch (Exception ex)
            {
                IPayBox.AddToLog(IPayBox.Logs.Main, ex.Message);
            }

            string[] args = Environment.CommandLine.Split(' ');

            if (args.Length > 0)
            {
                foreach (string row in args)
                {
                    if (row.ToLower() == "prtwin" || row.ToLower() == "prnwin")
                    {
                        IPayBox.Settings.Args = "prtwin";
                    }
                    if (row.ToLower() == "atol" || row.ToLower() == "atol")
                    {
                        IPayBox.Settings.AtolDriver = true;
                        IPayBox.Settings.Args       = "atol";
                    }
                    if (row.ToLower() == "prim21k")
                    {
                        IPayBox.Settings.Args = "prim21k";
                    }
                }
            }

            IPayBox.Settings.UpdateUrlIndex  = 0;
            IPayBox.Settings.ServiceUrlIndex = 0;

            IPayBox.Settings.Resolution = new Size(1280, 1024);
            IPayBox.Settings.Inches     = 17;

            /*
             * if (Screen.PrimaryScreen.Bounds.Width == 1280 && Screen.PrimaryScreen.Bounds.Height == 1024)
             * {
             *  Ipaybox.Resolution = new Size(1280, 1024);
             *  Ipaybox.Inches = 17;
             * }
             * else
             * {
             *  //if (Screen.PrimaryScreen.Bounds.Width == 1024 && Screen.PrimaryScreen.Bounds.Height == 768)
             *  //{
             *      Ipaybox.Resolution = new Size(1024, 768);
             *      Ipaybox.Inches = 15;
             * // }
             * }*/


            try
            {
                IPayBox.Settings.RequestTimeout = float.Parse("0,5");
                System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.RealTime;
            }
            catch (Exception ex)
            {
                IPayBox.AddToLog(IPayBox.Logs.Main, ex.Message);
            }

            CheckExistProcess();

            IPayBox.AddToLog(IPayBox.Logs.Main, "Старт приложения. Инициализация.");
            IPayBox.Info.CoreVersion = Application.ProductVersion;
            IPayBox.AddToLog(IPayBox.Logs.Main, "Версия ПО:" + IPayBox.Info.CoreVersion);

            pays_send_timer.Enabled = false;
            conf_update.Enabled     = false;
            link_timer.Enabled      = false;
            print_timer.Enabled     = false;

            // Инициализируем приложение
            try
            {
                InitializeIpaybox();
            }
            catch
            {
                IPayBox.State.Working = false;
                IPayBox.State.NeedToUpdateConfiguration = true;
                IPayBox.State.NeedUpdateCore            = true;
            }

            pays_send_timer.Enabled = true;
            conf_update.Enabled     = true;
            link_timer.Enabled      = true;
            print_timer.Enabled     = true;

            this.BackColor = Color.FromArgb(230, 230, 230);

            ((Label)flush.Controls["label1"]).Text = "Проверка модема...";
            Application.DoEvents();

            if (IPayBox.Settings.NetOption == 1)
            {
                try
                {
                    _Modem.Init();
                }
                catch (Exception ex)
                {
                    IPayBox.AddToLog(IPayBox.Logs.Main, ex.Message);
                }
            }

            if (IPayBox.State.IsBlocked)
            {
                IPayBox.State.Working = false;
            }

            try
            {
                ((Label)flush.Controls["label1"]).Text = "Старт приложения...";
                Application.DoEvents();
                flush.Dispose();
                flush = null;
            }
            catch (Exception ex)
            {
                IPayBox.AddToLog(IPayBox.Logs.Main, ex.Message);
            }

            // Запускаем процесс
            Main_Process();
        }
Beispiel #13
0
        private void InitializeIpaybox()
        {
            ((Label)flush.Controls["label1"]).Text = "Инициализация оборудования...";
            Application.DoEvents();
            Sound.Initialize();
            IPayBox.State.Working = true;
            IPayBox.Forms.Count   = 0;
            IPayBox.Forms.Index   = 0;
            IPayBox.StartForm     = this;

            #region Printer
            string[] ComPorts = System.IO.Ports.SerialPort.GetPortNames();
            string   descr    = "";

            foreach (string s in ComPorts)
            {
                descr += s + " ";
            }

            IPayBox.AddToLog(IPayBox.Logs.Main, "Доступные COM порты: " + descr);

            try
            {
                ((Label)flush.Controls["PrinterInfoLabel"]).Text = "Поиск принтера...";
                Application.DoEvents();

                if (!IPayBox.Settings.AtolDriver)
                {
                    if (!IPayBox.Settings.WindowsPrinter)
                    {
                        if (IPayBox.Devices.Printer == null)
                        {
                            IPayBox.Devices.Printer = new Printers.Printer(IPayBox.Settings.Args);
                            IPayBox.AddToLog(IPayBox.Logs.Main, "Принтер " + IPayBox.Devices.Printer.PrnModel + ", подключен к порту " + IPayBox.Devices.Printer.port);

                            if (IPayBox.Devices.Printer.PrnModel == Printers.Model.NULL)
                            {
                                ((Label)flush.Controls["PrinterInfoLabel"]).Text      = "Принтер не найден";
                                ((Label)flush.Controls["PrinterInfoLabel"]).ForeColor = System.Drawing.Color.Red;
                            }
                            else
                            {
                                ((Label)flush.Controls["PrinterInfoLabel"]).Text = "Найден принтер " + IPayBox.Devices.Printer.PrnModel + ". Порт " + IPayBox.Devices.Printer.port;
                            }

                            Application.DoEvents();
                        }
                    }
                    else
                    {
                        IPayBox.doc = new System.Drawing.Printing.PrintDocument();
                        IPayBox.doc.PrintController = new System.Drawing.Printing.StandardPrintController();
                        IPayBox.doc.PrintPage      += new System.Drawing.Printing.PrintPageEventHandler(IPayBox.printDoc_PrintPage);
                        IPayBox.AddToLog(IPayBox.Logs.Main, "Принтер WINDOWS");
                        ((Label)flush.Controls["PrinterInfoLabel"]).Text = "Принтер WINDOWS";
                        Application.DoEvents();
                    }
                }
                else
                {
                    try
                    {
                        IPayBox.Settings.FiscalRegister = true;
                        IPayBox.Devices.FRegister       = new FR.Atol();

                        IPayBox.Devices.FRegister.FiscalMode = IPayBox.Settings.FiscalMode;

                        IPayBox.AddToLog(IPayBox.Logs.Main, "ККМ " + IPayBox.Devices.FRegister.Model + " найдена на порту " + IPayBox.Devices.FRegister.ComPort);

                        ((Label)flush.Controls["PrinterInfoLabel"]).Text = "Найден ККМ " + IPayBox.Devices.FRegister.Model + ". Порт " + IPayBox.Devices.FRegister.ComPort;
                        Application.DoEvents();
                    }
                    catch (Exception ex)
                    {
                        IPayBox.AddToLog(IPayBox.Logs.Main, "Невозможно инициализировать драйвер АТОЛ.\r\n" + ex.Message);
                        ((Label)flush.Controls["PrinterInfoLabel"]).Text      = "Невозможно инициализировать драйвер АТОЛ";
                        ((Label)flush.Controls["PrinterInfoLabel"]).ForeColor = System.Drawing.Color.Red;
                        Application.DoEvents();

                        if (!IPayBox.Debug)
                        {
                            IPayBox.State.Working = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                IPayBox.AddToLog(IPayBox.Logs.Main, ex.Message);
            }
            #endregion
            #region Acceptor
            try
            {
                ((Label)flush.Controls["AcceptorInfoLabel"]).Text = "Поиск купюроприемника...";
                Application.DoEvents();

                if (IPayBox.Devices.Acceptor == null)
                {
                    IPayBox.Devices.Acceptor = new Acceptors.Acceptor();

                    if (IPayBox.Devices.Acceptor.model == Acceptors.Model.NULL && !IPayBox.Debug)
                    {
                        IPayBox.AddToLog(IPayBox.Logs.Main, "\tНе найден купюрник. Не работаем.");
                        IPayBox.State.Working = false;
                        ((Label)flush.Controls["AcceptorInfoLabel"]).Text      = "Не найден купюроприемник";
                        ((Label)flush.Controls["AcceptorInfoLabel"]).ForeColor = System.Drawing.Color.Red;
                        Application.DoEvents();
                    }
                    else
                    {
                        IPayBox.AddToLog(IPayBox.Logs.Main, "Купюроприемник " + IPayBox.Devices.Acceptor.model + ", подключен к порту ");
                        ((Label)flush.Controls["AcceptorInfoLabel"]).Text = "Купюроприемник " + IPayBox.Devices.Acceptor.model + ", подключен к порту";
                        Application.DoEvents();
                    }
                }
            }
            catch (Exception ex)
            {
                IPayBox.AddToLog(IPayBox.Logs.Main, ex.Message);
            }
            #endregion
            #region WatchDog
            try
            {
                if (IPayBox.Devices.Watchdog == null)
                {
                    IPayBox.Devices.Watchdog = new WD.Watchdog(ComPorts);

                    if (IPayBox.Devices.Watchdog.watch != WD.Watchdog.WD.NULL)
                    {
                        IPayBox.AddToLog(IPayBox.Logs.Main, "Найден WatchDog " + IPayBox.Devices.Watchdog.watch.ToString() + " " + IPayBox.Devices.Watchdog.Version + ", подключен к порту ");
                        ((Label)flush.Controls["WDInfoLabel"]).Text = "Найден WatchDog " + IPayBox.Devices.Watchdog.watch.ToString() + " " + IPayBox.Devices.Watchdog.Version;
                        Application.DoEvents();
                    }
                    else
                    {
                        ((Label)flush.Controls["WDInfoLabel"]).Text      = "WatchDog не найден";
                        ((Label)flush.Controls["WDInfoLabel"]).ForeColor = System.Drawing.Color.Red;
                        Application.DoEvents();
                    }
                }
            }
            catch (Exception ex)
            {
                IPayBox.AddToLog(IPayBox.Logs.Main, ex.Message);
            }
            #endregion

            IPayBox.LoadIncass();

            #region ConfigFiles
            ((Label)flush.Controls["label1"]).Text = "Загрузка конфигурационных файлов...";
            Application.DoEvents();
            IPayBox.AddToLog(IPayBox.Logs.Main, "Загрузка информации о терминале.");
            IPayBox.TerminalInfo = new zeus.HelperClass.TerminalInfo().Load();
            IPayBox.RFRSettings  = new zeus.HelperClass.RFRSettings().Load();
            IPayBox.TPIN         = new zeus.HelperClass.TPIN().Load();

            if (IPayBox.TPIN.Persons == null || IPayBox.TPIN.Persons.Count == 0)
            {
                IPayBox.Settings.MasterPinActive = true;
            }
            else
            {
                IPayBox.Settings.MasterPinActive = false;
            }



            #endregion
        }
Beispiel #14
0
        public static void LoadTerminalData()
        {
            // Устанавливаем параметры d 0
            IPayBox.FlushToMain();

            IPayBox.Terminal.bank          = "";
            IPayBox.Terminal.jur_inn       = "";
            IPayBox.Terminal.jur_name      = "";
            IPayBox.Terminal.jur_adress    = "";
            IPayBox.Terminal.support_phone = "";
            IPayBox.Terminal.terminal_id   = "";
            IPayBox.Terminal.terminal_pass = "";
            IPayBox.Terminal.terms_number  = "";
            IPayBox.Terminal.trm_adress    = "";
            IPayBox.Terminal.Interface     = "";
            IPayBox.Terminal.FiscalMode    = false;
            XmlElement root = Ipaybox.terminal_info.DocumentElement;

            for (int i = 0; i < root.ChildNodes.Count; i++)
            {
                XmlElement row = (XmlElement)root.ChildNodes[i];
                switch (row.Name)
                {
                case "terminal_id":
                    Ipaybox.Terminal.terminal_id = row.InnerText;
                    break;

                case "interface":
                    Ipaybox.Terminal.Interface = row.InnerText;
                    break;

                case "password":
                    Ipaybox.Terminal.terminal_pass = row.InnerText;
                    break;

                case "agent_jur_name":
                    Ipaybox.Terminal.jur_name = row.InnerText;
                    break;

                case "agent_inn":
                    Ipaybox.Terminal.jur_inn = row.InnerText;
                    break;

                case "agent_adress":
                    Ipaybox.Terminal.jur_adress = row.InnerText;
                    break;

                case "bank":
                    Ipaybox.Terminal.bank = row.InnerText;
                    break;

                case "terms_number":
                    Ipaybox.Terminal.terms_number = row.InnerText;
                    break;

                case "terminal_adress":
                    Ipaybox.Terminal.trm_adress = row.InnerText;
                    break;

                case "pin":
                    Ipaybox.Terminal.pincode = row.InnerText;
                    break;

                case "secret_number":
                    Ipaybox.Terminal.secret_number = row.InnerText;
                    break;

                case "agent_support_phone":
                    Ipaybox.Terminal.support_phone = row.InnerText;
                    break;

                case "configuration-id":
                    Ipaybox.Terminal.configuration_id = row.InnerText;
                    break;

                case "fiscal-mode":
                    if (!bool.TryParse(row.InnerText, out Ipaybox.Terminal.FiscalMode))
                    {
                        Ipaybox.Terminal.FiscalMode = false;
                    }
                    break;
                }
            }

            try
            {
                Ipaybox.FRS.RemoteFR   = false;
                Ipaybox.FRS.headertext = "";
                Ipaybox.FRS.checkWidth = 38;
                Ipaybox.FRS.RemoteFiscalRegisterURL = "";
                Ipaybox.FRS.remoteFRtimeout         = 10000;

                XmlNode frsroot = Ipaybox.FRSSettings.DocumentElement.ChildNodes[0];

                for (int i = 0; i < frsroot.ChildNodes.Count; i++)
                {
                    XmlElement row = (XmlElement)frsroot.ChildNodes[i];
                    switch (row.Name)
                    {
                    case "remoteFR":
                        Ipaybox.FRS.RemoteFR = Convert.ToBoolean(row.InnerText);
                        break;

                    case "checkWidth":
                        Ipaybox.FRS.checkWidth = Convert.ToInt32(row.InnerText);
                        break;

                    case "remoteFRtimeout":
                        Ipaybox.FRS.remoteFRtimeout = Convert.ToInt32(row.InnerText);
                        break;

                    case "headertext":
                        Ipaybox.FRS.headertext = row.InnerText;
                        break;

                    case "remoteFRurl":
                        Ipaybox.FRS.RemoteFiscalRegisterURL = row.InnerText;
                        break;
                    }
                }
            }
            catch
            {
                Ipaybox.AddToLog(Logs.Main, "Не удалось применить настройки фискального сервера");
            }
        }