コード例 #1
0
ファイル: info.cs プロジェクト: ykcycvl/Zeus2013
 private void ExitForm()
 {
     Ipaybox.FlushToMain();
     try
     {
         Ipaybox.StartForm.Main_Process();
     }
     catch { }
     this.Dispose();
 }
コード例 #2
0
        private FileCheckError ValidateLocalFile(string file, string length, string crc)
        {
            FileInfo fi = null;

            try
            {
                if (file.IndexOf(Ipaybox.StartupPath) == -1)
                {
                    fi = new FileInfo(Ipaybox.StartupPath + "\\" + file.TrimStart(new char[] { '\\' }));
                }
                else
                {
                    fi = new FileInfo(file);
                }
            }
            catch (Exception ex)
            {
                Ipaybox.AddToLog(Ipaybox.Logs.Update, "\t\t Проверка " + file + " " + ex.ToString());
                return(FileCheckError.UPDATE);
            }

            if (!fi.Exists)
            {
                return(FileCheckError.UPDATE);
            }

            crc32 = new CRC32();
            String crclocal = String.Empty;

            using (FileStream fs = fi.OpenRead()) //here you pass the file name
            {
                foreach (byte b in crc32.ComputeHash(fs))
                {
                    crclocal += b.ToString("x2").ToLower();
                }
            }
            if (length == fi.Length.ToString() && crc == crclocal)
            {
                Ipaybox.AddToLog(Ipaybox.Logs.Update, "\t\t Проверка " + file + " (" + length + ":" + crc + ")(" + fi.Length.ToString() + ":" + crclocal + ")= OK");
                return(FileCheckError.OK);
            }
            else
            {
                Match m = Regex.Match(file, @"([.]exe$)||([.]dll$)");

                if (m.Success)
                {
                    file += ".update";
                    return(ValidateLocalFile(file, length, crc));
                }

                Ipaybox.AddToLog(Ipaybox.Logs.Update, "\t\t Проверка " + file + " (" + length + ":" + crc + ")(" + fi.Length.ToString() + ":" + crclocal + ")=UPDATE");
                return(FileCheckError.UPDATE);
            }
        }
コード例 #3
0
        // Комиссия
        public void UpdateComiss(bool critical)
        {
            Ipaybox.AddToLog(Ipaybox.Logs.Main, "Загрузка профилей комиссий...");
            XmlDocument comission = new XmlDocument();

            try
            {
                string xml = TryDownloadComiss(ref comission);

                if (xml != null)
                {
                    if (xml.Length > 0)
                    {
                        Ipaybox.Incass.bytesRead += xml.Length;
                        Ipaybox.FlushStatistic();

                        if (xml.IndexOf("result") == -1)
                        {
                            // нормальный
                            Ipaybox.comiss.LoadXml(xml);

                            Ipaybox.comiss.Save(Ipaybox.StartupPath + "\\config\\comiss.xml");
                            Ipaybox.AddToLog(Ipaybox.Logs.Main, "...Профили успешно загружены.");
                            Ipaybox.NeedUpdates.Comission = false;
                        }
                        else
                        {
                            // ошибка
                        }
                    }
                    else
                    {
                        Ipaybox.AddToLog(Ipaybox.Logs.Main, "...Не удалось загрузить профили.");
                        if (critical)
                        {// Останавливаем обновление
                        }
                        else
                        {// не заменяем
                        }
                    }
                }
                else
                {
                    //Останавливаем обновление
                    Ipaybox.AddToLog(Ipaybox.Logs.Main, "...Не удалось загрузить профили.");
                }
            }
            catch
            {
                //Останавливаем обновление
                Ipaybox.AddToLog(Ipaybox.Logs.Main, "...Не удалось загрузить профили.");
            }
        }
コード例 #4
0
ファイル: acceptaccount.cs プロジェクト: ykcycvl/Zeus2013
        private void ExitForm()
        {
            Ipaybox.FlushToMain();
            Ipaybox.StartForm.Main_Process();

            for (int i = 0; i < this.Controls.Count; i++)
            {
                this.Controls[i].Dispose();
            }

            this.Dispose();
        }
コード例 #5
0
ファイル: main_menu.cs プロジェクト: ykcycvl/Zeus2013
        private void LoadGroups()
        {
            try
            {
                zeus.HelperClass.zMainMenuForm frm = Ipaybox.ifc.systemForms[0].groupList;
                int count = frm.count;

                int startx       = int.Parse(frm.startPos.Split(';')[0]);
                int starty       = int.Parse(frm.startPos.Split(';')[1]);
                int inline_count = frm.hcount;
                int dx           = frm.dx;
                int dy           = frm.dy;

                XmlElement root = (XmlElement)Ipaybox.config.DocumentElement.SelectSingleNode("groups");

                int x = startx, y = starty;
                int count1 = 0;

                for (int i = 0; i < root.ChildNodes.Count; i++)
                {
                    XmlElement row = (XmlElement)root.ChildNodes[i];

                    if (row.Name == "group" && row.GetAttribute("parent") == "0" && HasGroupProvider(row.GetAttribute("id")))
                    {
                        string id  = "group-" + row.GetAttribute("id");
                        string img = Ipaybox.GetImageFromInterface_Group(row.GetAttribute("id"));

                        if (img != "")
                        {
                            CreateNewProvider(img, x, y, id, new Size());
                            x += dx;
                            count1++;

                            if (count1 == inline_count)
                            {
                                x  = startx;
                                y += dy;

                                count1 = 0;
                            }
                        }
                    }
                }
            }
            catch
            {
                Ipaybox.Working = false;
            }
        }
