Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtUserName.Text))
            {
                MessageBox.Show("Kullanıcı adı boş geçilemez.");
                return;
            }
            Payment payment = new Payment();

            try
            {
                payment.Fee = int.Parse(txtFee.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("Ücret düzgün formatta değil.");
            }
            payment.UserID        = _userController.GetUserIDByName(txtUserName.Text);
            payment.ReasonID      = _prController.GetReasonIDByName(cmbReason.SelectedItem.ToString());
            payment.PaymentTypeID = _ptController.GetTypeIDByName(cmbType.SelectedItem.ToString());
            try
            {
                bool result = _paymentController.Add(payment);
                if (result)
                {
                    MessageBox.Show("Kayıt başarılı.");
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(txtCardNumber.Text) & !String.IsNullOrWhiteSpace(txtCardPassword.Text))
            {
                Payment pay = new Payment()
                {
                    UserID = user.UserID
                };

                if (rdButtonCash.Checked == true)
                {
                    pay.PaymentTypeID = 2;
                    pay.Price         = numUDCash.Value;
                }
                else
                {
                    pay.PaymentTypeID = 1;
                    pay.Price         = numUDCredit.Value;
                }
                try
                {
                    _paymentController.Add(pay);
                    user.RoleID = 2;
                    _userController.Update(user);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                MessageBox.Show("Thanks for your payment.");

                frmUser.ChangeRole();

                this.Close();
            }
            else
            {
                MessageBox.Show("Ödeme Bilgileri Boş Geçilemez.");
            }
        }