Exemple #1
0
        private void Button_Click_Exit(object sender, RoutedEventArgs e)
        {
            BankingApiClient.GetInstance().Reset();
            LoginPage LogP = new LoginPage();

            this.NavigationService.Navigate(LogP);
        }
Exemple #2
0
 public AccountPage()
 {
     InitializeComponent();
     currUser = BankingApiClient.GetInstance().CurrentUser();
     this.NameTextBlock.Text    = $"{currUser.Name}";
     this.SurnameTextBlock.Text = $"{currUser.Surname}";
     this.PhoneTextBlock.Text   = $"{currUser.PhoneNumber}";
 }
Exemple #3
0
        public TransferPage()
        {
            InitializeComponent();

            currUser = BankingApiClient.GetInstance().CurrentUser();
            var cards = currUser.Accounts;

            for (var i = 0; i < cards.Length; i++)
            {
                ComboBoxItem boxItem = new ComboBoxItem();
                boxItem.Content = cards[i].AccountNumber;
                if (i == 0)
                {
                    boxItem.IsSelected = true;
                }
                CardComboBox.Items.Add(boxItem);
            }
        }
Exemple #4
0
        private void ButtonSignUp_Click(object sender, RoutedEventArgs e)
        {
            var userInfo = new UserUpdDto
            {
                Name        = NameTextBox.Text,
                Surname     = SurnameTextBox.Text,
                PhoneNumber = LoginTextBox.Text,
                Password    = PasswordTextBox.Password
            };

            if (userInfo.Name == "" || userInfo.Surname == "" ||
                userInfo.PhoneNumber == "" || userInfo.Password == "")
            {
                MessageBox.Show("Заповніть всі поля!", "Помилка реєстрації");
            }
            else if (!phoneValid.IsMatch(userInfo.PhoneNumber))
            {
                MessageBox.Show("Неправильний формат телефону.\nПеревірте і спробуйте ще раз.", "Помилка реєстрації");
            }
            else if (userInfo.Password.Length < 8)
            {
                PasswordTextBox.Password = "";
                MessageBox.Show("Пароль має складатися з 8 чи більше символів!", "Помилка реєстрації");
            }
            else
            {
                if (BankingApiClient.GetInstance().Register(userInfo.Name, userInfo.Surname, userInfo.PhoneNumber, userInfo.Password))
                {
                    NameTextBox.Text         = "";
                    SurnameTextBox.Text      = "";
                    LoginTextBox.Text        = "+380";
                    PasswordTextBox.Password = "";

                    // To next page
                    MainPage MainP = new MainPage();
                    this.NavigationService.Navigate(MainP);
                }
                else
                {
                    PasswordTextBox.Password = "";
                    MessageBox.Show("Вказаний номер телефону вже зареєстрований!", "Помилка реєстрації");
                }
            }
        }
Exemple #5
0
        public MainPage()
        {
            InitializeComponent();
            currUser = BankingApiClient.GetInstance().CurrentUser();
            this.GreetingText.Text = $"Вітаємо,\n{currUser.Surname} {currUser.Name}!";

            var cards = currUser.Accounts;

            foreach (var card in cards)
            {
                Button butt = new Button();
                butt.Content  = $"# {card.AccountNumber}\nБаланс - {String.Format("{0:0.00}", card.Balance)} грн.";
                butt.Name     = "Button" + card.AccountNumber;
                butt.FontSize = 19;
                butt.Tag      = card.AccountNumber;
                butt.Click   += Button_Click;
                CardPanel.Children.Add(butt);
            }
        }
Exemple #6
0
        private void Button_Click_Add_Card(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Ви дійсно бажаєте додати нову картку?",
                                                      "Підтвердження",
                                                      MessageBoxButton.YesNo,
                                                      MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                if (BankingApiClient.GetInstance().OpenAccount(currUser.PhoneNumber))
                {
                    MainPage MP = new MainPage();
                    this.NavigationService.Navigate(MP);
                }
                else
                {
                    MessageBox.Show("Відбулася якась помилка.\nСпробуйте ще раз.", "Помилка");
                }
            }
        }
Exemple #7
0
        private void ButtonLogin_Click(object sender, RoutedEventArgs e)
        {
            if (LoginTextBox.Text == "" || PasswordTextBox.Password == "")
            {
                MessageBox.Show("Заповніть всі поля!", "Помилка входу");
            }
            else
            {
                if (BankingApiClient.GetInstance().Login(LoginTextBox.Text, PasswordTextBox.Password))
                {
                    LoginTextBox.Text        = "";
                    PasswordTextBox.Password = "";

                    // To next page
                    MainPage MainP = new MainPage();
                    this.NavigationService.Navigate(MainP);
                }
                else
                {
                    PasswordTextBox.Password = "";
                    MessageBox.Show("Ви ввели неправильний логін або пароль!", "Помилка входу");
                }
            }
        }
Exemple #8
0
        private void Show_History(string id)
        {
            var his = BankingApiClient.GetInstance().History(id, fromD, toD);

            if (his.Length == 0)
            {
                TextBlock text = new TextBlock
                {
                    FontSize            = 18,
                    Width               = 340,
                    TextWrapping        = TextWrapping.Wrap,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Text = "На задані дати транзакцій не було."
                };
                InfoPanel.Children.Add(text);
            }
            foreach (var h in his)
            {
                Border border = new Border
                {
                    BorderThickness = new Thickness(0, 1, 0, 0),
                    BorderBrush     = Brushes.CadetBlue,
                };
                StackPanel sp = new StackPanel();
                TextBlock  tx = new TextBlock
                {
                    FontSize     = 17,
                    Width        = 340,
                    TextWrapping = TextWrapping.Wrap
                };

                TextBlock currency = new TextBlock
                {
                    FontSize            = 18,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Text       = $"{h.Amount} грн.",
                    Foreground = Brushes.OrangeRed,
                    FontWeight = FontWeights.Bold
                };
                TextBlock fee = new TextBlock
                {
                    FontSize            = 15,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Foreground          = Brushes.Gray,
                };

                TextBlock dt = new TextBlock
                {
                    FontSize            = 14,
                    Foreground          = Brushes.LightSlateGray,
                    HorizontalAlignment = HorizontalAlignment.Right,
                    Text = h.DatePerformed.ToString()
                };

                if (h.IsIncome)
                {
                    tx.Text             = $"Зарахування на карту. Відправник: {h.PartnerInfo}";
                    currency.Foreground = Brushes.ForestGreen;

                    fee.Text = $"Комісія - {String.Format("{0:0.00}", h.Amount * 0.01)} грн.";
                }
                else if (h.Discriminator == "Mobile Replenishment")
                {
                    tx.Text = $"Поповнення мобільного. Отримувач: {h.PartnerInfo}";
                }
                else
                {
                    tx.Text = $"Переказ на карту. Отримувач: {h.PartnerInfo}";
                }

                sp.Children.Add(tx);
                sp.Children.Add(currency);
                sp.Children.Add(fee);
                sp.Children.Add(dt);
                border.Child = sp;
                InfoPanel.Children.Add(border);
            }
        }