コード例 #6
0
ファイル: info.cs プロジェクト: ykcycvl/Zeus2013
 void info_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Modifiers == Keys.Alt && e.KeyCode == Keys.F4)
     {
         Ipaybox.StartForm.Dispose();
     }
     if (e.KeyCode == Keys.F9)
     {
         Ipaybox.AddToLog(Ipaybox.Logs.Main, "Вход в сервисное меню по нажатию клавиши.");
         Form n = new login();
         n.Show();
         Ipaybox.ServiceMenu = true;
         ExitForm();
     }
 }
コード例 #7
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;
     }
 }
コード例 #8
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;
     }
 }
コード例 #9
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, "Соединение НЕ установлено.");
                }
            }
        }
コード例 #10
0
        // Провайдеры
        public void UpdateProviderList()
        {
            Ipaybox.AddToLog(Ipaybox.Logs.Main, "Загрузка списка провайдеров с сервера...");
            string data = "<request>";

            data += "<protocol>1.00</protocol>";
            data += "<type>1.00</type>";
            data += "<terminal>" + Ipaybox.Terminal.terminal_id + "</terminal>";
            data += "<pass>" + Ipaybox.Terminal.terminal_pass + "</pass>";
            data += "<providerlist/>";
            data += "</request>";

            string resp = TryPostData(data);

            if (resp != "")
            {
                Ipaybox.AddToLog(Ipaybox.Logs.Main, "...Получен ответ от сервера...");
                try
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(resp);
                    if (resp.IndexOf("result") == -1)
                    {
                        Ipaybox.providers.LoadXml(doc.InnerXml);

                        // Проверяем не пришел ли нам мусор...
                        if (Ipaybox.providers.DocumentElement.ChildNodes.Count > 0)
                        {
                            if (Ipaybox.providers.DocumentElement.ChildNodes[0].Name == "providers")
                            {
                                Ipaybox.providers.Save(Ipaybox.StartupPath + "\\config\\providers.xml");
                                Ipaybox.AddToLog(Ipaybox.Logs.Main, "...Список провайдеров загружен...");
                                Ipaybox.NeedUpdates.ProviderList = false;
                            }
                        }
                    }
                }
                catch
                {
                    Ipaybox.AddToLog(Ipaybox.Logs.Main, "...Произошла ошибка при обработке ответа. Неправильный XML.");
                }
            }
            else
            {
                Ipaybox.AddToLog(Ipaybox.Logs.Main, "...Ответ от сервера не получен.");
            }
        }
コード例 #11
0
        private string TryPostData(string data, int RequestTimeOut)
        {
            XmlDocument d     = new XmlDocument();
            bool        t     = false;
            int         count = 0;
            string      xml   = "";

            while (!t && count < Ipaybox.ServiceUrl.Length * 2)
            {
                try
                {
                    xml = SendRequestPost(Ipaybox.ServiceUrl[Ipaybox.ServiceUrlIndex] + "sevice.exe", data, RequestTimeOut);

                    if (xml != "")
                    {
                        Ipaybox.Incass.bytesSend += data.Length;
                        Ipaybox.Incass.bytesRead += xml.Length;
                        Ipaybox.FlushStatistic();
                    }

                    d.LoadXml(xml);

                    if (Ipaybox.RequestTimeout != 0.5)
                    {
                        Ipaybox.RequestTimeout = float.Parse("0,5");
                    }

                    break;
                }
                catch (Exception ex)
                {
                    Ipaybox.ServiceUrlIndex++;

                    if (Ipaybox.ServiceUrlIndex == Ipaybox.ServiceUrl.Length)
                    {
                        Ipaybox.ServiceUrlIndex = 0;
                    }

                    count++;

                    Ipaybox.RequestTimeout += 3;
                }
            }

            return(xml);
        }
コード例 #12
0
        private string TryDownloadOnLine(string param)
        {
            XmlDocument d     = new XmlDocument();
            bool        t     = false;
            int         count = 0;
            string      xml   = "";

            while (!t && count < Ipaybox.ServiceUrl.Length * 2)
            {
                try
                {
                    WebClient Client = new WebClient();

                    //xml = SendRequestGET(Ipaybox.ServiceUrl[Ipaybox.ServiceUrlIndex] + "xml_comiss.exe?trm_id="+Ipaybox.Terminal.terminal_id+"&trm_p="+Ipaybox.Terminal.terminal_pass);
                    xml = Client.DownloadString(Ipaybox.ServiceUrl[Ipaybox.ServiceUrlIndex] + "xml_online.exe?" + param);
                    try
                    {
                        //string utf8 = Encoding.UTF8.GetString(Encoding.Convert(Encoding.ASCII, Encoding.UTF8, Encoding.ASCII.GetBytes(xml)));

                        d.LoadXml(xml);
                        Ipaybox.Incass.bytesSend += 10;
                        Ipaybox.Incass.bytesRead += xml.Length;
                        Ipaybox.FlushStatistic();

                        XML_Response = xml;
                        break;
                    }
                    catch
                    {
                        count++;
                    }
                }
                catch
                {
                    Ipaybox.ServiceUrlIndex++;
                    if (Ipaybox.ServiceUrlIndex == Ipaybox.ServiceUrl.Length)
                    {
                        Ipaybox.ServiceUrlIndex = 0;
                    }
                    count++;
                }
            }

            return(xml);
        }
