Base solution for your next web application

Activities of "michaelhilgers"

Hi,

I have a little problem. I uploaded a file (excel) in the clientsite (Angular 2).

But If I try to send it to the server I get an 500 error.

I modified the code in the service-proxies.ts like this:

createOrUpdatePostListe(file: any): Observable<void> {
        let url_ = this.baseUrl + "/api/services/app/Post/CreateOrUpdatePostListe";

        let fileTest: File = file.target.files[0];
        let formData: FormData = new FormData();
        formData.append('uploadFile', fileTest, fileTest.name);

        //const content_ = JSON.stringify(formData);
        const content_ = formData;
        
        return this.http.request(url_, {
            body: content_,
            method: "post",
            headers: new Headers({
                "Content-Type": "multipart/form-data", 
                "Accept": "application/json; charset=UTF-8"
            })
        }).map((response) => {
            return this.processCreateOrUpdatePostListe(response);
        }).catch((response: any, caught: any) => {
            if (response instanceof Response) {
                try {
                    return Observable.of(this.processCreateOrUpdatePostListe(response));
                } catch (e) {
                    return <Observable<void>><any>Observable.throw(e);
                }
            } else
                return <Observable<void>><any>Observable.throw(response);
        });
    }

I changed the Content-Type from "application/json" to "multipart/form-data".

If I use the "JSON.stringify(formData)" to set the content, my function on Server was called but the parameter with the excel sheet was empty.

How can I get my excel sheet on serversite ?

Thanks !

Hi,

I have a lot of error messages in Visual Studio. All errors come from TypeScript Virtual Projects.

I would like using my project on a new installed pc. Visual Studio 2015 Update 3

I installed globaly: node v6.9.5 , npm 5.0.3 angular-cli:1.0.0-rc.0 For the project there is Node : v6.9.5, npm : 3.10.10, TypeScript : 2.0.8 angular cli : 1.0.0-rc.0 installed

package.json :

{
  "name": "abp-zero-template",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "ng": "ng",
    "start": "ng serve --host 0.0.0.0 --port 4200 --live-reload-port 4201",
    "hmr": "ng serve --host 0.0.0.0 --port 4200 --live-reload-port 4201 --hmr -e=hmr",
    "test": "ng test",
    "pree2e": "webdriver-manager update --standalone false --gecko false",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/cli": "1.0.0-rc.0",
    "@angular/common": "~2.4.0",
    "@angular/compiler": "~2.4.0",
    "@angular/core": "~2.4.0",
    "@angular/forms": "~2.4.0",
    "@angular/http": "~2.4.0",
    "@angular/platform-browser": "~2.4.0",
    "@angular/platform-browser-dynamic": "~2.4.0",
    "@angular/router": "~3.4.0",
    "@types/bootstrap": "^3.3.32",
    "@types/bootstrap-datepicker": "0.0.6",
    "@types/jquery": "^2.0.33",
    "@types/jquery.blockui": "0.0.27",
    "@types/jstree": "^3.3.32",
    "@types/lodash": "^4.14.37",
    "@types/moment": "^2.13.0",
    "@types/moment-timezone": "^0.2.32",
    "@types/node": "^6.0.42",
    "@types/select2": "^4.0.34",
    "@types/signalr": "^2.2.32",
    "@types/toastr": "^2.1.32",
    "abp-ng2-module": "^0.2.1",
    "abp-web-resources": "^1.3.0",
    "block-ui": "^2.70.1",
    "bootstrap": "^3.3.7",
    "bootstrap-colorpicker": "^2.5.1",
    "bootstrap-datepicker": "^1.6.4",
    "bootstrap-daterangepicker": "^2.1.24",
    "bootstrap-select": "^1.11.2",
    "bootstrap-switch": "^3.3.2",
    "core-js": "^2.4.1",
    "famfamfam-flags": "^1.0.0",
    "font-awesome": "^4.6.3",
    "jquery": "3.1.1",
    "jquery-migrate": "^3.0.0",
    "jquery-slimscroll": "^1.3.8",
    "jquery-sparkline": "^2.4.0",
    "jquery.uniform": "^4.0.1",
    "jqueryui": "^1.11.1",
    "js-cookie": "^2.1.3",
    "jstree": "^3.3.2",
    "jtable": "^2.4.1",
    "localforage": "^1.4.3",
    "lodash": "^4.16.4",
    "moment": "^2.15.1",
    "moment-timezone": "^0.5.7",
    "morris.js": "^0.5.0",
    "ng2-bootstrap": "^1.1.16-11",
    "ng2-file-upload": "^1.1.4-2",
    "ng2-recaptcha": "^1.4.0",
    "raphael": "^2.2.7",
    "rtl-detect": "^1.0.0",
    "rxjs": "^5.0.1",
    "select2": "^4.0.3",
    "select2-bootstrap-theme": "^0.1.0-beta.10",
    "signalr": "^2.2.1",
    "simple-line-icons": "^2.4.1",
    "spin.js": "^2.3.2",
    "sweetalert": "^1.1.3",
    "timeago": "^1.5.3",
    "toastr": "^2.1.2",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.7.4",
    "timepicker": "^1.11.9",
    "ng2-cache": "^0.1.11"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.0-rc.0",
    "@angular/compiler-cli": "^2.3.1",
    "@angularclass/hmr": "^1.2.2",
    "@types/grecaptcha": "^2.0.30",
    "@types/jasmine": "^2.2.30",
    "@types/morris.js": "^0.5.5",
    "@types/node": "^6.0.42",
    "codelyzer": "~2.0.0-beta.4",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "2.7.0",
    "karma": "1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.3.2",
    "nswag": "^8.1.0",
    "protractor": "4.0.14",
    "ts-node": "1.7.2",
    "tslint": "^4.3.0",
    "typescript": "2.0.8"
  }
}

For some errors please see the picture...

Do you have an idea where the error comes from ?

Thanks !

Angular 2, Asp Core, Abp 1.5.0

Hi,

I try a lot of things to prevent the back button in the browser and on a mobile phone. If I'm on a modal i'd like to prevent the back button behavior

I try using jQuery like

$(document).on('keydown', function (event) {
            if (event.keyCode == 27) {
                // Prevent default (disable the back button behavior)
                event.preventDefault();

                // Close the modal
                self.close();
}

And then I use

window.addEventListener('onpopstate',
            // Add your callback here
            (event) => event.preventDefault()
        );

But it doesn't work... the page go always to the previous page.

How can I prevent this behavior if I'm on a modal

Thanks !!

Question

Angular 2, Asp.core ( .Net4.6)

Hi,

How can I enable client site caching in my project ?

Thanks

Question

Hi,

I published my angular 2 application to azure and its working only the chat doesn't work. If I look inside the console I get the following error:

XMLHttpRequest cannot load https://pm.host.ligna-systems.com/signalr/negotiate?clientProtocol=1.5&enc_…22abpcommonhub%22%7D%2C%7B%22name%22%3A%22chathub%22%7D%5D&_=1496057630510. The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'https://parts.pm.ligna-systems.com' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

On my asp. core project (Abp v. 1.5.0) my webconfig looks like this :

<?xml version="1.0" encoding="utf-8"?>
<configuration>

   

   <system.webServer>
       <rewrite>
         <rules>
            
            <rule name="Force HTTPS" enabled="true">
               <match url="(.*)" ignoreCase="false" />
               <conditions>
                  <add input="{HTTPS}" pattern="off" />
               </conditions>
               <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
            </rule>
            
         </rules>
      </rewrite>
      
      <httpProtocol>
         <customHeaders>
            <add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept, Abp.TenantId, Authorization" />
         </customHeaders>
      </httpProtocol>

      <handlers>
         <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
      </handlers>

      <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>

      <modules>
         <remove name="WebDAVModule" />
      </modules>

   </system.webServer>
</configuration>

and on Azure I configured cors with a '*'.

Could you help my please ?

Angular 2, asp.net core

Hi,

If I try to access the application with an other tenant as the host tenant I got an error: Request URL: <a class="postlink" href="http://localhost:22742/AbpUserConfiguration/GetAll">http://localhost:22742/AbpUserConfiguration/GetAll</a> Internal Server Error

The tenant names I used is LIGNA-PARTS or LIGNA-WEB.

For a test I created a new tenant TEST-TENANT and with this tenant I can access the application without getting an error

Is there a problem with the tenant name ? But in earlier version I used the same tenant name and it works.

the logs

DEBUG 2017-05-04 10:45:46,100 [175 ] ore.Mvc.Internal.ControllerActionInvoker - Request was short circuited at exception filter 'Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter'. DEBUG 2017-05-04 10:45:46,100 [175 ] etCore.Mvc.Internal.ObjectResultExecutor - No information found on request to perform content negotiation. DEBUG 2017-05-04 10:45:46,100 [175 ] etCore.Mvc.Internal.ObjectResultExecutor - Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. INFO 2017-05-04 10:45:46,100 [175 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2017-05-04 10:45:46,100 [175 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) in 34.1534ms DEBUG 2017-05-04 10:45:46,100 [175 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQI" completed keep alive response. INFO 2017-05-04 10:45:46,100 [175 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 43.8301ms 500 application/json; charset=utf-8 INFO 2017-05-04 10:45:48,218 [175 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://localhost:22742/AbpUserConfiguration/GetAll">http://localhost:22742/AbpUserConfiguration/GetAll</a> 0 DEBUG 2017-05-04 10:45:48,218 [175 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQH" completed keep alive response. INFO 2017-05-04 10:45:48,218 [175 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.2333ms 204 INFO 2017-05-04 10:45:48,221 [189 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://localhost:22742/AbpUserConfiguration/GetAll">http://localhost:22742/AbpUserConfiguration/GetAll</a> application/json INFO 2017-05-04 10:45:48,221 [189 ] entication.JwtBearer.JwtBearerMiddleware - Successfully validated the token. INFO 2017-05-04 10:45:48,221 [189 ] entication.JwtBearer.JwtBearerMiddleware - HttpContext.User merged via AutomaticAuthentication from authenticationScheme: Bearer. DEBUG 2017-05-04 10:45:48,221 [189 ] NetCore.StaticFiles.StaticFileMiddleware - The request path /AbpUserConfiguration/GetAll does not match a supported file type DEBUG 2017-05-04 10:45:48,221 [189 ] Microsoft.AspNetCore.Routing.RouteBase - Request successfully matched the route with name 'defaultWithArea' and template '{area}/{controller=Home}/{action=Index}/{id?}'. DEBUG 2017-05-04 10:45:48,221 [189 ] .AspNetCore.Mvc.Internal.MvcRouteHandler - No actions matched the current request DEBUG 2017-05-04 10:45:48,221 [189 ] Microsoft.AspNetCore.Routing.RouteBase - Request successfully matched the route with name 'default' and template '{controller=Home}/{action=Index}/{id?}'. DEBUG 2017-05-04 10:45:48,225 [189 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) INFO 2017-05-04 10:45:48,235 [189 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) with arguments ((null)) - ModelState is Valid ERROR 2017-05-04 10:45:48,257 [177 ] Mvc.ExceptionHandling.AbpExceptionFilter - An item with the same key has already been added. System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer) at Abp.Localization.MultiTenantLocalizationDictionary.GetAllValuesFromDatabase(Nullable1 tenantId) at Castle.Proxies.Invocations.MultiTenantLocalizationDictionary_GetAllValuesFromDatabase.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.MultiTenantLocalizationDictionaryProxy.GetAllValuesFromDatabase(Nullable1 tenantId) at Abp.Runtime.Caching.CacheExtensions.<>c__DisplayClass3_02.<Get>b__0(String k) at Abp.Runtime.Caching.CacheBase.Get(String key, Func2 factory) at Abp.Runtime.Caching.CacheExtensions.Get[TKey,TValue](ICache cache, TKey key, Func2 factory) at Abp.Localization.MultiTenantLocalizationDictionary.GetAllStrings(Nullable1 tenantId) at Castle.Proxies.MultiTenantLocalizationDictionaryProxy.GetAllStrings_callback() at Castle.Proxies.Invocations.ILocalizationDictionary_GetAllStrings.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.MultiTenantLocalizationDictionaryProxy.GetAllStrings() at Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource.GetAllStrings(CultureInfo culture, Boolean includeDefaults) at Abp.Web.Configuration.AbpUserConfigurationBuilder.GetUserLocalizationConfig() at Abp.Web.Configuration.AbpUserConfigurationBuilder.<GetAll>d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.<GetAll>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ObjectMethodExecutor.<CastToObject>d__401.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__27.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__25.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextExceptionFilterAsync>d__24.MoveNext() DEBUG 2017-05-04 10:45:48,257 [177 ] ore.Mvc.Internal.ControllerActionInvoker - Request was short circuited at exception filter 'Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter'. DEBUG 2017-05-04 10:45:48,257 [177 ] etCore.Mvc.Internal.ObjectResultExecutor - No information found on request to perform content negotiation. DEBUG 2017-05-04 10:45:48,257 [177 ] etCore.Mvc.Internal.ObjectResultExecutor - Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. INFO 2017-05-04 10:45:48,257 [177 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2017-05-04 10:45:48,257 [177 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) in 33.812ms DEBUG 2017-05-04 10:45:48,257 [177 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQI" completed keep alive response. INFO 2017-05-04 10:45:48,257 [177 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 38.9717ms 500 application/json; charset=utf-8 DEBUG 2017-05-04 10:47:49,126 [166 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQH" disconnecting. DEBUG 2017-05-04 10:47:49,126 [libuv] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQH" sending FIN. DEBUG 2017-05-04 10:47:49,126 [libuv] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQH" sent FIN with status "0". DEBUG 2017-05-04 10:47:49,127 [libuv] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQH" stopped. DEBUG 2017-05-04 10:47:49,204 [178 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQI" disconnecting. DEBUG 2017-05-04 10:47:49,204 [libuv] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQI" sending FIN. DEBUG 2017-05-04 10:47:49,204 [libuv] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQI" sent FIN with status "0". DEBUG 2017-05-04 10:47:49,205 [libuv] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL4IOAJGKCQI" stopped.

I found this error:

Error mapping types.

Mapping types: Permission -> FlatPermissionWithLevelDto Abp.Authorization.Permission -> LignaSystems.PM.Authorization.Permissions.Dto.FlatPermissionWithLevelDto

Type Map configuration: Permission -> FlatPermissionWithLevelDto Abp.Authorization.Permission -> LignaSystems.PM.Authorization.Permissions.Dto.FlatPermissionWithLevelDto

Property: DisplayName

Question

Hi,

I have the following template inside a *ngFor. I have a detailList with details.

Inside the template there are 3 select boxes. To fill the select boxes I need 3 different List. - documentList

  • aktivitaetenList
  • dokumentPositionDetailList

To get those lists I called multiple services. But if I selected a value in the "dokument" <select> I need to filter the aktivitaetenList and the documentPositionDetailFilteredList

I saved the filtered lists in different variables:

  • filteredAktivitaetenList = filtered aktivitaetenList
  • documentPositionDetailFilteredList = filtered dokumentPositionDetailList

Now for the first element inside my "detailList" all works fine. I select a document => the aktivitaetList was filtered and shows only the aktivtaeten for the document it works also for the dokumentPositionDetailList.

BUT when I add know a new element inside my "detailList" and I want to select an aktivitaet without select a document (it should be filled with aktivities) there is only the filtered list from the previous detail.

How can I achieve to get the complete list of activities inside each detail of detailList ?(detail 1, detail 2 ,....).

Thanks for help me !

<div class="panel panel-default" *ngFor="let detail of detailList; let index = index;let first = first;let last = last;">
        <form #accordionForm="ngForm" novalidate>
            <div class="panel-heading" role="tab" id="heading{{index}}">
                <div class="panel-title">
                    <a role="button" name="collapseHead{{index}}" data-toggle="collapse" data-parent="#accordion" href="#colapse{{index}}" aria-expanded="false">
                    </a>                    
                </div>
            </div>
            <div id="colapse{{index}}" class="panel-collapse collapse" [ngClass]="{'in': last}" role="tabpanel">
                <div class="panel-body">
                    <div *ngIf="detail.aktivitaet === undefined || (detail.aktivitaet !== undefined && detail.aktivitaet !== null && detail.aktivitaet.dokumentErlaubtJN)" class="form-group form-md-line-input form-md-floating-label no-hint">
                        <label>{{l("Dokument")}}</label>
                        <select name="dokument{{index}}" class="form-control" (change)="getFilteredAktivitaeten(index, detail.dokumenteId )" [ngClass]="{'edited': detail.dokumenteId }" [(ngModel)]="detail.dokumenteId">
                            <option [ngValue]="undefined" selected>{{l('NoDokumentSelected')}}</option>
                            <option *ngFor="let dokument of documentList;" [ngValue]="document.id">{{dokument.bezeichnungDE}}</option>
                        </select>
                    </div>
                    <div class="form-group form-md-line-input form-md-floating-label no-hint">
                        <label>{{l("Aktivitaet")}}</label>
                        <select name="aktivitaetId{{index}}" class="form-control" [ngClass]="{'edited': detail.aktivitaetId }" (change)="setAktivitaet(index);" [(ngModel)]="detail.aktivitaetId" required>
                            <option [ngValue]="undefined" selected>{{l('SelectAktivitaet')}}</option>
                            <option *ngFor="let aktivitaet of filteredAktivitaetenList;" [ngValue]="aktivitaet.id">{{aktivitaet.bezeichnungDE}}</option>
                        </select>
                    </div>
                    <div *ngIf="detail.dokumenteId" class="form-group form-md-line-input form-md-floating-label no-hint">
                        <label>{{l("DokumentPositionDetail")}}</label>
                        <select name="dokumentPositionDetail{{index}}" class="form-control" [ngClass]="{'edited': detail.dokumentPositionDetailId }" [(ngModel)]="detail.dokumentPositionDetailId" [required]="detail.dokumentPositionDetailId">
                            <option [ngValue]="undefined" selected>{{l('NoDokumentDetailSelected')}}</option>
                            <option *ngFor="let dokumentDetail of documentPositionDetailFilteredList;" [ngValue]="dokumentDetail.id">{{dokumentDetail.id}}</option>
                        </select>
                    </div>                    
                </div>
            </div>
        </form>
    </div>
@Component({
    selector: 'createUpdateArbeitstagDetail',
    templateUrl: './create-update-arbeitstagDetail.component.html'
})
export class CreateUpdateArbeitstagDetailComponent extends AppComponentBase implements AfterViewInit {

    @Input() detailList: Array<detailListeDto>;

    @Output() detailListChanged: EventEmitter<Array<detailListeListDto>> = new EventEmitter<Array<detailListeDto>>();

    aktivitaetenList: AktivitaetListDto[];
    dokumentList: DokumentListDto[];
    dokumentPositionDetailList: DokumentPositionDetailListDto[];
    dokumentPositionDetailFilteredList: DokumentPositionDetailListDto[];
    filteredAktivitaetenList: AktivitaetListDto[];


    constructor(injector: Injector,
        private _aktivitaetService: AktivitaetServiceProxy,
        private _dokumentService: DokumentServiceProxy
    ) {
        super(injector);
		
        this.aktivitaetenList = new Array<AktivitaetListDto>();
        this.dokumentList = new Array<DokumentListDto>();
        this.dokumentPositionDetailList = new Array<DokumentPositionDetailListDto>();
        this.filteredAktivitaetenList = new Array<AktivitaetListDto>();
    }

    ngAfterViewInit(): void {
        var self = this;

        this._dokumentService.getAllDokumentAsync().subscribe(response => {
            this.dokumentList = response.items;
        });

        this._dokumentService.getDokumentPositionenDetail().subscribe(response => {
            this.dokumentPositionDetailList = response.items;
        });

        this._aktivitaetService.getAllAktivitaetenAsync().subscribe(response => {
            this.aktivitaetenList = response.items;
        });
    }

    getFilteredAktivitaeten(index: number, dokumentId?: number): void {
		
		// If a document was selected I call the service to get all aktivities for the current selected document
        if (dokumentId) {
            this._aktivitaetService.getAllAktivitaetenForDokument(dokumentId).subscribe(response => {
                this.filteredAktivitaetenList = response.items;
            });

			// Load the details for the document
            this.getDokumentDetails(dokumentId);
        }
        else {
			// Load all activities without a document
            this.filteredAktivitaetenList = this.aktivitaetenList.filter(x => x.dokumentPflichtJN === false);
        }
    }

    getDokumentDetails(dokumentId?: number): void {
        this.dokumentPositionDetailFilteredList = this.dokumentPositionDetailList.filter(x => x.dokumentId == dokumentId);
    }     

    delete(index: number): void {
        this.message.confirm(
            this.l('AreYouSureToDeleteTheDetail', this.detailList[index].aktivitaet),
            isConfirmed => {
                if (isConfirmed) {
                    this.detailList.splice(index, 1);

                    this.detailListChanged.emit(this.detailList);
                }
            }
        )
    };
}

Hi,

I created a service with an whose has got a function with a class as input.

public async Task<ListResultDto<ArbeitszeitListDto>> GetArbeitszeitenAsync(ArbeitszeitenInputDto input)
        {
                  
        }

The input class "ArbeitszeitenInputDto" looks like

public class ArbeitszeitenInputDto
    {
       
        public int? MitarbeiterId { get; set; }

       
        public int? MaschineId { get; set; }

       
        public string Filter { get; set; }
       
        [Required]
        public DateTime StartDatum { get; set; }
       
        [Required]
        public DateTime EndDatum { get; set; }
    }

But only for this class, nswag doesn't gernerate a class. For all the other classes I created it worked fine.

=> Angular2 => service-proxies.ts generated code:

/**
     * @return Success
     */
    getArbeitszeitenAsync(mitarbeiterId: number, maschineId: number, filter: string, startDatum: moment.Moment, endDatum: moment.Moment): Observable<ListResultDtoOfArbeitszeitListDto> {
        let url_ = this.baseUrl + "/api/services/app/Arbeitszeit/GetArbeitszeitenAsync?";
        if (mitarbeiterId !== undefined)
        
            url_ += "MitarbeiterId=" + encodeURIComponent("" + mitarbeiterId) + "&"; 
        
        if (maschineId !== undefined)
        
            url_ += "MaschineId=" + encodeURIComponent("" + maschineId) + "&"; 
        
        if (filter !== undefined)
        
            url_ += "Filter=" + encodeURIComponent("" + filter) + "&"; 
        
        if (startDatum !== undefined)
        
            url_ += "StartDatum=" + encodeURIComponent("" + startDatum.toJSON()) + "&"; 
        
        if (endDatum !== undefined)
        
            url_ += "EndDatum=" + encodeURIComponent("" + endDatum.toJSON()) + "&";

        const content_ = "";
        
        return this.http.request(url_, {
            body: content_,
            method: "get",
            headers: new Headers({
                "Content-Type": "application/json; charset=UTF-8", 
				"Accept": "application/json; charset=UTF-8"
            })
        }).map((response) => {
            return this.processGetArbeitszeitenAsync(response);
        }).catch((response: any, caught: any) => {
            if (response instanceof Response) {
                try {
                    return Observable.of(this.processGetArbeitszeitenAsync(response));
                } catch (e) {
                    return <Observable<ListResultDtoOfArbeitszeitListDto>><any>Observable.throw(e);
                }
            } else
                return <Observable<ListResultDtoOfArbeitszeitListDto>><any>Observable.throw(response);
        });
    }

Is there somewhere a mistake or why didn't the nswag generate a class from it ?

Greatings,

Hi,

I ran into an issue when I try to get the token from the TokenAuthController.

I use in my test project the TestServer from the Microsoft.AspNetCore.TestHost Assembly.

I tested my WebApi without the code below to get the Token and all worked fine. After the test I will get a Token to test other function so I implemented the following code:

I created an BaseWebApiClient class an into this class I 'll get the token.

string path = $"/api/TokenAuth/Authenticate";

            AjaxResponse<AuthenticateResultModel> result = new AjaxResponse<AuthenticateResultModel>();

            try
            {
                Client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

                var serializedString = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(input), Encoding.UTF8, "application/json");

                // Achtung hier funktioniert nur PostAsync und keine PostAsync as Json oder sonstwas
                HttpResponseMessage response = await Client.PostAsync(path, serializedString);

                var json = await response.Content.ReadAsStringAsync();

                if (response.IsSuccessStatusCode)
                    result = Newtonsoft.Json.JsonConvert.DeserializeObject<AjaxResponse<AuthenticateResultModel>>(json);
                else
                    result = new AjaxResponse<AuthenticateResultModel>(Newtonsoft.Json.JsonConvert.DeserializeObject<AjaxResponse<ErrorInfo>>(json).Error);
            }
            catch (Exception e)
            {
                result = new AjaxResponse<AuthenticateResultModel>(new ErrorInfo(e.HResult, e.Message));
            }

            // Token setzen 
            if (result.Success)
            {
                Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", result.Result.AccessToken);
            }

When I try now to get the token in my Unittest I got multiple Errors:

The First Error was that "Microsoft.IdentityModel.Tokens" wasn't found in the test project => I added the package => work Next Error was that "System.IdentityModel.Tokens.Jwt": wasn't found in the Host.Core ( I added a Host.Core Project for the TestServer => same classes as in Host project ) => Added the package => work

Now I can debug the code in the BaseWebApi an here I got the following response

{Method: POST, RequestUri: 'http://localhost/api/TokenAuth/Authenticate', Version: 1.1, Content: System.Net.Http.StringContent, Headers: { Accept: application/json Accept: application/json Host: localhost Content-Type: application/json; charset=utf-8 }}

All other test passed but I m not able to get a token...

Can you help me please ?

Hi,

I created a custom table "CustomSettings". And integrated it in the DBContext in the EF project

[DbConfigurationType(typeof(PMDbConfiguration))]
    public class PMDbContext : AbpZeroDbContext<Tenant, Role, User>
    {
        /* Define an IDbSet for each entity of the application */

        public virtual IDbSet<BinaryObject> BinaryObjects { get; set; }

        public virtual IDbSet<Friendship> Friendships { get; set; }

        public virtual IDbSet<ChatMessage> ChatMessages { get; set; }

        public virtual IDbSet<CustomSetting.CustomSetting> CustomSettings { get; set; }

        public virtual IDbSet<Land.Land> Land { get; set; }
       
       // more custom tables

        /* Default constructor is needed for EF command line tool. */
        public PMDbContext()
            : base(GetConnectionString())
        {
        }

I creadted a migration file an updated the database all works fine.

But I debug the unittest local I got an error message:

"Sequence contains no matching element"

public PMDbContext(DbConnection dbConnection)
            : base(dbConnection, true)
        {

        }

If I commented out the new "IDBSet<CustomSettings>" table in the PMDBContext class the unittests run without errors.

I can see that the DbManager threw an System.InvalidOperationException

Showing 1 to 10 of 16 entries