Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "alexanderpilhar"

Thank you very much @ismcagdas!

Hi @instaemi, did you find a solution for this? If so, it would be great if you could post it here! I currently have the same need. Thanks!

I see. Well, thank you for your answer @ismcagdas! I will go with disabling sorting on that column, too (since there is no request for that, yet).

BTW: Sorting works fine for other non-translated columns/properties.

Hi @ismcagdas

Here's the code.

public async Task<IPagedResult<CategoryBackendDto>> GetAllPagedSortedAndFilteredAsync(GetAllPagedSortedAndFilteredInputDto input)
{
    var query = _repCategories
        .GetAllIncluding(e => e.Translations)
        .WhereIf(
            input.IsActive != null,
            e => e.IsActive == input.IsActive
        );

    var cntEntities = await query
            .CountAsync();

    var lstEntities = await query
        .OrderBy(input.Sorting)
        .PageBy(input)
        .ToListAsync();

    return new PagedResultDto<CategoryBackendDto>(
        cntEntities,
        ObjectMapper.Map<List<CategoryBackendDto>>(lstEntities)
    );
}

Hi everybody!

I'm trying to do the same as @kythor but having troubles sorting out an JSON.parse-error when using AbpHttpInterceptor. ERROR SyntaxError: "JSON.parse: unexpected character at line 1 column 1 of the JSON data"

Here's what I did so far:

  • Created a new angular project using angular-cli
  • Added relevant npm-packages (abp-ng2-module, abp-web-resources, nswag, moment + types, moment-timezone+types)
  • Upgraded all npm-packages to latest version
  • Created service-proxies.ts using refresh.bat
  • Created service-proxy.module.ts
  • Added abp.js to assets
  • Added abp.js to scripts in angular.json
  • Created typings.d.ts for abp.js
  • Added paths to tsconfig.json

My service-proxy.module.ts looks like this:

@NgModule({
    providers: [
        { provide: HTTP_INTERCEPTORS, useClass: AbpHttpInterceptor, multi: true },

        ApiServiceProxies.MyServiceProxy
    ]
})
export class ServiceProxyModule { }

My app.module.ts looks like this:

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    HttpClientJsonpModule,
    ServiceProxyModule
  ],
  providers: [
    { provide: HTTP_INTERCEPTORS, useClass: AbpHttpInterceptor, multi: true },
    { provide: API_BASE_URL, useFactory: getRemoteServiceBaseUrl },
    AbpHttpConfiguration,
    MessageService,
    LogService,
    MyServiceProxy
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

If I comment out the interceptor-parts, I get following error:

ERROR Error: "An unexpected server error occurred."

The error seems to pop up when MyServiceProxy tries to send the request (service-proxies.ts):

return this.http.request()...

BTW: I do not need any sort of authentication or authorization in this case and there is no [AbpAuthorize] on any of the methods of this service. Calling the service using Postman works well. Also, using HttpClient (@angular/common/http) get-request instead of service-proxy works!

Right now, I don't really know how to solve this problem from here. I would be so happy if you guys could help me with this one!

EDIT 1 baseUrl does not get set in service-proxies.ts.

EDIT 2 Finally, I was able to solve this problem : ) Learning quite a lot about the angular-client's implementation, too : )

What about this in entity class:

[NotMapped]
public int TotalField { get { return FieldOne * FieldTwo; } }

now you can have a DTO as usual:

public int TotalField { get; set; }

@mdframe - good to hear it was useful to you : )

Yes, it is to group them, sort them and to make orientation easier in resource-files (no need to CTRL + F all the time). Also, it allows for more flexibility if needed (e.g. it's possible to set different values for properties of entities that share the same name: Entity1.PropertyName1 = "Value1" and Entity2.PropertyName1 = "Value2").

I didn't touch the translations that come with ASPNETZERO - that's because I want to keep upgrading as easy as possible. I use my own scheme only for the stuff I add myself.

Note, aspnetboilerplate suggests a different way of working with resource-files: https://aspnetboilerplate.com/Pages/Documents/Localization#best-practices

Thankfully, with aspnetboilerplate and ASPNETZERO you can do whatever makes more sense to you : )

@mdframe sure thing - here's the complete HTML of my modal component:

