// saves the form // links: // docLink: http://sql2x.org/documentationLink/c9522930-91f8-4468-a936-8030bb2a6482 private void buttonSave_Click(object sender, EventArgs e) { var service = new CrudeFinancialCurrencyTypeRefServiceClient(); try { _contract.FinancialCurrencyTypeRcd = textBoxFinancialCurrencyType.Text; _contract.FinancialCurrencyTypeCode = textBoxFinancialCurrencyTypeCode.Text; _contract.FinancialCurrencyTypeName = textBoxFinancialCurrencyTypeName.Text; _contract.DecimalCount = maskedTextBoxDecimalCount.Text == String.Empty ? 0 : Convert.ToInt32(maskedTextBoxDecimalCount.Text); if (_isNew) { service.Insert(_contract); } else { service.Update(_contract); } } catch (Exception ex) { if (ex == null) { } else { System.Diagnostics.Debugger.Break(); } } finally { service.Close(); } Close(); }
// shows the form in edit modus // links: // docLink: http://sql2x.org/documentationLink/49afd26c-4f21-4992-967b-be190eacef77 public void ShowAsEdit(string financialCurrencyTypeRcd, System.Guid userId) { var service = new CrudeFinancialCurrencyTypeRefServiceClient(); _isNew = false; try { _contract = service.FetchByFinancialCurrencyTypeRcd(financialCurrencyTypeRcd); textBoxFinancialCurrencyType.Text = _contract.FinancialCurrencyTypeRcd; textBoxFinancialCurrencyTypeCode.Text = _contract.FinancialCurrencyTypeCode; textBoxFinancialCurrencyTypeName.Text = _contract.FinancialCurrencyTypeName; maskedTextBoxDecimalCount.Text = _contract.DecimalCount.ToString(); _contract.UserId = 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(); } }
// fetch all rows from the SOAP layer and populate the ComboBox with it // links: // docLink: http://sql2x.org/documentationLink/4ccfdfd8-9986-4cfe-8743-e0bcde887284 public void PopulateCombo() { if (!DesignMode && cboRef.DataSource == null) { CrudeFinancialCurrencyTypeRefServiceClient financialCurrencyTypeRef = null; try { financialCurrencyTypeRef = new CrudeFinancialCurrencyTypeRefServiceClient(); List <CrudeFinancialCurrencyTypeRefContract> contracts = financialCurrencyTypeRef.FetchAll(); cboRef.DataSource = contracts; cboRef.DisplayMember = "FinancialCurrencyTypeName"; cboRef.ValueMember = "FinancialCurrencyTypeRcd"; } catch (Exception ex) { if (ex != null) { } } finally { if (financialCurrencyTypeRef != null) { financialCurrencyTypeRef.Close(); } } } }
// refresh the grid // links: // docLink: http://sql2x.org/documentationLink/a90065e7-8ace-4de7-9367-d4653a7c637f public void RefreshCrudeFinancialCurrencyTypeRef() { var financialCurrencyTypeRef = new CrudeFinancialCurrencyTypeRefServiceClient(); try { var bindingSource = new BindingSource(); bindingSource.DataSource = financialCurrencyTypeRef.FetchWithFilter( textBoxFinancialCurrencyType.Text , textBoxFinancialCurrencyTypeCode.Text , textBoxFinancialCurrencyTypeName.Text , maskedTextBoxDecimalCount.Text == String.Empty ? 0 : Convert.ToInt32(maskedTextBoxDecimalCount.Text) , Guid.Empty , DateTime.MinValue ); dataGridViewCrudeFinancialCurrencyTypeRef.AutoGenerateColumns = false; dataGridViewCrudeFinancialCurrencyTypeRef.DataSource = bindingSource; dataGridViewCrudeFinancialCurrencyTypeRef.AutoResizeColumns(); dataGridViewCrudeFinancialCurrencyTypeRef.Refresh(); } catch (Exception ex) { if (ex == null) { } else { System.Diagnostics.Debugger.Break(); } } finally { financialCurrencyTypeRef.Close(); } }
public ActionResult CrudeFinancialCurrencyTypeRefEdit( System.String financialCurrencyTypeRcd ) { CrudeFinancialCurrencyTypeRefContract contract = new CrudeFinancialCurrencyTypeRefServiceClient().FetchByFinancialCurrencyTypeRcd(financialCurrencyTypeRcd); return(View( "~/Views/Crude/Financial/CrudeFinancialCurrencyTypeRef/CrudeFinancialCurrencyTypeRefEdit.cshtml", contract )); }
BookingFinancialPaymentContract BookingFinancialPaymentsNew( Guid bookingId, string financialPaymentTypeRcd, Guid?financialPaymentId, Guid?financialCurrencyId, Guid?financialVoucherId ) { // fix null's if (financialPaymentId == null) { financialPaymentId = Guid.Empty; } if (financialCurrencyId == null) { financialCurrencyId = Guid.Empty; } if (financialVoucherId == null) { financialVoucherId = Guid.Empty; } // fetch booking data var bookingFinancialPayment = new BookingFinancialPaymentContract( bookingId, Logging.UserId(User.Identity, ViewBag) ); // booking bookingFinancialPayment.BookingId = bookingId; bookingFinancialPayment.BookingBalanceFinancialCurrencyId = bookingFinancialPayment.BookingContract.Booking.FinancialCurrencyId; ViewBag.BookingBalanceFinancialCurrencyName = new CrudeFinancialCurrencyServiceClient().FetchByFinancialCurrencyId( bookingFinancialPayment.BookingBalanceFinancialCurrencyId ).FinancialCurrencyTypeName; // new payment if (financialPaymentId == Guid.Empty) { // get booking balance bookingFinancialPayment.BookingBalanceAmount = new BookingServiceClient().BookingFinancialBalance( bookingId); if (financialCurrencyId != Guid.Empty) { // payment in new(selected) currency bookingFinancialPayment.PaymentFinancialCurrencyId = ( Guid )financialCurrencyId; CrudeFinancialCurrencyContract currency = new CrudeFinancialCurrencyServiceClient().FetchByFinancialCurrencyId( bookingFinancialPayment.PaymentFinancialCurrencyId); CrudeFinancialCurrencyTypeRefContract paymentCurrency = new CrudeFinancialCurrencyTypeRefServiceClient().FetchByFinancialCurrencyTypeRcd( currency.FinancialCurrencyAgainstFinancialCurrencyTypeRcd); ViewBag.PaymentFinancialCurrencyName = paymentCurrency.FinancialCurrencyTypeName; bookingFinancialPayment.PaymentAmount = bookingFinancialPayment.BookingBalanceAmount * currency.EqualsAmount; bookingFinancialPayment.PaymentBookingCurrencyAmount = bookingFinancialPayment.BookingBalanceAmount; } else { // payment in booking currency bookingFinancialPayment.PaymentFinancialCurrencyId = bookingFinancialPayment.BookingContract.Booking.FinancialCurrencyId; bookingFinancialPayment.PaymentAmount = bookingFinancialPayment.BookingBalanceAmount; bookingFinancialPayment.PaymentBookingCurrencyAmount = bookingFinancialPayment.BookingBalanceAmount; ViewBag.PaymentFinancialCurrencyName = new CrudeFinancialCurrencyServiceClient().FetchByFinancialCurrencyId( bookingFinancialPayment.PaymentFinancialCurrencyId ).FinancialCurrencyTypeName; } bookingFinancialPayment.PaymentFinancialCostcentreId = bookingFinancialPayment.BookingContract.Booking.FinancialCostcentreId; } // payments bookingFinancialPayment.Payments = new BookingSearchService().BookingFinancialPayments(bookingId); bookingFinancialPayment.PaymentFinancialPaymentTypeRcd = financialPaymentTypeRcd; // get previous payment ( for viewing ) if (financialPaymentId != Guid.Empty) { bookingFinancialPayment.PaymentContract = new CrudeFinancialPaymentServiceClient().FetchByFinancialPaymentId( ( Guid )financialPaymentId); } else { // get available currencies bookingFinancialPayment.PaymentSelectedFinancialCurrencyId = bookingFinancialPayment.PaymentFinancialCurrencyId; ViewBag.PaymentSelectedFinancialCurrencyId = new SelectList(new FinancialSearchService(). GetAvailableCurrencies( bookingFinancialPayment.BookingBalanceFinancialCurrencyId, DateTime.UtcNow ), "FinancialCurrencyId", "FinancialCurrencyTypeName", bookingFinancialPayment.PaymentSelectedFinancialCurrencyId ); } // payment type specific if (financialPaymentTypeRcd.Contains(FinancialPaymentTypeRef.Card)) { // card if (financialPaymentId != Guid.Empty) { bookingFinancialPayment.CardContract = new CrudeFinancialPaymentCardServiceClient().FetchByFinancialPaymentCardId( bookingFinancialPayment.PaymentContract.FinancialPaymentCardId); } ViewBag.FinancialCardTypeRcd = new SelectList(new CrudeFinancialCardTypeRefServiceClient().FetchAll(), "FinancialCardTypeRcd", "FinancialCardTypeName", bookingFinancialPayment.FinancialCardTypeRcd); } else if (financialPaymentTypeRcd.Contains(FinancialPaymentTypeRef.Cash)) { // cash if (financialPaymentId != Guid.Empty) { bookingFinancialPayment.CashContract = new CrudeFinancialPaymentCashServiceClient().FetchByFinancialPaymentCashId( bookingFinancialPayment.PaymentContract.FinancialPaymentCashId); } } else if (financialPaymentTypeRcd.Contains(FinancialPaymentTypeRef.Bank)) { // bank if (financialPaymentId != Guid.Empty) { bookingFinancialPayment.BankContract = new CrudeFinancialPaymentBankServiceClient().FetchByFinancialPaymentBankId( bookingFinancialPayment.PaymentContract.FinancialPaymentBankId); } ViewBag.FinancialBankAccountNumberTypeRcd = new SelectList(new CrudeFinancialBankAccountNumberTypeRefServiceClient().FetchAll(), "FinancialBankAccountNumberTypeRcd", "FinancialBankAccountNumberTypeName", bookingFinancialPayment.FinancialBankAccountNumberTypeRcd); } else if (financialPaymentTypeRcd.Contains(FinancialPaymentTypeRef.Voucher)) { // voucher if (financialPaymentId == Guid.Empty) { bookingFinancialPayment.Vouchers = new FinancialSearchService().VoucherSearchWithRemainingAmount(DateTime.UtcNow); } } return(bookingFinancialPayment); }