コード例 #13
0
        // Терминал - Информация
        private string TryDownloadTerminalInfo()
        {
            Ipaybox.AddToLog(Ipaybox.Logs.Main, "Загрузка информации о терминале.");
            XmlDocument d     = new XmlDocument();
            bool        t     = false;
            int         count = 0;
            string      xml   = "";

            while (!t && count < Ipaybox.ServiceUrl.Length * 2)
            {
                try
                {
                    //xml = SendRequestGET(Ipaybox.ServiceUrl[Ipaybox.ServiceUrlIndex] + "xml_comiss.exe?trm_id="+Ipaybox.Terminal.terminal_id+"&trm_p="+Ipaybox.Terminal.terminal_pass);
                    xml = Client.DownloadString(Ipaybox.ServiceUrl[Ipaybox.ServiceUrlIndex] + "xml_terminal.exe?trm_id=" + Ipaybox.Terminal.terminal_id + "&trm_p=" + Ipaybox.Terminal.terminal_pass);

                    try
                    {
                        //string utf8 = Encoding.UTF8.GetString(Encoding.Convert(Encoding.ASCII, Encoding.UTF8, Encoding.ASCII.GetBytes(xml)));

                        d.LoadXml(xml);
                        Ipaybox.AddToLog(Ipaybox.Logs.Main, "...Успешно загружена.");
                        Ipaybox.Incass.bytesSend += 10;
                        Ipaybox.Incass.bytesRead += xml.Length;
                        Ipaybox.FlushStatistic();
                        break;
                    }
                    catch
                    {
                        count++;
                    }
                }
                catch
                {
                    Ipaybox.ServiceUrlIndex++;
                    if (Ipaybox.ServiceUrlIndex == Ipaybox.ServiceUrl.Length)
                    {
                        Ipaybox.ServiceUrlIndex = 0;
                    }
                    count++;
                }
            }

            return(xml);
        }
コード例 #14
0
ファイル: options.cs プロジェクト: ykcycvl/Zeus2013
        private void printDoc_PrintPage(Object sender, PrintPageEventArgs e)
        {
            FileInfo     fi    = new FileInfo(Ipaybox.StartupPath + "\\config\\vkp80.prn");
            StreamReader sr    = fi.OpenText();
            string       check = sr.ReadToEnd();

            sr.Close();

            check = check.Replace("[agent_jur_name]", Ipaybox.Terminal.jur_name.Trim());
            check = check.Replace("[agent_adress]", Ipaybox.Terminal.jur_adress.Trim());
            check = check.Replace("[agent_inn]", "ИНН " + Ipaybox.Terminal.jur_inn.Trim());
            check = check.Replace("[agent_support_phone]", Ipaybox.Terminal.support_phone.Trim());
            check = check.Replace("[bank]", Ipaybox.Terminal.bank.Trim());
            check = check.Replace("[terms_number]", Ipaybox.Terminal.terms_number.Trim());
            check = check.Replace("[count_bill]", Ipaybox.Incass.countchecks.ToString().Trim());
            check = check.Replace("[terminal_id]", Ipaybox.Terminal.terminal_id.Trim());
            check = check.Replace("[trm_adress]", Ipaybox.Terminal.trm_adress.Trim());
            check = check.Replace("[date]", DateTime.Now.ToString().Trim());
            check = check.Replace("[amount]", Ipaybox.curPay.from_amount.ToString() + " руб.");
            check = check.Replace("[to_amount]", Ipaybox.curPay.to_amount.ToString() + " руб.");

            if (Ipaybox.FRS.RemoteFR)
            {
                try
                {
                    check = remoteFR.RemoteFiscalRegister.tryFormFicsalCheck(Ipaybox.Terminal.jur_name.Trim(), Ipaybox.FRS.headertext, check, "Тест", Ipaybox.Terminal.terminal_id.Trim(), Ipaybox.Terminal.terminal_pass, "0", "0", "1", Ipaybox.FRS.RemoteFiscalRegisterURL, Ipaybox.FRS.checkWidth, Ipaybox.FRS.remoteFRtimeout);
                }
                catch (Exception ex) { Ipaybox.AddToLog(Ipaybox.Logs.Main, ex.Message); }
            }
            ;

            if (Ipaybox.EpsonT400)
            {
                Font       printFont = new Font("Courier New", 8);
                RectangleF rf        = new RectangleF(0, 0, 220, 0);
                e.Graphics.DrawString("ШАБЛОН " + fi.Name + "\r\n" + check, printFont, Brushes.Black, rf);
            }
            else
            {
                Font printFont = new Font("Courier New", 10);
                e.Graphics.DrawString("ШАБЛОН " + fi.Name + "\r\n" + check, printFont, Brushes.Black, 0, 0);
            }
        }
コード例 #15
0
        private void login_Load(object sender, EventArgs e)
        {
            if (!Ipaybox.LoginFormActive)
            {
                Ipaybox.LoginFormActive = true;
                _cursor.Show();

                if (!Ipaybox.Debug)
                {
                    this.TopMost = true;
                }

                Ipaybox.AddToLog(Ipaybox.Logs.Main, "Вход в Сервисное меню - Ввод пин-кода.");
            }
            else
            {
                this.Dispose();
            }
        }
コード例 #16
0
ファイル: monitoring.cs プロジェクト: ykcycvl/Zeus2013
        private string TryPostData(string data)
        {
            XmlDocument d     = new XmlDocument();
            bool        t     = false;
            int         count = 0;
            string      xml   = "";

            while (!t && count < Ipaybox.ServiceUrl.Length * 2)
            {
                try
                {
                    xml = SendRequestPost(Ipaybox.ServiceUrl[Ipaybox.ServiceUrlIndex] + "sevice.exe", data);

                    try
                    {
                        if (xml != "")
                        {
                            Ipaybox.Incass.bytesSend += data.Length;
                            Ipaybox.Incass.bytesRead += xml.Length;
                            Ipaybox.FlushStatistic();
                        }

                        d.LoadXml(xml);

                        break;
                    }
                    catch
                    {
                        count++;
                    }
                }
                catch
                {
                    Ipaybox.ServiceUrlIndex++;
                    if (Ipaybox.ServiceUrlIndex == Ipaybox.ServiceUrl.Length)
                    {
                        Ipaybox.ServiceUrlIndex = 0;
                    }
                    count++;
                }
            }
            return(xml);
        }
コード例 #17
0
ファイル: info.cs プロジェクト: ykcycvl/Zeus2013
        /// <summary>
        /// Полим купюрник
        /// </summary>
        private void Pooling()
        {
            if (CanPolling)
            {
                try
                {
                    Ipaybox.Bill.AllowMoneyEnterOnPooling = false;
                    Ipaybox.Bill.Pooling();

                    // Обработка ошибок
                    if (Ipaybox.Bill.Error == true)
                    {
                        if (Ipaybox.Bill.ErrorMsg.IndexOf("DROP_CASSETTE_REMOVED") >= 0 && Ipaybox.ServiceMenu == false)
                        {
                            //Если не был введен неправильный пин - показать форму входа в сервисное меню
                            if (!Ipaybox.InvalidPinEntered)
                            {
                                if (!Ipaybox.LoginFormActive)
                                {
                                    Ipaybox.AddToLog(Ipaybox.Logs.Main, "Снят стекер. Показываем сервисное меню.");
                                    Form login = new login();
                                    login.Show();
                                    this.Dispose();
                                }
                            }
                        }
                        else
                        {
                            //Стекер не снят - сброс ошибки ввода неверного ПИН-кода
                            Ipaybox.InvalidPinEntered = false;
                        }
                    }
                    else
                    {
                        //Ошибок купюроприемника нет - сброс ошибки ввода неверного ПИН-кода
                        Ipaybox.InvalidPinEntered = false;
                    }
                }
                catch
                {
                }
            }
        }
コード例 #18
0
        public string XmlSendPayCount(int c_pays)
        {
            string pays = "";

            for (int i = 0; i < c_pays; i++)
            {
                XmlElement el = (XmlElement)Ipaybox.pays.DocumentElement.ChildNodes[i];
                pays += "<pay ";
                for (int j = 0; j < el.Attributes.Count; j++)
                {
                    pays += el.Attributes[j].Name + "=\"" + el.Attributes[j].Value + "\" ";
                }
                Ipaybox.AddToLog(Ipaybox.Logs.Main, "Готовим платеж к отправке №" + el.GetAttribute("txn_id"));

                pays += ">";
                pays += el.InnerXml;
                pays += "</pay> ";
            }
            return(pays);
        }
コード例 #19
0
        private void thanks_Load(object sender, EventArgs e)
        {
            Ipaybox.AddToLog(Ipaybox.Logs.Main, "Показываем форму `Спасибо`.");
            this.Size = Ipaybox.Resolution;

            if (Ipaybox.Inches == 17)
            {
                this.Location = new Point(0, 0);
            }
            try
            {
                _cursor.Hide();

                if (!Ipaybox.Debug)
                {
                    this.TopMost = false;
                }
            }
            catch { }
            LoadThisForm();
        }
コード例 #20
0
        private void Process_Form(zeus.HelperClass.zForm frm)
        {
            // Установка таймаута бездействия в мс
            if (frm.timeout != 0)
            {
                flush_timer.Interval = frm.timeout * 1000;
            }

            //Установка "бэкграунда"
            try
            {
                this.BackgroundImage       = new Bitmap(Ipaybox.StartupPath + @"\" + frm.bgimg);
                this.BackgroundImageLayout = ImageLayout.Stretch;
            }
            catch
            {
                Ipaybox.AddToLog(Ipaybox.Logs.Main, "Не удалось загрузить фоновое изображение");
                ExitForm();
            }

            //Добавляем элементы на форму
            //Надписи, кнопки, изображения, флэшки и т.п.
            for (int i = 0; i < frm.images.Count; i++)
            {
                Ipaybox.AddImage(frm.images[i], ref img[img_count], this);
                img_count++;
            }

            for (int i = 0; i < frm.buttons.Count; i++)
            {
                Ipaybox.AddButton(frm.buttons[i], ref img[img_count], this, new EventHandler(this.Pic_Click));
                img_count++;
            }

            for (int i = 0; i < frm.labels.Count; i++)
            {
                Ipaybox.AddLabel(frm.labels[i], ref labels[labels_count], this);
                labels_count++;
            }
        }
コード例 #21
0
ファイル: options.cs プロジェクト: ykcycvl/Zeus2013
        private void button2_Click(object sender, EventArgs e)
        {
            timer2.Stop();
            timer2.Start();

            this.TopMost = false;
            DialogResult dr = MessageBox.Show("Вы действительно хотите забрать деньги?", "Подтверждение инкассации", MessageBoxButtons.OKCancel);

            if (dr == DialogResult.OK)
            {
                //SendIncass si = new SendIncass();
                Ipaybox.AddToLog(Ipaybox.Logs.Main, "Выбран пункт проинкассировать платежи.");

                try
                {
                    Ipaybox.IncassCheck = true;
                    PrintCheck();
                    var inc = new zeus.API.IncassHistoryEntity(Ipaybox.Incassation)
                    {
                        DateStoped = DateTime.Now, TerminalId = Ipaybox.Terminal.terminal_id, userID = Ipaybox.userID
                    };
                    //Ipaybox.IncassHistory.Load();
                    Ipaybox.IncassHistory.Clear60();
                    Ipaybox.IncassHistory.Add(inc);

                    Ipaybox.IncassHistory.Save();
                    Ipaybox.Incassation.UserID = Ipaybox.userID;
                    Ipaybox.Import.Add("<i>" + Ipaybox.Incassation.IncassNow() + "</i>");
                    Ipaybox.AddToLog(Ipaybox.Logs.Main, "Инкассация добавлена в import.");

                    ShowStatistic();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Инкассация НЕ ПРОШЛА! \r\n" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Ipaybox.AddToLog(Ipaybox.Logs.Main, "Инкассация не прошла.");
                }
            }
            this.TopMost = true;
        }
コード例 #22
0
ファイル: main_menu.cs プロジェクト: ykcycvl/Zeus2013
        /// <summary>
        /// Полим купюрник
        /// </summary>
        private void Pooling()
        {
            if (CanPolling)
            {
                try
                {
                    Ipaybox.Bill.AllowMoneyEnterOnPooling = false;

                    Ipaybox.Bill.Pooling();

                    // Обработка ошибок
                    if (Ipaybox.Bill.Error == true)
                    {
                        if (Ipaybox.Bill.ErrorMsg.IndexOf("DROP_CASSETTE_REMOVED") >= 0 && Ipaybox.ServiceMenu == false)
                        {
                            if (!Ipaybox.InvalidPinEntered)
                            {
                                pooling.Stop();
                                Ipaybox.AddToLog(Ipaybox.Logs.Main, "Снят стекер. Показываем сервисное меню.");
                                this.ShowLoginForm("");
                            }
                        }
                        else
                        {
                            //Стекер не снят - сброс ошибки ввода неверного ПИН-кода
                            Ipaybox.InvalidPinEntered = false;
                        }
                    }
                    else
                    {
                        //Ошибок нет - сброс ошибки ввода неверного ПИН-кода
                        Ipaybox.InvalidPinEntered = false;
                    }
                }
                catch
                {
                }
            }
        }
コード例 #23
0
ファイル: options.cs プロジェクト: ykcycvl/Zeus2013
        private void Reset()
        {
            XmlElement root1 = Ipaybox.terminal_info.DocumentElement;

            if (root1 == null)
            {
                Ipaybox.terminal_info = new XmlDocument();
                Ipaybox.terminal_info.LoadXml("<terminal></terminal>");
                root1 = Ipaybox.terminal_info.DocumentElement;
            }

            if (textBox1.Text != Ipaybox.Terminal.terminal_id)
            {
                SetNew("terminal_id", textBox1.Text);

                Ipaybox.NeedToUpdateConfiguration = true;
                Ipaybox.NeedUpdates.Trm_info      = true;
            }

            if (textBox2.Text != Ipaybox.Terminal.terminal_pass)
            {
                SetNew("password", Ipaybox.getMd5Hash(textBox2.Text));
                Ipaybox.NeedToUpdateConfiguration = true;
                Ipaybox.NeedUpdates.Trm_info      = true;
            }

            if (textBox3.Text != Ipaybox.Terminal.pincode)
            {
                SetNew("pin", Ipaybox.getMd5Hash(textBox3.Text));
            }
            if (textBox4.Text != Ipaybox.Terminal.secret_number)
            {
                SetNew("secret_number", Ipaybox.getMd5Hash(textBox4.Text));
            }

            Ipaybox.terminal_info.Save(Ipaybox.StartupPath + "\\config\\terminal.xml");

            Ipaybox.LoadTerminalData();
        }
コード例 #24
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)
            {
                HelperClass.CrashLog.AddCrash(ex);
                Ipaybox.AddToLog(Ipaybox.Logs.Main, "Не удалось инициализировать класс работы с GPRS;");
            }
        }
コード例 #25
0
        private void button14_Click(object sender, EventArgs e)
        {
            bool   AccessGranted = false;
            string UserName      = "******";

            if (!Ipaybox.MasterPIN_IsActive)
            {
                for (int i = 0; i < Ipaybox.TPIN.GetElementsByTagName("person").Count; i++)
                {
                    XmlElement el     = Ipaybox.TPIN.GetElementsByTagName("person")[i] as XmlElement;
                    string     pin_el = el.GetAttribute("pin").ToString();

                    if (pin_el == Ipaybox.getMd5Hash(pin))
                    {
                        AccessGranted  = true;
                        UserName       = el.GetAttribute("name").ToString();
                        Ipaybox.userID = Convert.ToUInt32(el.GetAttribute("pid"));
                        break;
                    }
                }
            }
            else
            {
                XmlElement el     = Ipaybox.terminal_info.GetElementsByTagName("pin")[0] as XmlElement;
                string     pin_el = el.InnerText;

                if (pin_el == Ipaybox.getMd5Hash(pin))
                {
                    AccessGranted  = true;
                    Ipaybox.userID = 1;
                }
            }

            if (AccessGranted)
            {
                Ipaybox.AddToLog(Ipaybox.Logs.Main, "Попытка входа в сервисное меню. " + UserName);
                Form i = new options();
                Ipaybox.LoginFormActive = false;
                i.Show();
                this.Dispose();
            }
            else
            {
                Ipaybox.AddToLog(Ipaybox.Logs.Main, "Попытка входа в сервисное меню pin-code:" + pin);
                EnteringPINcount++;
                pin = "";

                if (EnteringPINcount > 2)
                {
                    Ipaybox.Working           = false;
                    Ipaybox.InvalidPinEntered = true;
                    Ipaybox.ServiceMenu       = false;
                    Ipaybox.StartForm.Main_Process();
                    Ipaybox.LoginFormActive = false;
                    this.Dispose();
                    Ipaybox.AddToLog(Ipaybox.Logs.Main, "ПИН введен неверно 3 раза");
                }
            }

            textBox1.Text = pin;
        }