<div bsModal #modalCategoryCreateOrEdit="bs-modal" (onShown)="onShown()" class="modal fade" tabindex="-1" role="dialog"
    aria-labelledby="modal" aria-hidden="true" [config]="{backdrop: 'static'}">

    <div class="modal-dialog modal-lg">
        <div class="modal-content">

            <form *ngIf="active" role="form" #formCategoryCreateOrEdit="ngForm" novalidate (ngSubmit)="save()">

                <div class="modal-header">
                    <h4 class="modal-title">
                        <span>{{modalTitle}}</span>
                    </h4>
                    <button type="button" class="close" style="cursor: pointer; line-height: normal;" (click)="close()">
                        <span class="fas fa-times" aria-hidden="true"></span>
                        <span class="sr-only">{{l('Shared.Action.Close')}}</span>
                    </button>
                </div>

                <div class="modal-body">

                    <!-- Add new Translation -->
                    <div class="form-group">
                        <button type="button" class="btn btn-default" (click)="createTranslation()">
                            <span class="fas fa-plus" aria-hidden="true"></span>
                            {{l("Shared.Action.Add")}}
                        </button>
                    </div>

                    <!-- Translations -->
                    <!--<Primeng-TurboTable-Start>-->
                    <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">

                        <p-table #tableCategoryTranslations (onLazyLoad)="getTranslations($event)" [value]="primengTableHelper.records"
                            rows="{{primengTableHelper.defaultRecordsCountPerPage}}" [paginator]="false" [lazy]="true"
                            [responsive]="primengTableHelper.isResponsive">

                            <ng-template pTemplate="header">
                                <tr>
                                    <th style="width: 135px">
                                        {{l('Shared.Actions')}}
                                    </th>
                                    <th>
                                        {{l('Translation.Name')}}
                                    </th>
                                    <th>
                                        {{l('Translation.Language')}}
                                    </th>
                                </tr>
                            </ng-template>

                            <ng-template pTemplate="body" let-record="$implicit">
                                <tr>
                                    <td style="width: 135px">
                                        <div class="btn-group dropdown" dropdown container="body">
                                            <a dropdownToggle href="javascript:;" class="dropdown-toggle btn btn-sm btn-primary">
                                                <span class="fas fa-cog" aria-hidden="true"></span>
                                                {{l("Shared.Actions")}}
                                            </a>
                                            <ul style="z-index: 2000" class="dropdown-menu" *dropdownMenu>
                                                <li>
                                                    <a *ngIf="editTranslationCanExecute()" href="javascript:;" (click)="editTranslation(record)">
                                                        <span class="fas fa-edit" aria-hidden="true"></span>
                                                        {{l("Shared.Action.Edit")}}
                                                    </a>
                                                </li>
                                                <li>
                                                    <a *ngIf="deleteTranslationCanExecute()" href="javascript:;"
                                                        (click)="deleteTranslation(record)">
                                                        <span class="fas fa-trash" aria-hidden="true"></span>
                                                        {{l("Shared.Action.Delete")}}
                                                    </a>
                                                </li>
                                            </ul>
                                        </div>
                                    </td>
                                    <td>
                                        {{record.name}}
                                    </td>
                                    <td>
                                        {{record.language | languageByISO: cultures}}
                                    </td>
                                </tr>
                            </ng-template>

                        </p-table>

                        <div class="primeng-no-data" *ngIf="primengTableHelper.totalRecordsCount == 0">
                            {{l('NoData')}}
                        </div>

                        <div class="primeng-paging-container">
                            <p-paginator rows="{{primengTableHelper.defaultRecordsCountPerPage}}"
                                #paginatorCategoryTranslations (onPageChange)="getTranslations($event)" [totalRecords]="primengTableHelper.totalRecordsCount"
                                [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">
                            </p-paginator>
                            <span class="total-records-count">
                                {{l('TotalRecordsCount', primengTableHelper.totalRecordsCount)}}
                            </span>
                        </div>

                    </div>
                    <!--<Primeng-TurboTable-End>-->

                </div>

                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-default" (click)="close()">
                        {{l("Shared.Action.Cancel")}}
                    </button>

                    <button type="submit" class="btn btn-primary blue" [disabled]="!formCategoryCreateOrEdit.form.valid"
                        [buttonBusy]="saving" [busyText]="l('SavingWithThreeDot')">
                        <span class="fas fa-save" aria-hidden="true"></span>
                        {{l("Shared.Action.Save")}}
                    </button>
                </div>

            </form>

        </div>
    </div>

    <modal-category-translation-create-or-edit #modalCategoryTranslationCreateOrEdit>
    </modal-category-translation-create-or-edit>

</div>

Hope it's useful somehow!

@mdframe good find : )

I managed to get what I wanted by simply adding an inline-style to the &lt;ul&gt;:

<ul style="z-index:2000" class="dropdown-menu" *dropdownMenu>

I'm not a big fan of inline-styles but as they can be found in some other places in ASPNETZERO as well, it will do.

Thanks for your help @mdframe : )

Showing 131 to 140 of 173 entries