Exemple #1
0
        /// <summary>
        /// Every time the user selects an entry in the ListBox, the name of that item will be made into a usable string.
        /// After that it will be used to find the data of the selected user.
        /// </summary>
        private void UsersBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (alreadyShown == false)
            {
                showUserDataLabels();
                alreadyShown = true;
            }

            if (UsersBox.SelectedItem != null)
            {
                string data       = UsersBox.SelectedItem.ToString();
                string usableData = data.Substring(37);

                Console.WriteLine(usableData);

                Cryptobankservice.CryptoBankServiceSoapClient cssc = new Cryptobankservice.CryptoBankServiceSoapClient();
                Cryptobankservice.UserModel[] x = cssc.Finduser(usableData);

                statusData.Content        = x[0].status;
                nameData.Content          = x[0].name;
                emailData.Content         = x[0].email;
                cityData.Content          = x[0].city;
                accountnumberData.Content = x[0].accountnumber;
                balanceData.Content       = x[0].balance;
            }
        }
 /// <summary>
 /// This method will be used to find all the users in the database and fill the ListBox with all the users.
 /// </summary>
 public void findAllUsers()
 {
     Cryptobankservice.CryptoBankServiceSoapClient cssc = new Cryptobankservice.CryptoBankServiceSoapClient();
     List<string> users = cssc.AllUsers();
     for (int i = 0; i < users.Count; i++)
     {
         ListBoxItem itm = new ListBoxItem();
         itm.Content = users[i];
         UsersBox.Items.Add(itm);
         itm = null;
     }
 }
Exemple #3
0
        /// <summary>
        /// This method will be used to find all the users in the database and fill the ListBox with all the users.
        /// </summary>
        public void findAllUsers()
        {
            Cryptobankservice.CryptoBankServiceSoapClient cssc = new Cryptobankservice.CryptoBankServiceSoapClient();
            List <string> users = cssc.AllUsers();

            for (int i = 0; i < users.Count; i++)
            {
                ListBoxItem itm = new ListBoxItem();
                itm.Content = users[i];
                UsersBox.Items.Add(itm);
                itm = null;
            }
        }
        /// <summary>
        /// If the button is clicked the user that is selected in the list will be deleted.
        /// </summary>
        private void DeleteAccount(object sender, RoutedEventArgs e)
        {
            string data = UsersBox.SelectedItem.ToString();
            var usableData = data.Substring(37);
            Cryptobankservice.CryptoBankServiceSoapClient cssc = new Cryptobankservice.CryptoBankServiceSoapClient();
            cssc.DeleteUser(usableData);

            TransactionButton.Visibility = Visibility.Collapsed;
            DeleteButton.Visibility = Visibility.Collapsed;
            statusData.Content = "inactive";

            UsersBox.Items.Remove(UsersBox.SelectedItem);

            alreadyShown = false;
        }
Exemple #5
0
        /// <summary>
        /// If the button is clicked the user that is selected in the list will be deleted.
        /// </summary>
        private void DeleteAccount(object sender, RoutedEventArgs e)
        {
            string data       = UsersBox.SelectedItem.ToString();
            var    usableData = data.Substring(37);

            Cryptobankservice.CryptoBankServiceSoapClient cssc = new Cryptobankservice.CryptoBankServiceSoapClient();
            cssc.DeleteUser(usableData);

            TransactionButton.Visibility = Visibility.Collapsed;
            DeleteButton.Visibility      = Visibility.Collapsed;
            statusData.Content           = "inactive";

            UsersBox.Items.Remove(UsersBox.SelectedItem);

            alreadyShown = false;
        }
        /// <summary>
        /// The same as fillWithTransactionsType, the only difference here is that the search is only on the user.
        /// </summary>
        /// <param name="accountNumber"> The accountNumber is used to identify which person the admin wants to find </param>
        public void fillWithTransactionsAccount(string accountNumber)
        {
            TransactionGrid.Items.Clear();
            Cryptobankservice.CryptoBankServiceSoapClient cssc = new Cryptobankservice.CryptoBankServiceSoapClient();

            Cryptobankservice.TransactionModel[] transactions = cssc.AllTransactions(accountNumber);

            for (var i = 0; i < transactions.Length; i++)
            {
                var data = new TransactionData
                {
                    date     = transactions[i].date,
                    type     = transactions[i].transactiontype,
                    sender   = transactions[i].sender,
                    receiver = transactions[i].receiver,
                    amount   = transactions[i].amount
                };

                TransactionGrid.Items.Add(data);
                data = null;
            }
        }
        /// <summary>
        /// This method fills the data grid with transactions. 
        /// The moment this method is run all the transactions will be searched through to find the transactions that have the right type and user.
        /// </summary>
        /// <param name="type"> The type is used to identify which transactions the admin wants to find </param>
        /// /// <param name="accountNumber"> The accountNumber is used to identify which person the admin wants to find </param>
        public void fillWithTransactionsType(string type, string accountNumber)
        {
            TransactionGrid.Items.Clear();
            Cryptobankservice.CryptoBankServiceSoapClient cssc = new Cryptobankservice.CryptoBankServiceSoapClient();

            Cryptobankservice.TransactionModel[] transactions = cssc.TransactionsPerType(type, accountNumber);

            for (var i = 0; i < transactions.Length; i++)
            {
                var data = new TransactionData
                {
                    date = transactions[i].date,
                    type = transactions[i].transactiontype,
                    sender = transactions[i].sender,
                    receiver = transactions[i].receiver,
                    amount = transactions[i].amount
                };

                TransactionGrid.Items.Add(data);
                data = null;
            }
        }
        /// <summary>
        /// Every time the user selects an entry in the ListBox, the name of that item will be made into a usable string.
        /// After that it will be used to find the data of the selected user.
        /// </summary>
        private void UsersBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
           
            
            if (alreadyShown == false)
            {
                showUserDataLabels();
                alreadyShown = true;
            }

            if (UsersBox.SelectedItem != null)
            {
                string data = UsersBox.SelectedItem.ToString();
                string usableData = data.Substring(37);

                Console.WriteLine(usableData);

                Cryptobankservice.CryptoBankServiceSoapClient cssc = new Cryptobankservice.CryptoBankServiceSoapClient();
                Cryptobankservice.UserModel[] x = cssc.Finduser(usableData);

                statusData.Content = x[0].status;
                nameData.Content = x[0].name;
                emailData.Content = x[0].email;
                cityData.Content = x[0].city;
                accountnumberData.Content = x[0].accountnumber;
                balanceData.Content = x[0].balance;
            }
        }