Example #1
0
        /// <summary>
        /// delete curretn account
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (comboBoxResults.SelectedIndex < 0)
            {
                return;
            }


            AccountInformation account = getTextBoxInfo();

            disableTextBox();

            if (account == null)
            {
                MessageBox.Show("Account information is not currect.");
                return;
            }
            int row = _service.deleteData(account.GetType().Name, account.accountId.GetType().Name, account.accountId);

            //success to delete
            if (row > 0)
            {
                _accountList.Remove(account);
                comboBoxResults.Items.RemoveAt(comboBoxResults.SelectedIndex);
                comboBoxResults.SelectedIndex = 0;
            }
            //failed to delete
            else
            {
                MessageBox.Show("Failed to delete current account.");
                return;
            }
        }
Example #2
0
        /// <summary>
        /// form load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Accounts_Load(object sender, EventArgs e)
        {
            var memInfo = _account.GetType().GetProperties();

            foreach (var mem in memInfo)
            {
                comboBoxTableCol.Items.Add(mem.Name);
            }
            comboBoxTableCol.SelectedIndex = 0;
        }