private void EncashmentClick(GeckoElement clicked) { try { if (clicked.HasAttribute("id") && !clicked.HasAttribute("disabled")) { if (clicked.GetAttribute("id").Equals("next")) { var login = (GeckoInputElement)_browser.Document.GetElementById("login"); var password = (GeckoInputElement)_browser.Document.GetElementById("password"); _collector = Collector.FindCollector(login.Value, password.Value); if (_collector.Id <= 0) { const string message = "Неправильный логин и/или пароль"; MessageBox.Show(message); } else { Util.NavigateTo(_browser, CurrentWindow.MakeEncashment); } } else if (clicked.GetAttribute("id").Equals("back")) { Util.NavigateTo(_browser, CurrentWindow.Main); } } } catch (Exception exception) { Log.Error(exception); } }
private void EnterNumberClick(GeckoElement clicked) { try { if (clicked.HasAttribute("id") && !clicked.HasAttribute("disabled")) { if (clicked.GetAttribute("id").Equals("next")) { var input = (GeckoInputElement)_browser.Document.GetElementById("number"); _payment.nomer = input.Value; _payment.nomer2 = ""; // Todo Проверить наличие поля ввода второго номера и если такого поля нет только потом вставить пустую строку Log.Debug(String.Format("Entered number {0}", input.Value)); Util.NavigateTo(_browser, CurrentWindow.Pay); } else if (clicked.GetAttribute("id").Equals("back")) { _payment.nomer = ""; _payment.nomer2 = ""; Util.NavigateTo(_browser, _clickedTopButton ? CurrentWindow.Main : CurrentWindow.Dependent); } } } catch (Exception exception) { Log.Error(exception); } }
private void MakeEncashmentClick(GeckoElement clicked) { try { if (clicked.HasAttribute("id") && !clicked.HasAttribute("disabled")) { if (clicked.GetAttribute("id").Equals("next")) { } else if (clicked.GetAttribute("id").Equals("back")) { Util.NavigateTo(_browser, CurrentWindow.Main); } } } catch (Exception exception) { Log.Error(exception); } }
private void PayClick(GeckoElement clicked) { try { if (clicked.HasAttribute("id") && !clicked.HasAttribute("disabled")) { if (clicked.GetAttribute("id").Equals("next")) { _payment.Save(); _payment = new Payment(); Util.NavigateTo(_browser, CurrentWindow.Main); } else if (clicked.GetAttribute("id").Equals("back")) { Util.NavigateTo(_browser, CurrentWindow.EnterNumber); } _cashCode.DisableBillTypes(); } } catch (Exception exception) { Log.Error(exception); } }
private void MainClick(GeckoElement clicked) { try { if (clicked.HasAttribute("data-type")) { switch (clicked.GetAttribute("data-type")) { case "service": short.TryParse(clicked.GetAttribute("id"), out _mainServiceId); Log.Debug(String.Format("Clicked service with id {0}", clicked.GetAttribute("id"))); Util.NavigateTo(_browser, CurrentWindow.Dependent); _clickedTopButton = false; break; case "top-service": try { _payment.id_uslugi = short.Parse(clicked.GetAttribute("id")); Log.Debug(String.Format("Clicked top-service with id {0}", clicked.GetAttribute("id"))); Util.NavigateTo(_browser, CurrentWindow.EnterNumber); _clickedTopButton = true; } catch (Exception ex) { Log.Error("Incorrect service id format", ex, clicked); } break; default: Log.Debug("Clicked element was null"); return; } } else if (clicked.HasAttribute("language")) { } } catch (Exception exception) { Log.Error(exception); } }
private void DependentClick(GeckoElement clicked) { try { if (clicked.HasAttribute("id")) { if (clicked.GetAttribute("id").Equals("back")) { Util.NavigateTo(_browser, CurrentWindow.Main); } else { _payment.id_uslugi = short.Parse(clicked.GetAttribute("id")); Log.Debug(String.Format("Clicked service with id {0}", clicked.GetAttribute("id"))); Util.NavigateTo(_browser, CurrentWindow.EnterNumber); } } } catch (Exception exception) { Log.Error(exception); } }