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

            _isNew = false;
            try {
                _contract = service.FetchByFinancialPaymentId(financialPaymentId);
                financialPaymentTypeRefCombo.Text = _contract.FinancialPaymentTypeRcd != null ? _contract.FinancialPaymentTypeRcd : String.Empty;
                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();
            }
        }
        // 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 financialPaymentTypeRcd, System.Guid financialPaymentCardId, System.Guid financialPaymentCashId, System.Guid financialPaymentVoucherId, System.Guid financialPaymentCouponId, System.Guid financialPaymentBankId, System.Guid financialPaymentAccountingId, System.Guid userId)
        {
            try {
                _contract = new CrudeFinancialPaymentContract();
                _isNew    = true;
                _contract.FinancialPaymentTypeRcd      = financialPaymentTypeRcd;
                financialPaymentTypeRefCombo.Text      = _contract.FinancialPaymentTypeRcd != null ? _contract.FinancialPaymentTypeRcd : String.Empty;
                _contract.FinancialPaymentCardId       = financialPaymentCardId;
                _contract.FinancialPaymentCashId       = financialPaymentCashId;
                _contract.FinancialPaymentVoucherId    = financialPaymentVoucherId;
                _contract.FinancialPaymentCouponId     = financialPaymentCouponId;
                _contract.FinancialPaymentBankId       = financialPaymentBankId;
                _contract.FinancialPaymentAccountingId = financialPaymentAccountingId;
                _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();
                }
            }
        }
Esempio n. 3
0
        public ActionResult CrudeFinancialPaymentCreate([Bind()] CrudeFinancialPaymentContract contract)
        {
            if (ModelState.IsValid)
            {
                new CrudeFinancialPaymentServiceClient().Insert(contract);

                return(RedirectToAction("CrudeFinancialPaymentIndex"));
            }

            return(View(
                       "~/Views/Crude/Financial/CrudeFinancialPayment/CrudeFinancialPaymentCreate.cshtml",
                       contract
                       ));
        }
Esempio n. 4
0
        public void ShowAsEdit(
            System.Guid financialPaymentId
            )
        {
            var service = new CrudeFinancialPaymentServiceClient();

            _isNew = true;  // to enable page switch

            try {
                _financialPaymentContract = service.FetchByFinancialPaymentId(financialPaymentId);

                // choose tab
                if (_financialPaymentContract.FinancialPaymentTypeRcd.Contains(FinancialPaymentTypeRef.Card))
                {
                    FetchCardDetails(_financialPaymentContract.FinancialPaymentCardId);
                    tabControl.SelectedTab = tabPageCard;
                }
                else if (_financialPaymentContract.FinancialPaymentTypeRcd.Contains(FinancialPaymentTypeRef.Cash))
                {
                    FetchCashDetails(_financialPaymentContract.FinancialPaymentCashId);
                    tabControl.SelectedTab = tabPageCash;
                }
                else if (_financialPaymentContract.FinancialPaymentTypeRcd.Contains(FinancialPaymentTypeRef.Voucher))
                {
                    tabControl.SelectedTab = tabPageVoucher;
                }
                else if (_financialPaymentContract.FinancialPaymentTypeRcd.Contains(FinancialPaymentTypeRef.Bank))
                {
                    FetchBankDetails(_financialPaymentContract.FinancialPaymentBankId);
                    tabControl.SelectedTab = tabPageBank;
                }
                else if (_financialPaymentContract.FinancialPaymentTypeRcd.Contains(FinancialPaymentTypeRef.Accounting))
                {
                    tabControl.SelectedTab = tabPageAccounting;
                }

                buttonPaymentAdd.Enabled = false;

                CashCalc();

                Show();
            } catch (Exception ex) {
                MessageBox.Show(ex.Message);
            } finally {
                service.Close();
            }
            _isNew = false;  // to disable page switch
        }
 // 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 CrudeFinancialPaymentContract();
         _isNew    = true;
         Show();
     } catch (Exception ex) {
         if (ex == null)
         {
         }
         else
         {
             System.Diagnostics.Debugger.Break();
         }
     }
 }
