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 encounter strange behaviour working with DateTime and Timing (Core/Angular, 6.4.0).

I use ClockProviders.Utc (set in CoreModule.cs). I can choose a Timezone for Host, Tenant and user profile, so i think Timing is configured correctly.

Current situation:

  • I have a model that has two properties of type DateTime (FromDateTime & ToDateTime).
  • Host, Tenant and user profile are all set to use timezone "Standard [UTC]".
  • When I create a new entity everything is fine: values in client-side logging are correct, as well as values stored in database.
  • When I retrieve a list of entities all is fine as well: values are correct.
  • But, when I retrieve a single entity in order to edit it, or copy an item from the list to create a new one based on the original (both opened in a modal window) the values are off by one hour (which is the current timezone offset between UTC and "Europe/Vienna", UTC+1). Also, on server side the values are still correct (AppService.cs).
  • In both cases (list of entities and single entity) _isAMomentObject, _isUTC and _isValid of the moment objects are true. _offset is -0, but not sure what the consequences are, if any.

Am I doing something wrong here? Am I missing something? Please, help!

BTW, I will be away for two weeks - so it will propably take some time till i can check out your advise and answer to your comments.

UPDATE #1 I will recreate the components in a clean project, just to see if there are any configuration issues in my project.

UPDATE #2 Recreated components: values (list of entities and single entity) are the same, so that's working correct. And there might be an issue with my create/edit-component.

BTW: ngx-bootstrap/datepicker does not work with moment.js yet ([github: #4826](https://github.com/valor-software/ngx-bootstrap/issues/4826)). In DemoUiDateTimeComponent usage of ngx-bootstrap/datepicker is demonstrated to select a date / date-range using moment.Moment / moment.Moment[] as data-type. At the moment, this works for selecting a date only and it will not work when the value gets set via code (invalid date).

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)
    );
}

Please, help me: How do I implement sorting for multi-lingual entities? I have a simple entity that implements IMultiLingualEntity. I just recognized sorting doesn't work (using GetAllPagedSortedAndFilteredInputDto). I tried playing around with pSortableColumn-value but can't figure it out. Is it even possible this way?

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 : )

Showing 171 to 180 of 224 entries