Exemplo n.º 1
0
        private void btn_transferToUser2_Click(object sender, EventArgs e)
        {
            if (tb_moneyAmount2.Text == "" || tb_recCardNumber.Text == "")
            {
                MessageBox.Show("Заполните все поля");
                return;
            }

            AccountOperations op = new AccountOperations();

            decimal moneyAmount    = Convert.ToDecimal(tb_moneyAmount2.Text, CultureInfo.InvariantCulture);
            string  recieverCardId = tb_recCardNumber.Text;

            try
            {
                op.TransferMoneyFromCardToCard(client, cardId, long.Parse(recieverCardId), moneyAmount);
                MessageBox.Show("Средства успешно переведены");

                cardRecordId = BankAccountManagement.GetUserCardId(cardId);

                DateTime today     = DateTime.Now;
                DateTime todayDate = DateTime.Today;

                string transactionType = "Перевод средств с карты";
                string time            = today.ToString("HH:mm:ss");

                // Записываем в архив
                OperationsRecorder.RecordCardOperation
                (
                    cardRecordId,
                    todayDate.ToString("dd/MM/yyyy"),
                    time,
                    transactionType,
                    Convert.ToDecimal(tb_moneyAmount2.Text, CultureInfo.InvariantCulture)
                );
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
Exemplo n.º 2
0
        private void btn_transferSomewhere_Click(object sender, EventArgs e)
        {
            if (tb_moneyAmount3.Text == "" || tb_transferDestination.Text == "")
            {
                MessageBox.Show("Заполните все поля");
                return;
            }

            AccountOperations op = new AccountOperations();

            decimal moneyAmount = Convert.ToDecimal(tb_moneyAmount3.Text, CultureInfo.InvariantCulture);

            try
            {
                op.TransferMoneySomeWhereFromCard(client, cardId, moneyAmount);
                MessageBox.Show("Средства успешно переведены");

                cardRecordId = BankAccountManagement.GetUserCardId(cardId);

                DateTime today     = DateTime.Now;
                DateTime todayDate = DateTime.Today;

                string transactionType = "Перевод средств с карты";
                string time            = today.ToString("HH:mm:ss");

                // Записываем в архив
                OperationsRecorder.RecordCardOperation
                (
                    cardRecordId,
                    todayDate.ToString("dd/MM/yyyy"),
                    time,
                    transactionType,
                    Convert.ToDecimal(tb_moneyAmount3.Text, CultureInfo.InvariantCulture)
                );
            }
            catch (Exception exc)
            {
                MessageBox.Show("Такой банковской карты нет в базе данных");
            }
        }