Ejemplo n.º 1
0
        // shows the form in edit modus
        // links:
        //  docLink: http://sql2x.org/documentationLink/49afd26c-4f21-4992-967b-be190eacef77
        public void ShowAsEdit(System.Guid financialPaymentCardId)
        {
            var service = new CrudeFinancialPaymentCardServiceClient();

            _isNew = false;
            try {
                _contract = service.FetchByFinancialPaymentCardId(financialPaymentCardId);
                financialCardTypeRefCombo.Text          = _contract.FinancialCardTypeRcd != null ? _contract.FinancialCardTypeRcd : String.Empty;
                textBoxNameOnCard.Text                  = _contract.NameOnCard;
                textBoxCardNumber.Text                  = _contract.CardNumber;
                maskedTextBoxCardVerificationValue.Text = _contract.CardVerificationValue.ToString();
                textBoxAddressVerificationCode.Text     = _contract.AddressVerificationCode;
                maskedTextBoxIssuedYear.Text            = _contract.IssuedYear.ToString();
                maskedTextBoxIssuedMonth.Text           = _contract.IssuedMonth.ToString();
                maskedTextBoxExpiryYear.Text            = _contract.ExpiryYear.ToString();
                maskedTextBoxExpiryMonth.Text           = _contract.ExpiryMonth.ToString();
                maskedTextBoxAmount.Text                = _contract.Amount.ToString();
                financialCurrencyPicker.SelectedValue   = _contract.FinancialCurrencyId;
                userPicker.SelectedValue                = _contract.UserId;
                _contract.DateTime          = DateTime.UtcNow;
                dateTimePickerDateTime.Text = _contract.DateTime.ToString();

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            } finally {
                service.Close();
            }
        }
Ejemplo n.º 2
0
        void FetchCardDetails(
            System.Guid financialPaymentCardId
            )
        {
            var service = new CrudeFinancialPaymentCardServiceClient();

            try {
                CrudeFinancialPaymentCardContract contract = service.FetchByFinancialPaymentCardId(financialPaymentCardId);
                _financialCurrencyId = contract.FinancialCurrencyId;

                maskedTextBoxPaymentAmount.Text = contract.Amount.ToString();
                financialCurrencyPickerPayment.SelectedValue = contract.FinancialCurrencyId;

                financialCardTypeRefCombo.Text          = contract.FinancialCardTypeRcd != null ? contract.FinancialCardTypeRcd : String.Empty;
                textBoxNameOnCard.Text                  = contract.NameOnCard;
                textBoxCardNumber.Text                  = contract.CardNumber;
                maskedTextBoxCardVerificationValue.Text = contract.CardVerificationValue.ToString();
                textBoxAddressVerificationCode.Text     = contract.AddressVerificationCode;
                maskedTextBoxIssuedYear.Text            = contract.IssuedYear.ToString();
                maskedTextBoxIssuedMonth.Text           = contract.IssuedMonth.ToString();
                maskedTextBoxExpiryYear.Text            = contract.ExpiryYear.ToString();
                maskedTextBoxExpiryMonth.Text           = contract.ExpiryMonth.ToString();
            } catch (Exception ex) {
                MessageBox.Show(ex.Message);
            } finally {
                service.Close();
            }
        }
Ejemplo n.º 3
0
        public ActionResult CrudeFinancialPaymentCardCreate([Bind()] CrudeFinancialPaymentCardContract contract)
        {
            if (ModelState.IsValid)
            {
                new CrudeFinancialPaymentCardServiceClient().Insert(contract);

                return(RedirectToAction("CrudeFinancialPaymentCardIndex"));
            }

            return(View(
                       "~/Views/Crude/Financial/CrudeFinancialPaymentCard/CrudeFinancialPaymentCardCreate.cshtml",
                       contract
                       ));
        }
Ejemplo n.º 4
0
 // shows the form with default values for comboboxes and pickers
 // links:
 //  docLink: http://sql2x.org/documentationLink/e04d0806-55ef-41cc-8669-acf0ddd850c7
 public void ShowAsAdd()
 {
     try {
         _contract = new CrudeFinancialPaymentCardContract();
         _isNew    = true;
         Show();
     } catch (Exception ex) {
         if (ex == null)
         {
         }
         else
         {
             System.Diagnostics.Debugger.Break();
         }
     }
 }
