コード例 #1
0
 /// <summary>
 /// Sends request to server to add cash to current calling client object.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 /// <remarks>Sends request to server and on response in <see cref="Client"/> class updates label on form.</remarks>
 private void ButtonAddCash_Click(object sender, EventArgs e)
 {
     using (FormAddCash formAddCash = new FormAddCash())             //Form used to add cash to user account.
     {
         DialogResult dialogResult = formAddCash.ShowDialog();       //show form as dialog to get user input.
         if (dialogResult == DialogResult.Cancel)
         {
             formAddCash.Close();
         }
         else if (dialogResult == DialogResult.OK)
         {
             decimal moneyTransfer = formAddCash.NumericUpDown.Value;
             currentClient.AddCashToMyAccountOnServer(moneyTransfer);
             currentClient.UpdateMyLabelOnTheForm();
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Allows administrator to add cash to his account.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonAddCash_Click(object sender, EventArgs e)
        {
            using (FormAddCash formAddCash = new FormAddCash())
            {
                DialogResult dialogResult = formAddCash.ShowDialog();

                if (dialogResult == DialogResult.Cancel)
                {
                    formAddCash.Close();
                }
                else if (dialogResult == DialogResult.OK)
                {
                    decimal moneyTransfer = formAddCash.NumericUpDown.Value;

                    administrator.AddCashToMyAccount(moneyTransfer);
                    UpdateCurrentAccountBalanceLabel();
                }
            }
        }