コード例 #26
0
ファイル: acceptaccount.cs プロジェクト: ykcycvl/Zeus2013
        public static void AddBanner(zeus.HelperClass.zBanner btn, System.Windows.Forms.Form f, EventHandler tar)
        {
            try
            {
                string location = btn.location;
                string limg     = btn.src;
                string size     = btn.size;

                int X     = int.Parse(location.Split(';')[0]);
                int Y     = int.Parse(location.Split(';')[1]);
                int sizeX = int.Parse(size.Split(';')[0]);
                int sizeY = int.Parse(size.Split(';')[1]);

                XmlElement root = (XmlElement)Ipaybox.config.DocumentElement.SelectSingleNode("banners");

                Image _gif = null;

                try
                {
                    if (root == null)
                    {
                        _gif = Image.FromFile(limg);
                    }
                    else
                    {
                        for (int i = 0; i < root.ChildNodes.Count; i++)
                        {
                            XmlElement row = (XmlElement)root.ChildNodes[i];

                            if (row.Name == "banner")
                            {
                                string form = row.GetAttribute("form").ToLower();

                                if (form == "acceptaccount" || form == "all")
                                {
                                    string src = row.GetAttribute("src");
                                    _gif = Image.FromFile(src);
                                    break;
                                }
                            }
                        }

                        if (_gif == null)
                        {
                            _gif = Image.FromFile(limg);
                        }
                    }
                }
                catch
                {
                    _gif = Image.FromFile(limg);
                }

                PictureBox pb = new PictureBox();
                pb.Size      = new Size(sizeX, sizeY);
                pb.Location  = new Point(X, Y);
                pb.BackColor = Color.Transparent;
                pb.Image     = _gif;
                f.Controls.Add(pb);
            }
            catch (Exception ex)
            {
                Ipaybox.AddToLog(Ipaybox.Logs.Main, "Не удалось загрузить баннер: " + ex.Message);
            }
        }
コード例 #27
0
ファイル: acceptaccount.cs プロジェクト: ykcycvl/Zeus2013
        private void Process_Form(zeus.HelperClass.zForm frm)
        {
            if (IsSelectedProviderOnline())
            {
                ProgressAnimator a = new ProgressAnimator();
                a.Show();
                new System.Threading.Thread(ValidateAccount).Start();

                int zz = 0;

                while (zz < 5000000 || !AccauntValidated)
                {
                    Application.DoEvents();
                    zz++;
                }

                a.Hide();
                a.Dispose();
            }
            else
            {
                IsAccountValid     = true;
                IsServiceAvailable = true;
            }

            // XmlElement root = frm;

            try
            {
                this.BackgroundImage = new Bitmap(frm.bgimg);
            }
            catch
            {
                this.BackColor = Color.FromArgb(230, 230, 230);
            }

            for (int i = 0; i < frm.images.Count; i++)
            {
                AddImage(frm.images[i], ref img[img_count]);
                img_count++;
            }
            for (int i = 0; i < frm.buttons.Count; i++)
            {
                AddButton(frm.buttons[i]);
            }
            for (int i = 0; i < frm.banners.Count; i++)
            {
                AddBanner(frm.banners[i], this, new EventHandler(this.Pic_Click));
            }
            for (int i = 0; i < frm.labels.Count; i++)
            {
                if (frm.labels[i].name == "account")
                {
                    AddLabel(frm.labels[i], ref label1, this);
                    //labels_count++;
                }
                else
                {
                    Ipaybox.AddLabel(frm.labels[i], ref labels[labels_count], this);
                    labels_count++;
                }
            }

            AddProviderImage(frm.prvImage);

            string accname  = "";
            string acctext  = "";
            string accvalue = "";

            string[] opt = Ipaybox.curPay.Options.Split('|');

            for (int i = 0; i < opt.Length; i++)
            {
                if (opt[i] != "")
                {
                    string ViewText = string.Empty;

                    if (Ipaybox.curPay.ViewText != null && Ipaybox.curPay.ViewText[i] != null && !string.IsNullOrEmpty(Ipaybox.curPay.ViewText[i].ViewText))
                    {
                        ViewText = Ipaybox.curPay.ViewText[i].ViewText;
                    }

                    string[] param = opt[i].Split('%');
                    accname  = param[0].ToUpper();
                    acctext += accname + ": " + (string.IsNullOrEmpty(ViewText) ? param[2] : ViewText) + "\r\n";
                    //AddLabel(param[0] + ": " + param[2], new Point(100, 200 + y), "Times New Roman", "18","255;255;255");
                    if (param[1] == "account")
                    {
                        accvalue = param[2];
                    }
                }
            }
            //AddLabel(acctext, new Point(100, 200), "Times New Roman", "18", "255;255;255", "");

            label1.Text = acctext;

            if (withProviderName)
            {
                //label1.TextAlign = ContentAlignment.MiddleCenter;
                label1.Text = "ПОЛУЧАТЕЛЬ: " + Ipaybox.PROVIDER_XML.GetAttribute("name") + "\r\n" + label1.Text;
            }

            if (!IsServiceAvailable)
            {
                ShowWarning(188, 500);
                AddLabel("Отсутствует связь.\r\nНевозможно провести платеж на этого провайдера.", new Point(350, 530), "Times New Roman", "20", "169;22;6");
            }
            else
            if (!IsAccountValid)
            {
                ShowWarning(188, 500);
                AddLabel(acctext + "\r\nне прошел проверку или сервис провайдера не работает.", new Point(350, 530), "Times New Roman", "20", "169;22;6");
            }
            else
            {
                // enable
                img[indexDalee].Visible = true;
                this.Invalidate();
            }
        }
コード例 #28
0
ファイル: info.cs プロジェクト: ykcycvl/Zeus2013
        private void Process_Form(XmlElement frm)
        {
            XmlElement root = frm;

            try
            {
                this.BackgroundImage = new Bitmap(Ipaybox.StartupPath + @"\" + root.GetAttribute("backgroundimage"));
            }
            catch { }


            string bgcolor = string.Empty;

            try
            {
                root.GetAttribute("bgcolor");
            }
            catch
            {
            }

            if (!string.IsNullOrEmpty(bgcolor))
            {
                string[] rgb = bgcolor.Split(';');

                if (rgb.Length == 3)
                {
                    try
                    {
                        this.BackColor = Color.FromArgb(int.Parse(rgb[0]), int.Parse(rgb[1]), int.Parse(rgb[2]));
                    }
                    catch
                    {
                        Ipaybox.AddToLog(Ipaybox.Logs.Main, "Неверное представление цвета в тэге bgcolor");
                    }
                }
            }

            for (int i = 0; i < root.ChildNodes.Count; i++)
            {
                XmlElement row = (XmlElement)root.ChildNodes[i];

                if (row.Name == "img")
                {
                    Ipaybox.AddImage(row, ref img[img_count], this);
                    img_count++;
                }
                if (row.Name == "button")
                {
                    AddButton(row);
                }
                if (row.Name == "label")
                {
                    Ipaybox.AddLabel(row, ref labels[label_count], this);
                    label_count++;
                }
                if (row.Name == "flash")
                {
                    AddFlash(row, this);
                }
            }
        }
コード例 #29
0
        public bool SMTP(string subject, string body, string file, string email)
        {
            System.Net.Mail.SmtpClient Smtp = new SmtpClient("smtp.z8.ru");
            try
            {
                bool IsFileAttached = false;

                System.Net.Mail.MailMessage Message = new System.Net.Mail.MailMessage();

                Message.To.Add(new MailAddress(email));
                Message.Subject = subject;
                Message.Body    = body;

                FileInfo fi = new FileInfo(file);
                if (fi.Exists)
                {
                    // 1 mb =
                    int MaxFileSize = 1024 * 1024; //
                    if (fi.Length > MaxFileSize)
                    {
                        body += "Запрошенный Вами файл <" + fi.FullName + "> имеет размер больше 1Мб. Передача файла прервана. \r\n";
                    }
                    else
                    {
                        Message.Attachments.Add(new System.Net.Mail.Attachment(file));
                        IsFileAttached = true;
                    }
                }
                else
                {
                    body += "Запрошенный Вами файл не существует. \r\n";
                }

                body += "\r\n-----\r\n";
                body += "Ipaybox.ru\r\n";
                body += "Дата: " + DateTime.Now.ToString();

                Message.BodyEncoding = Encoding.GetEncoding("utf-8"); // Turkish Character Encoding// кодировка эсли нужно
                Message.From         = new System.Net.Mail.MailAddress("Ipaybox.ru <*****@*****.**>");


                //Smtp.Host = "smtp.z8.ru"; //например для gmail (smtp.gmail.com), mail.ru(smtp.mail.ru)
                Smtp.EnableSsl   = false; // включение SSL для gmail нужно, для mail.ru не нада
                Smtp.Credentials = new System.Net.NetworkCredential("ipaybox_9", "hbl6FijITwZ");

                Smtp.Send(Message);//отправка
                if (IsFileAttached)
                {
                    Ipaybox.Incass.bytesSend += (int)(fi.Length + fi.Length / 3);
                }
                Ipaybox.AddToLog(Ipaybox.Logs.Main, "Файл <" + file + "> успешно отправлен на <" + email + ">");
                return(true);
            }
            catch (SmtpFailedRecipientsException ex1)
            {
                /*
                 * Сообщение не удалось доставить одному или нескольким получателям из свойств To, CC или Bcc.
                 */
                Ipaybox.AddToLog(Ipaybox.Logs.Main, "Файл <" + file + "> не доставлен для одного или нескольких адресатов на <" + email + "> StatusCode:" + ex1.StatusCode);
                return(true);
            }
            catch (SmtpException ex2)
            {
                HelperClass.CrashLog.AddCrash(ex2);

                /*
                 * Сбой подключения к серверу SMTP. или-
                 * Сбой проверки подлинности. или-
                 * Bремя операции истекло.
                 */
                Ipaybox.AddToLog(Ipaybox.Logs.Main, "Файл <" + file + "> не доставлен. Сбой подключения к SMTP-серверу. StatusCode:" + ex2.StatusCode);
            }
            catch (Exception ex)
            {
                HelperClass.CrashLog.AddCrash(ex);
            }


            return(false);
        }
コード例 #30
0
        private bool ParseResponse(XmlElement el)
        {
            bool res = true;

            for (int i = 0; i < el.ChildNodes.Count; i++)
            {
                XmlElement row = (XmlElement)el.ChildNodes[i];

                if (row.Name == "pay")
                {
                    string txn_id = row.GetAttribute("txn_id");
                    string state  = row.GetAttribute("state");
                    Ipaybox.AddToLog(Ipaybox.Logs.Main, "Получен ответ txn_id=" + txn_id + " state=" + state);
                    if (state == "0")
                    {
                        try
                        {
                            Ipaybox.Import.Remove("pay", "txn_id", txn_id, true);
                            XmlNode del = FindPayNode(txn_id);

                            if (del != null)
                            {
                                Ipaybox.AddToLog(Ipaybox.Logs.Main, "Удаляем платеж из import.xml");
                                Ipaybox.pays.DocumentElement.RemoveChild(del);
                            }
                        }
                        catch (Exception ex)
                        {
                            if (Ipaybox.Debug)
                            {
                                HelperClass.CrashLog.AddCrash(new Exception("PARSE:PAY\r\n" + ex.Message));
                            }
                        }
                    }
                }
                if (row.Name == "incass")
                {
                    string id    = row.GetAttribute("id");
                    string state = row.GetAttribute("result");
                    Ipaybox.AddToLog(Ipaybox.Logs.Main, "Инкассация id=" + id + " state=" + state);
                    if (state == "0")
                    {
                        try
                        {
                            Ipaybox.Import.Remove("statistic", "id", id, true);
                        }
                        catch (Exception ex)
                        {
                            if (Ipaybox.Debug)
                            {
                                HelperClass.CrashLog.AddCrash(new Exception("PARSE:INCASS\r\n" + ex.Message));
                            }
                        }
                    }
                }

                if (row.Name == "restart")
                {
                    if (row.InnerText == "1")
                    {
                        Ipaybox.NeedToRestart = true;
                        Ipaybox.AddToLog(Ipaybox.Logs.Main, "Получена команда на перезапуск");
                    }
                    else
                    {
                        if (row.InnerText == "2")
                        {
                            Ipaybox.NeedToReboot = true;
                            Ipaybox.AddToLog(Ipaybox.Logs.Main, "Получена команда на перезагрузку");
                        }
                        else
                        if (row.InnerText == "3")
                        {
                            Ipaybox.NeedShutdown = true;
                            Ipaybox.AddToLog(Ipaybox.Logs.Main, "Получена команда на выключение");
                        }
                    }
                }

                if (row.Name == "filerequest")
                {
                    /*
                     * <filerequest id=\"[0]\" filename=\"[1]\" path=\"[2]\" type=\"[3]\" email=\"[4]\" />
                     */

                    XmlElement element = Ipaybox.XML_SendFile.CreateElement("filerequest");
                    element.SetAttribute("id", row.GetAttribute("id"));
                    element.SetAttribute("filename", row.GetAttribute("filename"));
                    element.SetAttribute("path", row.GetAttribute("path"));
                    element.SetAttribute("type", row.GetAttribute("type"));
                    element.SetAttribute("email", row.GetAttribute("email"));

                    Ipaybox.XML_SendFile.DocumentElement.InsertAfter(element, Ipaybox.XML_SendFile.DocumentElement.LastChild);
                    Ipaybox.XML_SendFile.Save("file.xml");

                    new System.Threading.Thread(SendFiles).Start();
                }

                if (row.Name == "configuration-id")
                {
                    string txt = row.InnerText;
                    if (!String.IsNullOrEmpty(txt))
                    {
                        if (txt[txt.Length - 1] == 'U')
                        {
                            Ipaybox.NeedToUpdateConfiguration = true;
                            Ipaybox.NeedUpdates.Core          = true;
                            txt = txt.Remove(txt.Length - 1);
                        }

                        // Если с сервера пришел ответ с литерой "I" в configuration-id
                        // необходимо обновить интерфейс приложения
                        if (txt[txt.Length - 1] == 'I')
                        {
                            Ipaybox.NeedToUpdateConfiguration = true;
                            Ipaybox.NeedUpdates.Interface     = true;
                            txt = txt.Remove(txt.Length - 1);
                        }

                        if (Ipaybox.Terminal.configuration_id != txt)
                        {
                            Ipaybox.NeedToUpdateConfiguration = true;
                            Ipaybox.NeedUpdates.Comission     = true;
                            Ipaybox.NeedUpdates.Config        = true;

                            Ipaybox.NeedUpdates.ProviderList = true;
                            Ipaybox.NeedUpdates.Trm_info     = true;

                            Ipaybox.Terminal.configuration_id = txt;
                        }
                    }
                }

                /*if (row.Name == "configuration-id")
                 * {
                 *  string txt = row.InnerText;
                 *  if (!String.IsNullOrEmpty(txt))
                 *  {
                 *      if (txt[txt.Length - 1] == 'U')
                 *      {
                 *          Ipaybox.NeedToUpdateConfiguration = true;
                 *          Ipaybox.NeedUpdates.Core = true;
                 *          txt = txt.Remove(txt.Length - 1);
                 *      }
                 *
                 *      if (Ipaybox.Terminal.configuration_id != txt)
                 *      {
                 *          Ipaybox.NeedToUpdateConfiguration = true;
                 *          Ipaybox.NeedUpdates.Comission = true;
                 *          Ipaybox.NeedUpdates.Config = true;
                 *
                 *          Ipaybox.NeedUpdates.ProviderList = true;
                 *          Ipaybox.NeedUpdates.Trm_info = true;
                 *
                 *          Ipaybox.Terminal.configuration_id = txt;
                 *      }
                 *  }
                 * }*/
            }
            Ipaybox.pays.Save("import.xml");
            if (Ipaybox.pays.DocumentElement.ChildNodes.Count == 0)
            {
                return(res);
            }

            return(!res);
        }