Ejemplo n.º 5
0
        public ActionResult CrudeFinancialPaymentCardEdit([Bind()] CrudeFinancialPaymentCardContract contract)
        {
            if (ModelState.IsValid)
            {
                contract.DateTime = DateTime.UtcNow;

                new CrudeFinancialPaymentCardServiceClient().Update(contract);

                return(RedirectToAction("CrudeFinancialPaymentCardIndex"));
            }

            return(View(
                       "~/Views/Crude/Financial/CrudeFinancialPaymentCard/CrudeFinancialPaymentCardEdit.cshtml",
                       contract
                       ));
        }
Ejemplo n.º 6
0
        // shows the form with default values for comboboxes and pickers
        // links:
        //  docLink: http://sql2x.org/documentationLink/f5685d96-a0bb-4f7b-beaa-b3d578c7cf28
        public void ShowAsAdd(string financialCardTypeRcd, string nameOnCard, string cardNumber, int cardVerificationValue, string addressVerificationCode, int issuedYear, int issuedMonth, int expiryYear, int expiryMonth, decimal amount, System.Guid financialCurrencyId, System.Guid userId)
        {
            try {
                _contract = new CrudeFinancialPaymentCardContract();
                _isNew    = true;
                _contract.FinancialCardTypeRcd          = financialCardTypeRcd;
                financialCardTypeRefCombo.Text          = _contract.FinancialCardTypeRcd != null ? _contract.FinancialCardTypeRcd : String.Empty;
                _contract.NameOnCard                    = nameOnCard;
                textBoxNameOnCard.Text                  = _contract.NameOnCard;
                _contract.CardNumber                    = cardNumber;
                textBoxCardNumber.Text                  = _contract.CardNumber;
                _contract.CardVerificationValue         = cardVerificationValue;
                maskedTextBoxCardVerificationValue.Text = _contract.CardVerificationValue.ToString();
                _contract.AddressVerificationCode       = addressVerificationCode;
                textBoxAddressVerificationCode.Text     = _contract.AddressVerificationCode;
                _contract.IssuedYear                    = issuedYear;
                maskedTextBoxIssuedYear.Text            = _contract.IssuedYear.ToString();
                _contract.IssuedMonth                   = issuedMonth;
                maskedTextBoxIssuedMonth.Text           = _contract.IssuedMonth.ToString();
                _contract.ExpiryYear                    = expiryYear;
                maskedTextBoxExpiryYear.Text            = _contract.ExpiryYear.ToString();
                _contract.ExpiryMonth                   = expiryMonth;
                maskedTextBoxExpiryMonth.Text           = _contract.ExpiryMonth.ToString();
                _contract.Amount                      = amount;
                maskedTextBoxAmount.Text              = _contract.Amount.ToString();
                _contract.FinancialCurrencyId         = financialCurrencyId;
                financialCurrencyPicker.SelectedValue = _contract.FinancialCurrencyId;
                _contract.UserId                      = userId;
                userPicker.SelectedValue              = userId;
                _contract.DateTime                    = DateTime.UtcNow;
                dateTimePickerDateTime.Text           = _contract.DateTime.ToString();

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            }
        }
Ejemplo n.º 7
0
        public ActionResult CrudeFinancialPaymentCardCreate(System.Guid?financialCurrencyId, System.Guid?userId)
        {
            var contract = new CrudeFinancialPaymentCardContract();

            if (financialCurrencyId != null)
            {
                contract.FinancialCurrencyId = (System.Guid)financialCurrencyId;
            }
            if (userId != null)
            {
                contract.UserId = (System.Guid)userId;
            }

            ViewBag.FinancialCardTypeRcd =
                new SelectList(new CrudeFinancialCardTypeRefServiceClient().FetchAll(),
                               "FinancialCardTypeRcd",
                               "FinancialCardTypeName",
                               contract.FinancialCardTypeRcd
                               );

            ViewBag.FinancialCurrencyId =
                new SelectList(new CrudeFinancialCurrencyServiceClient().FetchAll(),
                               "FinancialCurrencyId",
                               "FinancialCurrencyTypeName",
                               contract.FinancialCurrencyId
                               );

            if (userId == null)
            {
                contract.UserId = new System.Guid("{FFFFFFFF-5555-5555-5555-FFFFFFFFFFFF}");
            }

            ViewBag.DefaultUserName =
                new CrudeDefaultUserServiceClient().FetchByDefaultUserId(contract.UserId).DefaultUserName;

            contract.DateTime = DateTime.UtcNow;


            return(View(
                       "~/Views/Crude/Financial/CrudeFinancialPaymentCard/CrudeFinancialPaymentCardCreate.cshtml",
                       contract
                       ));
        }
