예제 #1
0
        private void SetSelectedTransactionPartyBinder(TransactionPartyBinder value = null)
        {
            _selectedTransactionPartyBinder = value ??
                                              new TransactionPartyBinder()
            {
                Code        = "",
                Description = ""
            };

            codeTextBox.Text           = _selectedTransactionPartyBinder.Code;
            codeErrorLabel.Text        = "";
            descriptionTextBox.Text    = _selectedTransactionPartyBinder.Description;
            descriptionErrorLabel.Text = "";

            actionsUserControl.DeleteButtonVisible = _selectedTransactionPartyBinder.Id > 0;
        }
예제 #2
0
        private async void actionsUserControl_SaveButtonOnClick(object sender, EventArgs e)
        {
            if (IsFormDataValid())
            {
                TransactionPartyBinder bindedValue            = GetSelectedTransactionPartyBinder();
                TransactionPartyEntity transactionPartyEntity = new TransactionPartyEntity()
                {
                    Id              = bindedValue.Id,
                    Code            = codeTextBox.Text,
                    Description     = descriptionTextBox.Text,
                    CreatedDateTime = bindedValue.Id == 0 ? DateTime.Now : bindedValue.AddedDateTime
                };

                if (transactionPartyEntity.Id == 0)
                {
                    await _applicationService.InsertTransactionPartyAsync(transactionPartyEntity);
                }
                else
                {
                    await _applicationService.UpdateTransactionPartyAsync(transactionPartyEntity);
                }
                SetSelectedTransactionPartyBinder();
            }
        }