Beispiel #1
0
 private void OnAddNewRow()
 {
     _editContext           = new PayTypeModel();
     _editContext.TenantId  = TenantId;
     _editContext.IsEnabled = true;
     _messages = "";
     grid.CancelRowEdit();
     grid.StartRowEdit(null);
 }
Beispiel #2
0
        async Task HandleValidSubmitAsync()
        {
            if (EditContext.Name != null && !string.IsNullOrEmpty(EditContext.Name))
            {
                EditContext.Name = EditContext.Name.Trim();

                if (EditContext.Name.Length > 50 || string.IsNullOrEmpty(EditContext.Name))
                {
                    return;
                }

                var result = EditContext.Id == 0
            ? await _apiWrapper.Tenants.CreateAsync(EditContext)
            : await _apiWrapper.Tenants.UpdateAsync(EditContext);

                if (result.IsSuccess && result.Error == null)
                {
                    if (result.Data != null)
                    {
                        await grid.CancelRowEdit();

                        EditContext = null;

                        await SearchAsync();
                    }
                    else
                    {
                        message = _localizer[result.Error.Message];
                        _toastAppService.ShowWarning(message);
                    }
                }
                else
                {
                    message = _localizer[(result.Error.Message)];
                    _toastAppService.ShowWarning(message);
                }
            }
        }
        async Task AddNewGetDetailRowRender()
        {
            //This is lameshit right here. This will fix duplicate validate message of editcontext for now. Delete this if wasm updated and fix this bug.
            await _jSRuntime.InvokeVoidAsync("deleteAnotationErrorMessage");

            _editContext = new ExchangeSettingModel();
            await InvokeAsync(StateHasChanged);

            _editContext.TenantId       = TenantId;
            _editContext.IsEnabled      = true;
            _heathStatusexchangeSetting = _editContext.HealthStatus != null ? (_editContext.HealthStatus == true ? _localizer[LangKey.TEST_PASS] : _localizer[LangKey.TEST_FAIL]) : "";
            EditContext = new EditContext(_editContext);
            var apiVersionsResult = await _apiWrapper.ExchangeSettings.GetAllExchangeVersionsAsync();

            if (apiVersionsResult.IsSuccess && apiVersionsResult.Error == null)
            {
                _exchangeVersionModels = apiVersionsResult.Data;
            }

            var apiLoginTypesResult = await _apiWrapper.ExchangeSettings.GetAllLoginTypesAsync();

            if (apiLoginTypesResult.IsSuccess && apiLoginTypesResult.Error == null)
            {
                _exchangeLoginTypeModels = apiLoginTypesResult.Data;
            }

            await _grid.CancelRowEdit();

            _messages = "";
            await _grid.StartRowEdit(null);

            await _jSRuntime.InvokeAsync <string>("focusEditor", "first-focus");

            _isPassShowed = true;
            messageTestConnectionError = "";
        }
Beispiel #4
0
 void OnCancelButtonClick()
 {
     _editContext = null;
     _grid.CancelRowEdit();
 }