Ejemplo n.º 8
0
        // shows by foreign keys
        // links:
        //  docLink: http://sql2x.org/documentationLink/f21e72c1-2d57-44c1-a9c1-1b80bad6a391
        public void ShowAsAddByFinancialCardType(string financialCardTypeRcd)
        {
            try {
                _contract                      = new CrudeFinancialPaymentCardContract();
                _isNew                         = true;
                _contract.DateTime             = DateTime.UtcNow;
                dateTimePickerDateTime.Text    = _contract.DateTime.ToString();
                _contract.FinancialCardTypeRcd = financialCardTypeRcd;
                financialCardTypeRefCombo.Text = _contract.FinancialCardTypeRcd != null ? _contract.FinancialCardTypeRcd : String.Empty;

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            }
        }
Ejemplo n.º 9
0
        // shows the form with default values for comboboxes and pickers
        // links:
        //  docLink: http://sql2x.org/documentationLink/599dcb45-f71b-4672-bb18-46975a4fe9b3
        public void ShowAsAddByRules(System.Guid userId)
        {
            try {
                _contract                   = new CrudeFinancialPaymentCardContract();
                _isNew                      = true;
                _contract.UserId            = userId;
                userPicker.SelectedValue    = _contract.UserId;
                _contract.DateTime          = DateTime.UtcNow;
                dateTimePickerDateTime.Text = _contract.DateTime.ToString();

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            }
        }
Ejemplo n.º 10
0
        bool PayWithCard()
        {
            var cardContract = new CrudeFinancialPaymentCardContract();

            // Financial Card Type
            cardContract.FinancialCardTypeRcd = financialCardTypeRefCombo.Text;
            if (string.IsNullOrEmpty(cardContract.FinancialCardTypeRcd))
            {
                financialCardTypeRefCombo.Focus();
                MessageBox.Show("Financial Card Type Missing");
                return(false);
            }

            // Name On Card
            cardContract.NameOnCard = textBoxNameOnCard.Text;
            if (string.IsNullOrEmpty(cardContract.NameOnCard))
            {
                textBoxNameOnCard.Focus();
                MessageBox.Show("Name On Card Missing");
                return(false);
            }

            // Card Number
            cardContract.CardNumber = textBoxCardNumber.Text;
            if (string.IsNullOrEmpty(cardContract.CardNumber))
            {
                textBoxCardNumber.Focus();
                MessageBox.Show("Card Number Missing");
                return(false);
            }

            // Card Verification Value
            { Int32 i; Int32.TryParse(maskedTextBoxCardVerificationValue.Text, out i); cardContract.CardVerificationValue = i; }

            if (cardContract.CardVerificationValue.Equals(0))
            {
                maskedTextBoxCardVerificationValue.Focus();
                MessageBox.Show("Card Verification Value Missing");
                return(false);
            }

            // Address Verification Code
            cardContract.AddressVerificationCode = textBoxAddressVerificationCode.Text;
            if (string.IsNullOrEmpty(cardContract.AddressVerificationCode))
            {
                textBoxAddressVerificationCode.Focus();
                MessageBox.Show("Address Verification Code Missing");
                return(false);
            }

            { Int32 i; Int32.TryParse(maskedTextBoxIssuedYear.Text, out i); cardContract.IssuedYear = i; }
            cardContract.IssuedMonth = maskedTextBoxIssuedMonth.Text == String.Empty ? 0 : Convert.ToInt32(maskedTextBoxIssuedMonth.Text);

            // Expiry Year
            cardContract.ExpiryYear = maskedTextBoxExpiryYear.Text == String.Empty ? 0 : Convert.ToInt32(maskedTextBoxExpiryYear.Text);
            if (cardContract.ExpiryYear.Equals(0))
            {
                maskedTextBoxExpiryYear.Focus();
                MessageBox.Show("Expiry Year Missing");
                return(false);
            }

            // Expiry Month
            cardContract.ExpiryMonth = maskedTextBoxExpiryMonth.Text == String.Empty ? 0 : Convert.ToInt32(maskedTextBoxExpiryMonth.Text);
            if (cardContract.ExpiryMonth.Equals(0))
            {
                maskedTextBoxExpiryMonth.Focus();
                MessageBox.Show("Expiry Month Missing");
                return(false);
            }

            cardContract.Amount = _paymentAmount;
            cardContract.FinancialCurrencyId = financialCurrencyPickerPayment.SelectedValue;

            new BookingServiceClient()
            .PaymentCardAdd(
                _bookingId,
                _paymentAmountInBookingCurrency,
                _roundingAmountInBookingCurrency,
                ( Guid )financialCurrencyPickerBookingBalance.SelectedValue,
                cardContract,
                _financialCostcentreId,
                _financialPaymentContract.UserId
                );

            return(true);
        }