// 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();
            }
        }
Beispiel #2
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
        }