Esempio n. 6
0
        public ActionResult CrudeFinancialPaymentEdit([Bind()] CrudeFinancialPaymentContract contract)
        {
            if (ModelState.IsValid)
            {
                contract.DateTime = DateTime.UtcNow;

                new CrudeFinancialPaymentServiceClient().Update(contract);

                return(RedirectToAction("CrudeFinancialPaymentIndex"));
            }

            return(View(
                       "~/Views/Crude/Financial/CrudeFinancialPayment/CrudeFinancialPaymentEdit.cshtml",
                       contract
                       ));
        }
        // shows by foreign keys
        // links:
        //  docLink: http://sql2x.org/documentationLink/f21e72c1-2d57-44c1-a9c1-1b80bad6a391
        public void ShowAsAddByFinancialPaymentCoupon(System.Guid financialPaymentCouponId)
        {
            try {
                _contract                          = new CrudeFinancialPaymentContract();
                _isNew                             = true;
                _contract.DateTime                 = DateTime.UtcNow;
                dateTimePickerDateTime.Text        = _contract.DateTime.ToString();
                _contract.FinancialPaymentCouponId = financialPaymentCouponId;

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            }
        }
        // shows by foreign keys
        // links:
        //  docLink: http://sql2x.org/documentationLink/f21e72c1-2d57-44c1-a9c1-1b80bad6a391
        public void ShowAsAddByFinancialPaymentType(string financialPaymentTypeRcd)
        {
            try {
                _contract                         = new CrudeFinancialPaymentContract();
                _isNew                            = true;
                _contract.DateTime                = DateTime.UtcNow;
                dateTimePickerDateTime.Text       = _contract.DateTime.ToString();
                _contract.FinancialPaymentTypeRcd = financialPaymentTypeRcd;
                financialPaymentTypeRefCombo.Text = _contract.FinancialPaymentTypeRcd != null ? _contract.FinancialPaymentTypeRcd : String.Empty;

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            }
        }
        // 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 CrudeFinancialPaymentContract();
                _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();
                }
            }
        }
Esempio n. 10
0
        public void ShowAsAdd(
            Guid bookingId,
            Guid financialCurrencyId,
            Guid financialCostcentreId,
            Guid userId
            )
        {
            _financialPaymentContract = new CrudeFinancialPaymentContract();
            _isNew                             = true;
            _bookingId                         = bookingId;
            _financialCostcentreId             = financialCostcentreId;
            _financialCurrencyId               = financialCurrencyId;
            _financialPaymentContract.UserId   = userId;
            _financialPaymentContract.DateTime = DateTime.UtcNow;

            financialCurrencyPickerBookingBalance.SelectedValue  = financialCurrencyId;
            financialCurrencyPickerPayment.SelectedValue         = financialCurrencyId;
            financialCurrencyPickerBookingCurrency.SelectedValue = financialCurrencyId;

            // amount
            CrudeFinancialCurrencyContract currency =
                new CrudeFinancialCurrencyServiceClient().FetchByFinancialCurrencyId(
                    financialCurrencyPickerPayment.SelectedValue
                    );

            _balanceAmount                  = new BookingServiceClient().BookingFinancialBalance(bookingId);
            maskedTextBoxBalance.Text       = _balanceAmount.ToString("F4");
            maskedTextBoxPaymentAmount.Text = _balanceAmount.ToString("F" + currency.DecimalCount.ToString());
            maskedTextBoxPaymentAmount.Focus();

            _roundingAmountInBookingCurrency = _balanceAmount - Math.Round(_balanceAmount, currency.DecimalCount);
            maskedTextBoxRoundingAmount.Text = _roundingAmountInBookingCurrency.ToString();

            CashCalc();

            Show();
        }
Esempio n. 11
0
        public ActionResult CrudeFinancialPaymentCreate(System.Guid?financialPaymentCardId, System.Guid?financialPaymentCashId, System.Guid?financialPaymentVoucherId, System.Guid?financialPaymentCouponId, System.Guid?financialPaymentBankId, System.Guid?financialPaymentAccountingId, System.Guid?userId)
        {
            var contract = new CrudeFinancialPaymentContract();

            if (financialPaymentCardId != null)
            {
                contract.FinancialPaymentCardId = (System.Guid)financialPaymentCardId;
            }
            if (financialPaymentCashId != null)
            {
                contract.FinancialPaymentCashId = (System.Guid)financialPaymentCashId;
            }
            if (financialPaymentVoucherId != null)
            {
                contract.FinancialPaymentVoucherId = (System.Guid)financialPaymentVoucherId;
            }
            if (financialPaymentCouponId != null)
            {
                contract.FinancialPaymentCouponId = (System.Guid)financialPaymentCouponId;
            }
            if (financialPaymentBankId != null)
            {
                contract.FinancialPaymentBankId = (System.Guid)financialPaymentBankId;
            }
            if (financialPaymentAccountingId != null)
            {
                contract.FinancialPaymentAccountingId = (System.Guid)financialPaymentAccountingId;
            }
            if (userId != null)
            {
                contract.UserId = (System.Guid)userId;
            }

            ViewBag.FinancialPaymentTypeRcd =
                new SelectList(new CrudeFinancialPaymentTypeRefServiceClient().FetchAll(),
                               "FinancialPaymentTypeRcd",
                               "FinancialPaymentTypeName",
                               contract.FinancialPaymentTypeRcd
                               );

            ViewBag.FinancialPaymentCardId =
                new SelectList(new CrudeFinancialPaymentCardServiceClient().FetchAll(),
                               "FinancialPaymentCardId",
                               "NameOnCard",
                               contract.FinancialPaymentCardId
                               );

            ViewBag.FinancialPaymentBankId =
                new SelectList(new CrudeFinancialPaymentBankServiceClient().FetchAll(),
                               "FinancialPaymentBankId",
                               "BankName",
                               contract.FinancialPaymentBankId
                               );

            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/CrudeFinancialPayment/CrudeFinancialPaymentCreate.cshtml",
                       contract
                       ));
        }