Example #1
0
        private void bttRegister_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Get account from BL.
                bool isAccountExist = BLAccount.IsAccountExist(txtREmail.Text, txtRPword.Password);

                if (!isAccountExist)
                {
                    MessageBox.Show("Register Accepted");

                    // Get accountId form BL.
                    int accountId = BLAccount.SetAccount(txtREmail.Text, txtRPword.Password, txtFname.Text, txtLname.Text);

                    // AccountWindow initialization.
                    AccountWindow accountWindow = new AccountWindow(accountId);

                    accountWindow.Show();
                }
                else
                {
                    MessageBox.Show("Register Failed");
                }

                this.Close();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
Example #2
0
        private void AddItem_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Insert item.
                BLAccount.InsertItem(accountId, txtIname.Text);

                // Update items.
                lstItem.DataContext = BLAccount.GetItems(accountId);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
Example #3
0
        private void DelItem_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Get selected item. Item selectedItem = (Item)spItem.DataContext;

                // Delete item.
                BLAccount.DeleteItem(Convert.ToInt32(txtId.Text));

                // Update items.
                lstItem.DataContext = BLAccount.GetItems(accountId);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
Example #4
0
        public void InitializeAccountData(int accountId)
        {
            try
            {
                this.accountId = accountId;

                // 1. Get account from BL.
                spAccount.DataContext = BLAccount.GetAccount(accountId);

                // 2. Get items from BL.
                lstItem.DataContext = BLAccount.GetItems(accountId);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }