Base solution for your next web application
Open Closed

Reg mobile app #5171


User avatar
0
avanekar02 created

hello

i have created an app service called institution and generated using RAD works perfectly when i run host, i followed the tutorial for xamarin development and want to create a mobile form so i followed the example of phonebook mentioned in "Developing-Step-By-Step-Xamarin"

i created everything 1) ProxyInstitutionsAppService 2) InstitutionsView 3) InstitutionsViewModel 4) Added page to navigation

if i run the menu is shown and empty page is shown correctly if i comment out the constructor code in InstitutionViewModel, but when i uncomment code of constructor in InstitutionsViewModel it doea not load the page.

thanx

this is my log file

NOOR.Sched.MultiTenancy.SubscriptionExpireEmailNotifierWorker DEBUG 2018-05-26 14:46:37,642 [1 ] Abp.Modules.AbpModuleManager - Loading Abp modules... DEBUG 2018-05-26 14:46:37,689 [1 ] Abp.Modules.AbpModuleManager - Found 23 ABP modules in total. DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: NOOR.Sched.Web.Startup.SchedWebHostModule, NOOR.Sched.Web.Host, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: NOOR.Sched.Web.SchedWebCoreModule, NOOR.Sched.Web.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: NOOR.Sched.SchedApplicationModule, NOOR.Sched.Application, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: NOOR.Sched.SchedCoreModule, NOOR.Sched.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Zero.AbpZeroCoreModule, Abp.ZeroCore, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Zero.AbpZeroCommonModule, Abp.Zero.Common, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AbpKernelModule, Abp, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Zero.Ldap.AbpZeroLdapModule, Abp.Zero.Ldap, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AutoMapper.AbpAutoMapperModule, Abp.AutoMapper, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AspNetZeroCore.AbpAspNetZeroCoreModule, Abp.AspNetZeroCore, Version=1.1.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.MailKit.AbpMailKitModule, Abp.MailKit, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: NOOR.Sched.EntityFrameworkCore.SchedEntityFrameworkCoreModule, NOOR.Sched.EntityFrameworkCore, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Zero.EntityFrameworkCore.AbpZeroCoreEntityFrameworkCoreModule, Abp.ZeroCore.EntityFrameworkCore, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.EntityFrameworkCore.AbpEntityFrameworkCoreModule, Abp.EntityFrameworkCore, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.EntityFramework.AbpEntityFrameworkCommonModule, Abp.EntityFramework.Common, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.IdentityServer4.AbpZeroCoreIdentityServerEntityFrameworkCoreModule, Abp.ZeroCore.IdentityServer4.EntityFrameworkCore, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.IdentityServer4.AbpZeroCoreIdentityServerModule, Abp.ZeroCore.IdentityServer4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AspNetZeroCore.Web.AbpAspNetZeroCoreWebModule, Abp.AspNetZeroCore.Web, Version=1.1.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AspNetCore.AbpAspNetCoreModule, Abp.AspNetCore, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Web.AbpWebCommonModule, Abp.Web.Common, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Web.SignalR.AbpWebSignalRModule, Abp.Web.SignalR, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Runtime.Caching.Redis.AbpRedisCacheModule, Abp.RedisCache, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,723 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Hangfire.AbpHangfireAspNetCoreModule, Abp.HangFire.AspNetCore, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:37,738 [1 ] Abp.Modules.AbpModuleManager - 23 modules loaded. DEBUG 2018-05-26 14:46:37,832 [1 ] o.Configuration.LanguageManagementConfig - Converted Abp (Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource) to MultiTenantLocalizationSource DEBUG 2018-05-26 14:46:37,832 [1 ] o.Configuration.LanguageManagementConfig - Converted AbpZero (Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource) to MultiTenantLocalizationSource DEBUG 2018-05-26 14:46:37,832 [1 ] o.Configuration.LanguageManagementConfig - Converted Sched (Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource) to MultiTenantLocalizationSource DEBUG 2018-05-26 14:46:37,832 [1 ] o.Configuration.LanguageManagementConfig - Converted AbpWeb (Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource) to MultiTenantLocalizationSource DEBUG 2018-05-26 14:46:38,469 [1 ] ameworkCore.AbpEntityFrameworkCoreModule - Registering DbContext: NOOR.Sched.EntityFrameworkCore.SchedDbContext, NOOR.Sched.EntityFrameworkCore, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2018-05-26 14:46:39,386 [1 ] Abp.Localization.LocalizationManager - Initializing 4 localization sources. DEBUG 2018-05-26 14:46:39,401 [1 ] Abp.Localization.LocalizationManager - Initialized localization source: Abp DEBUG 2018-05-26 14:46:39,401 [1 ] Abp.Localization.LocalizationManager - Initialized localization source: AbpZero DEBUG 2018-05-26 14:46:39,433 [1 ] Abp.Localization.LocalizationManager - Initialized localization source: Sched DEBUG 2018-05-26 14:46:39,448 [1 ] Abp.Localization.LocalizationManager - Initialized localization source: AbpWeb DEBUG 2018-05-26 14:46:39,534 [1 ] Abp.BackgroundJobs.BackgroundJobManager - Start background worker: Abp.BackgroundJobs.BackgroundJobManager DEBUG 2018-05-26 14:46:39,612 [1 ] Abp.AutoMapper.AbpAutoMapperModule - Found 2 classes define auto mapping attributes DEBUG 2018-05-26 14:46:39,612 [1 ] Abp.AutoMapper.AbpAutoMapperModule - NOOR.Sched.Web.Models.TokenAuth.ExternalLoginProviderInfoModel DEBUG 2018-05-26 14:46:39,612 [1 ] Abp.AutoMapper.AbpAutoMapperModule - NOOR.Sched.Friendships.Cache.FriendCacheItem DEBUG 2018-05-26 14:46:44,469 [1 ] enancy.SubscriptionExpirationCheckWorker - Start background worker: NOOR.Sched.MultiTenancy.SubscriptionExpirationCheckWorker DEBUG 2018-05-26 14:46:44,476 [1 ] cy.SubscriptionExpireEmailNotifierWorker - Start background worker: NOOR.Sched.MultiTenancy.SubscriptionExpireEmailNotifierWorker INFO 2018-05-26 14:50:02,455 [11 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://169.254.80.80:22742/AbpUserConfiguration/GetAll">http://169.254.80.80:22742/AbpUserConfiguration/GetAll</a>
INFO 2018-05-26 14:50:03,270 [11 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) with arguments ((null)) - ModelState is Valid INFO 2018-05-26 14:50:03,655 [4 ] matters.Json.Internal.JsonResultExecutor - Executing JsonResult, writing value Abp.Web.Models.AjaxResponse. INFO 2018-05-26 14:50:03,756 [4 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) in 541.0472ms INFO 2018-05-26 14:50:03,756 [4 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 1327.0586ms 200 application/json; charset=utf-8 INFO 2018-05-26 14:50:14,811 [9 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 POST <a class="postlink" href="http://169.254.80.80:22742/api/TokenAuth/Authenticate">http://169.254.80.80:22742/api/TokenAuth/Authenticate</a> application/json; charset=utf-8 183 INFO 2018-05-26 14:50:15,475 [9 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method NOOR.Sched.Web.Controllers.TokenAuthController.Authenticate (NOOR.Sched.Web.Core) with arguments (NOOR.Sched.Web.Models.TokenAuth.AuthenticateModel) - ModelState is Valid INFO 2018-05-26 14:50:16,369 [4 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2018-05-26 14:50:16,400 [4 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action NOOR.Sched.Web.Controllers.TokenAuthController.Authenticate (NOOR.Sched.Web.Core) in 1559.4623ms INFO 2018-05-26 14:50:16,400 [4 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 1601.8221ms 200 application/json; charset=utf-8 INFO 2018-05-26 14:50:16,800 [14 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://169.254.80.80:22742/api/services/app/Session/GetCurrentLoginInformations">http://169.254.80.80:22742/api/services ... formations</a>
INFO 2018-05-26 14:50:16,824 [14 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token. INFO 2018-05-26 14:50:16,839 [14 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated. INFO 2018-05-26 14:50:17,023 [8 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method NOOR.Sched.Sessions.SessionAppService.GetCurrentLoginInformations (NOOR.Sched.Application) with arguments ((null)) - ModelState is Valid INFO 2018-05-26 14:50:17,087 [14 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2018-05-26 14:50:17,103 [14 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action NOOR.Sched.Sessions.SessionAppService.GetCurrentLoginInformations (NOOR.Sched.Application) in 162.6041ms INFO 2018-05-26 14:50:17,118 [14 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 310.481ms 200 application/json; charset=utf-8 INFO 2018-05-26 14:50:17,225 [15 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://169.254.80.80:22742/AbpUserConfiguration/GetAll">http://169.254.80.80:22742/AbpUserConfiguration/GetAll</a>
INFO 2018-05-26 14:50:17,225 [15 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token. INFO 2018-05-26 14:50:17,225 [15 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated. INFO 2018-05-26 14:50:17,241 [4 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) with arguments ((null)) - ModelState is Valid INFO 2018-05-26 14:50:17,479 [11 ] matters.Json.Internal.JsonResultExecutor - Executing JsonResult, writing value Abp.Web.Models.AjaxResponse. INFO 2018-05-26 14:50:17,479 [11 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) in 229.6559ms INFO 2018-05-26 14:50:17,479 [11 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 249.5032ms 200 application/json; charset=utf-8 INFO 2018-05-26 14:50:17,623 [4 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://169.254.80.80:22742/api/services/app/Profile/GetProfilePictureById?profilePictureId=4f61bbcb-74d3-031e-88e0-39e52ba73db5">http://169.254.80.80:22742/api/services ... e52ba73db5</a>
INFO 2018-05-26 14:50:17,624 [4 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token. INFO 2018-05-26 14:50:17,624 [4 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated. INFO 2018-05-26 14:50:17,728 [11 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method NOOR.Sched.Authorization.Users.Profile.ProfileAppService.GetProfilePictureById (NOOR.Sched.Application) with arguments (4f61bbcb-74d3-031e-88e0-39e52ba73db5) - ModelState is Valid INFO 2018-05-26 14:50:17,828 [9 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2018-05-26 14:50:17,828 [9 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action NOOR.Sched.Authorization.Users.Profile.ProfileAppService.GetProfilePictureById (NOOR.Sched.Application) in 198.3269ms INFO 2018-05-26 14:50:17,828 [9 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 212.2368ms 200 application/json; charset=utf-8 INFO 2018-05-26 14:50:18,026 [11 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://169.254.80.80:22742/api/services/app/Tenant/GetTenants?EditionIdSpecified=False&MaxResultCount=10&SkipCount=0">http://169.254.80.80:22742/api/services ... kipCount=0</a>
INFO 2018-05-26 14:50:18,027 [11 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token. INFO 2018-05-26 14:50:18,027 [11 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated. INFO 2018-05-26 14:50:18,160 [11 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method NOOR.Sched.MultiTenancy.TenantAppService.GetTenants (NOOR.Sched.Application) with arguments (NOOR.Sched.MultiTenancy.Dto.GetTenantsInput) - ModelState is Valid INFO 2018-05-26 14:50:20,197 [11 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2018-05-26 14:50:20,213 [11 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action NOOR.Sched.MultiTenancy.TenantAppService.GetTenants (NOOR.Sched.Application) in 2154.9634ms INFO 2018-05-26 14:50:20,213 [11 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 2192.9822ms 200 application/json; charset=utf-8


17 Answer(s)
  • User Avatar
    0
    alper created
    Support Team

    Hi,

    The error log shows no error. And this log looks like web log. But we need to see Xamarin logs in order to determine the problem. Show us your view model constructor code (or whole view model code). To see what the problem is; wrap your constructor with try-catch. And put a debug point in your catch line. I smell like there's problem with dependency injection and one of your services that's being injected into your constructor cannot be initialized. The other thing that can be faulty; you cannot make HTTP web requests in constructors. This is a strict rule both in IOS and Android platforms. So if you are intending to retrieve some data from your application service (Web API), do it in InitializeAsync() or PageAppearingAsync() methods. You can check TenantDetailsViewModel and take it as a guide.

  • User Avatar
    0
    avanekar02 created
    using NOOR.Sched.District;
    using NOOR.Sched.District.Dtos;
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Threading.Tasks;
    using System.Windows.Input;
    using NOOR.Sched.Commands;
    using NOOR.Sched.Core.Threading;
    using NOOR.Sched.Extensions;
    using NOOR.Sched.Models.CMS;
    using NOOR.Sched.ViewModels.Base;
    using Xamarin.Forms;
    using MvvmHelpers;
    using NOOR.Sched.Localization;
    using NOOR.Sched.UI.Assets;
    using NOOR.Sched.Views;
    
    namespace NOOR.Sched.ViewModels
    {
        public class InstitutionViewModel : XamarinViewModel
        {
    
    
            public ICommand PageAppearingCommand => HttpRequestCommand.Create(PageAppearingAsync);
            private readonly IInstitutionsAppService _institutionsAppService;
            private ObservableRangeCollection<InstitutionListModel> _institutions = new ObservableRangeCollection<InstitutionListModel>();
    
    
            public InstitutionViewModel(IInstitutionsAppService institutionsappservice)
            {
                _institutionsAppService = institutionsappservice;
            }
    
            public ObservableRangeCollection<InstitutionListModel> Institutions
            {
                get => _institutions;
                set
                {
                    _institutions = value;
                    RaisePropertyChanged(() => Institutions);
                }
            }
    
            public async Task PageAppearingAsync()
            {
                await FetchDataAsync();
            }
    
            public async Task FetchDataAsync(string filterText = null)
            {
                await SetBusyAsync(async () =>
                {
                    var result = await _institutionsAppService.GetAll(new GetAllInstitutionsInput
                    {
                        Filter = filterText
                    });
    
                    var institutionListModels = ObjectMapper.Map<IEnumerable<InstitutionListModel>>(result.Items);
                    Institutions.ReplaceRange(institutionListModels);
                });
            }
        }
    }
    
  • User Avatar
    0
    alper created
    Support Team

    hi,

    Your ViewModel looks OK. Did you create a proxy application service class in the project *.Application.Client in _Instutions_folder > ProxyInstitutionsAppService.cs

    <ins>ProxyInstitutionsAppService.cs</ins>

    public class ProxyInstitutionsAppService: ProxyAppServiceBase, IInstitutionsAppService
     {
            public async Task<List<InstitutionDto> GetAll(GetAllInstitutionsInput input)
            {
                return await ApiClient.GetAsync<List<InstitutionDto>>(GetEndpoint(nameof(GetAll)), input);
            }
    
            //... your other methods...
    }
    
  • User Avatar
    0
    avanekar02 created

    yes i did

    using System.Threading.Tasks;
    using Abp.Application.Services.Dto;
    using NOOR.Sched.District;
    using NOOR.Sched.District.Dtos;
    using NOOR.Sched.Dto;
    
    namespace NOOR.Sched.District
    {
        public class ProxyInstitutionAppService : ProxyAppServiceBase, IInstitutionsAppService
        {
            public async Task<PagedResultDto<GetInstitutionForView>> GetAll(GetAllInstitutionsInput input)
            {
                return await ApiClient.GetAsync<PagedResultDto<GetInstitutionForView>>(GetEndpoint(nameof(GetAll)), input);
            }
    
            public async Task<PagedResultDto<AcademicyearLookupTableDto>> GetAllAcademicyearForLookupTable(GetAllForLookupTableInput input)
            {
                return await ApiClient.GetAsync<PagedResultDto<AcademicyearLookupTableDto>>(GetEndpoint(nameof(GetAllAcademicyearForLookupTable)), input);
            }
    
            public async Task<PagedResultDto<SectionLookupTableDto>> GetAllSectionForLookupTable(GetAllForLookupTableInput input)
            {
                return await ApiClient.GetAsync<PagedResultDto<SectionLookupTableDto>>(GetEndpoint(nameof(GetAllSectionForLookupTable)), input);
    
    
            }
    
            public async Task<PagedResultDto<GradeLookupTableDto>> GetAllGradeForLookupTable(GetAllForLookupTableInput input)
            {
                return await ApiClient.GetAsync<PagedResultDto<GradeLookupTableDto>>(GetEndpoint(nameof(GetAllGradeForLookupTable)), input);
            }
    
            public async Task<PagedResultDto<SchoolLookupTableDto>> GetAllSchoolForLookupTable(GetAllForLookupTableInput input)
            {
                return await ApiClient.GetAsync<PagedResultDto<SchoolLookupTableDto>>(GetEndpoint(nameof(GetAllSchoolForLookupTable)), input);
            }
    
            public async Task<PagedResultDto<CityLookupTableDto>> GetAllCityForLookupTable(GetAllForLookupTableInput input)
            {
                return await ApiClient.GetAsync<PagedResultDto<CityLookupTableDto>>(GetEndpoint(nameof(GetAllCityForLookupTable)), input);
            }
    
            public async Task<FileDto> GetInstitutionsToExcel(GetAllInstitutionsForExcelInput input)
            {
                throw new System.NotImplementedException();
            }
    
            public async Task Delete(EntityDto input)
            {
                await ApiClient.DeleteAsync(GetEndpoint(nameof(Delete)), input);
            }
    
            public async Task CreateOrEdit(CreateOrEditInstitutionDto input)
            {
                await ApiClient.PostAsync(GetEndpoint(nameof(CreateOrEdit)), input);
            }
    
            public async Task<GetInstitutionForEditOutput> GetInstitutionForEdit(EntityDto input)
            {
                return await ApiClient.GetAsync<GetInstitutionForEditOutput>(GetEndpoint(nameof(GetInstitutionForEdit)), input);
            }
    
        }
    }
    
  • User Avatar
    0
    alper created
    Support Team

    To narrow down the problem first remove the constructor and remove all relevant code. So we'll see if there's a problem with Dependency Injection.

    public InstitutionViewModel(IInstitutionsAppService institutionsappservice)
     {
                _institutionsAppService = institutionsappservice;
     }
    
  • User Avatar
    0
    avanekar02 created

    The problem i think is with the dependency injection but how to track what the problem is, i put try catch block in the constructor but the code does not reach the constructor or for that matter the proxyinstitutionappservice.

    do i have to register this appservice somewhere else.

    regards Anwar

  • User Avatar
    0
    alper created
    Support Team

    Is IInstitutionsAppService inherited from IApplicationService ?

    public interface IInstitutionsAppService : IApplicationService
    {
     //...
    }
    
  • User Avatar
    0
    avanekar02 created

    yes it is

    <code> using System; using System.Threading.Tasks; using Abp.Application.Services; using Abp.Application.Services.Dto; using NOOR.Sched.District.Dtos; using NOOR.Sched.Dto;

    namespace NOOR.Sched.District { public interface IInstitutesAppService : IApplicationService { Task<PagedResultDto<GetInstituteForView>> GetAll(GetAllInstitutesInput input);

    	Task&lt;GetInstituteForEditOutput&gt; GetInstituteForEdit(EntityDto input);
    
    	Task CreateOrEdit(CreateOrEditInstituteDto input);
    
    	Task Delete(EntityDto input);
    
    	Task&lt;FileDto&gt; GetInstitutesToExcel(GetAllInstitutesForExcelInput input);
    
    	
    	Task&lt;PagedResultDto&lt;CityLookupTableDto&gt;> GetAllCityForLookupTable(GetAllForLookupTableInput input);
    	
    	Task&lt;PagedResultDto&lt;SchoolLookupTableDto&gt;> GetAllSchoolForLookupTable(GetAllForLookupTableInput input);
    	
    	Task&lt;PagedResultDto&lt;GradeLookupTableDto&gt;> GetAllGradeForLookupTable(GetAllForLookupTableInput input);
    	
    	Task&lt;PagedResultDto&lt;SectionLookupTableDto&gt;> GetAllSectionForLookupTable(GetAllForLookupTableInput input);
    	
    	Task&lt;PagedResultDto&lt;AcademicyearLookupTableDto&gt;> GetAllAcademicyearForLookupTable(GetAllForLookupTableInput input);
    	
    }
    

    } </code>

  • User Avatar
    0
    avanekar02 created
    using System;
    using System.Linq;
    using System.Linq.Dynamic.Core;
    using Abp.Linq.Extensions;
    using System.Collections.Generic;
    using System.Threading.Tasks;
    using Abp.Domain.Repositories;
    using NOOR.Sched.District.Exporting;
    using NOOR.Sched.District.Dtos;
    using NOOR.Sched.Dto;
    using Abp.Application.Services.Dto;
    using NOOR.Sched.Authorization;
    using Abp.Authorization;
    using Microsoft.EntityFrameworkCore;
    
    namespace NOOR.Sched.District
    {
    	[AbpAuthorize(AppPermissions.Pages_Institutions)]
        public class InstitutionsAppService : SchedAppServiceBase, IInstitutionsAppService
        {
    		 private readonly IRepository<Institution> _institutionRepository;
    		 private readonly IInstitutionsExcelExporter _institutionsExcelExporter;
    		 private readonly IRepository<City,int> _cityRepository;
    		 private readonly IRepository<School,int> _schoolRepository;
    		 private readonly IRepository<Grade,int> _gradeRepository;
    		 private readonly IRepository<Section,int> _sectionRepository;
    		 private readonly IRepository<Academicyear,int> _academicyearRepository;
    		 
    
    		  public InstitutionsAppService(IRepository<Institution> institutionRepository, IInstitutionsExcelExporter institutionsExcelExporter , IRepository<City, int> cityRepository, IRepository<School, int> schoolRepository, IRepository<Grade, int> gradeRepository, IRepository<Section, int> sectionRepository, IRepository<Academicyear, int> academicyearRepository) 
    		  {
    			_institutionRepository = institutionRepository;
    			_institutionsExcelExporter = institutionsExcelExporter;
    			_cityRepository = cityRepository;
    		_schoolRepository = schoolRepository;
    		_gradeRepository = gradeRepository;
    		_sectionRepository = sectionRepository;
    		_academicyearRepository = academicyearRepository;
    		
    		  }
    
    		 public async Task<PagedResultDto<GetInstitutionForView>> GetAll(GetAllInstitutionsInput input)
             {
    
    			var filteredInstitutions = _institutionRepository.GetAll()
    						.WhereIf(!string.IsNullOrWhiteSpace(input.Filter), e => false  || e.NickName.Contains(input.Filter) || e.Memories.Contains(input.Filter) || e.Blocked_Reason.Contains(input.Filter))
    						.WhereIf(!string.IsNullOrWhiteSpace(input.NickNameFilter),  e => e.NickName.ToLower() == input.NickNameFilter.ToLower().Trim())
    						.WhereIf(input.BlockedFilter > -1,  e => Convert.ToInt32(e.Blocked) == input.BlockedFilter )
    						.WhereIf(!string.IsNullOrWhiteSpace(input.MemoriesFilter),  e => e.Memories.ToLower() == input.MemoriesFilter.ToLower().Trim());
    
    
    			var query = (from o in filteredInstitutions
                             join o1 in _cityRepository.GetAll() on o.CityId equals o1.Id into j1
                             from s1 in j1.DefaultIfEmpty()
                             join o2 in _schoolRepository.GetAll() on o.SchoolId equals o2.Id into j2
                             from s2 in j2.DefaultIfEmpty()
                             join o3 in _gradeRepository.GetAll() on o.GradeId equals o3.Id into j3
                             from s3 in j3.DefaultIfEmpty()
                             join o4 in _sectionRepository.GetAll() on o.SectionId equals o4.Id into j4
                             from s4 in j4.DefaultIfEmpty()
                             join o5 in _academicyearRepository.GetAll() on o.AcademicyearId equals o5.Id into j5
                             from s5 in j5.DefaultIfEmpty()
                             
                             select new GetInstitutionForView() { Institution = ObjectMapper.Map<InstitutionDto>(o)
    						 , CityCitiName = s1 == null ? "" : s1.CitiName.ToString()
    					, SchoolSchoolName = s2 == null ? "" : s2.SchoolName.ToString()
    					, GradeGradeName = s3 == null ? "" : s3.GradeName.ToString()
    					, SectionSectionName = s4 == null ? "" : s4.SectionName.ToString()
    					, AcademicyearYear_Attended = s5 == null ? "" : s5.Year_Attended.ToString()
    					
    						 })
    						 
    						.WhereIf(!string.IsNullOrWhiteSpace(input.CityCitiNameFilter), e => e.CityCitiName.ToLower() == input.CityCitiNameFilter.ToLower().Trim())
    						.WhereIf(!string.IsNullOrWhiteSpace(input.SchoolSchoolNameFilter), e => e.SchoolSchoolName.ToLower() == input.SchoolSchoolNameFilter.ToLower().Trim())
    						.WhereIf(!string.IsNullOrWhiteSpace(input.GradeGradeNameFilter), e => e.GradeGradeName.ToLower() == input.GradeGradeNameFilter.ToLower().Trim())
    						.WhereIf(!string.IsNullOrWhiteSpace(input.SectionSectionNameFilter), e => e.SectionSectionName.ToLower() == input.SectionSectionNameFilter.ToLower().Trim())
    						.WhereIf(!string.IsNullOrWhiteSpace(input.AcademicyearYear_AttendedFilter), e => e.AcademicyearYear_Attended.ToLower() == input.AcademicyearYear_AttendedFilter.ToLower().Trim());
    
                var totalCount = await query.CountAsync();
    
                var institutions = await query
                    .OrderBy(input.Sorting ?? "institution.id asc")
                    .PageBy(input)
                    .ToListAsync();
    
                return new PagedResultDto<GetInstitutionForView>(
                    totalCount,
                    institutions
                );
             }
    		 
    		 [AbpAuthorize(AppPermissions.Pages_Institutions_Edit)]
    		 public async Task<GetInstitutionForEditOutput> GetInstitutionForEdit(EntityDto input)
             {
                var institution = await _institutionRepository.FirstOrDefaultAsync(input.Id);
                var output = new GetInstitutionForEditOutput {Institution = ObjectMapper.Map<CreateOrEditInstitutionDto>(institution)};
    
    			if (output.Institution.CityId != null)
                {
                    var city = await _cityRepository.FirstOrDefaultAsync((int)output.Institution.CityId);
                    output.CityCitiName = city.CitiName.ToString();
                }
    			if (output.Institution.SchoolId != null)
                {
                    var school = await _schoolRepository.FirstOrDefaultAsync((int)output.Institution.SchoolId);
                    output.SchoolSchoolName = school.SchoolName.ToString();
                }
    			if (output.Institution.GradeId != null)
                {
                    var grade = await _gradeRepository.FirstOrDefaultAsync((int)output.Institution.GradeId);
                    output.GradeGradeName = grade.GradeName.ToString();
                }
    			if (output.Institution.SectionId != null)
                {
                    var section = await _sectionRepository.FirstOrDefaultAsync((int)output.Institution.SectionId);
                    output.SectionSectionName = section.SectionName.ToString();
                }
    			if (output.Institution.AcademicyearId != null)
                {
                    var academicyear = await _academicyearRepository.FirstOrDefaultAsync((int)output.Institution.AcademicyearId);
                    output.AcademicyearYear_Attended = academicyear.Year_Attended.ToString();
                }
    			
    			
                return output;
             }
    
    		 public async Task CreateOrEdit(CreateOrEditInstitutionDto input)
             {
                if(input.Id == null){
    				await Create(input);
    			}
    			else{
    				await Update(input);
    			}
             }
    
    		 [AbpAuthorize(AppPermissions.Pages_Institutions_Create)]
    		 private async Task Create(CreateOrEditInstitutionDto input)
             {
                var institution = ObjectMapper.Map<Institution>(input);
    
    			
    			if (AbpSession.TenantId != null)
    			{
    				institution.TenantId = (int?) AbpSession.TenantId;
    			}
    		
    
                await _institutionRepository.InsertAsync(institution);
             }
    
    		 [AbpAuthorize(AppPermissions.Pages_Institutions_Edit)]
    		 private async Task Update(CreateOrEditInstitutionDto input)
             {
                var institution = await _institutionRepository.FirstOrDefaultAsync((int)input.Id);
                 ObjectMapper.Map(input, institution);
             }
    
    		 [AbpAuthorize(AppPermissions.Pages_Institutions_Delete)]
             public async Task Delete(EntityDto input)
             {
                await _institutionRepository.DeleteAsync(input.Id);
             }
    
    		 public async Task<FileDto> GetInstitutionsToExcel(GetAllInstitutionsForExcelInput input)
             {
    
    			var filteredInstitutions = _institutionRepository.GetAll()
    						.WhereIf(!string.IsNullOrWhiteSpace(input.Filter), e => false  || e.NickName.Contains(input.Filter) || e.Memories.Contains(input.Filter) || e.Blocked_Reason.Contains(input.Filter))
    						.WhereIf(!string.IsNullOrWhiteSpace(input.NickNameFilter),  e => e.NickName.ToLower() == input.NickNameFilter.ToLower().Trim())
    						.WhereIf(input.BlockedFilter > -1,  e => Convert.ToInt32(e.Blocked) == input.BlockedFilter )
    						.WhereIf(!string.IsNullOrWhiteSpace(input.MemoriesFilter),  e => e.Memories.ToLower() == input.MemoriesFilter.ToLower().Trim());
    
    
    			var query = (from o in filteredInstitutions
                             join o1 in _cityRepository.GetAll() on o.CityId equals o1.Id into j1
                             from s1 in j1.DefaultIfEmpty()
                             join o2 in _schoolRepository.GetAll() on o.SchoolId equals o2.Id into j2
                             from s2 in j2.DefaultIfEmpty()
                             join o3 in _gradeRepository.GetAll() on o.GradeId equals o3.Id into j3
                             from s3 in j3.DefaultIfEmpty()
                             join o4 in _sectionRepository.GetAll() on o.SectionId equals o4.Id into j4
                             from s4 in j4.DefaultIfEmpty()
                             join o5 in _academicyearRepository.GetAll() on o.AcademicyearId equals o5.Id into j5
                             from s5 in j5.DefaultIfEmpty()
                             
                             select new GetInstitutionForView() { Institution = ObjectMapper.Map<InstitutionDto>(o)
    						 , CityCitiName = s1 == null ? "" : s1.CitiName.ToString()
    					, SchoolSchoolName = s2 == null ? "" : s2.SchoolName.ToString()
    					, GradeGradeName = s3 == null ? "" : s3.GradeName.ToString()
    					, SectionSectionName = s4 == null ? "" : s4.SectionName.ToString()
    					, AcademicyearYear_Attended = s5 == null ? "" : s5.Year_Attended.ToString()
    					
    						 })
    						 
    						.WhereIf(!string.IsNullOrWhiteSpace(input.CityCitiNameFilter), e => e.CityCitiName.ToLower() == input.CityCitiNameFilter.ToLower().Trim())
    						.WhereIf(!string.IsNullOrWhiteSpace(input.SchoolSchoolNameFilter), e => e.SchoolSchoolName.ToLower() == input.SchoolSchoolNameFilter.ToLower().Trim())
    						.WhereIf(!string.IsNullOrWhiteSpace(input.GradeGradeNameFilter), e => e.GradeGradeName.ToLower() == input.GradeGradeNameFilter.ToLower().Trim())
    						.WhereIf(!string.IsNullOrWhiteSpace(input.SectionSectionNameFilter), e => e.SectionSectionName.ToLower() == input.SectionSectionNameFilter.ToLower().Trim())
    						.WhereIf(!string.IsNullOrWhiteSpace(input.AcademicyearYear_AttendedFilter), e => e.AcademicyearYear_Attended.ToLower() == input.AcademicyearYear_AttendedFilter.ToLower().Trim());
    
    
                var InstitutionListDtos = await query.ToListAsync();
    
                return _institutionsExcelExporter.ExportToFile(InstitutionListDtos);
             }
    
    		 [AbpAuthorize(AppPermissions.Pages_Institutions)]
             public async Task<PagedResultDto<CityLookupTableDto>> GetAllCityForLookupTable(GetAllForLookupTableInput input)
             {
                 var query = _cityRepository.GetAll().WhereIf(
                        !string.IsNullOrWhiteSpace(input.Filter),
                       e=> e.CitiName.ToString().Contains(input.Filter)
                    );
    
                var totalCount = await query.CountAsync();
    
                var cityList = await query
                    .PageBy(input)
                    .ToListAsync();
    
    			var lookupTableDtoList = new List<CityLookupTableDto>();
    			foreach(var city in cityList){
    				lookupTableDtoList.Add(new CityLookupTableDto
    				{
    					Id = city.Id,
    					DisplayName = city.CitiName.ToString()
    				});
    			}
    
                return new PagedResultDto<CityLookupTableDto>(
                    totalCount,
                    lookupTableDtoList
                );
             }
    
            [AbpAuthorize(AppPermissions.Pages_Institutions)]
             public async Task<PagedResultDto<SchoolLookupTableDto>> GetAllSchoolForLookupTable(GetAllForLookupTableInput input)
             {
                 var query = _schoolRepository.GetAll().WhereIf(
                        !string.IsNullOrWhiteSpace(input.Filter),
                       e=> e.SchoolName.ToString().Contains(input.Filter)
                    ).WhereIf(
                        !string.IsNullOrWhiteSpace(input.Cityfilter),
                       e => e.CityId.ToString().Contains(input.Cityfilter)
                    )
                    ;
    
                var totalCount = await query.CountAsync();
    
                var schoolList = await query
                    .PageBy(input)
                    .ToListAsync();
    
    			var lookupTableDtoList = new List<SchoolLookupTableDto>();
    			foreach(var school in schoolList){
    				lookupTableDtoList.Add(new SchoolLookupTableDto
    				{
    					Id = school.Id,
    					DisplayName = school.SchoolName.ToString()
    				});
    			}
    
                return new PagedResultDto<SchoolLookupTableDto>(
                    totalCount,
                    lookupTableDtoList
                );
             }		 [AbpAuthorize(AppPermissions.Pages_Institutions)]
             public async Task<PagedResultDto<GradeLookupTableDto>> GetAllGradeForLookupTable(GetAllForLookupTableInput input)
             {
                 var query = _gradeRepository.GetAll().WhereIf(
                        !string.IsNullOrWhiteSpace(input.Filter),
                       e=> e.GradeName.ToString().Contains(input.Filter)
                    );
    
                var totalCount = await query.CountAsync();
    
                var gradeList = await query
                    .PageBy(input)
                    .ToListAsync();
    
    			var lookupTableDtoList = new List<GradeLookupTableDto>();
    			foreach(var grade in gradeList){
    				lookupTableDtoList.Add(new GradeLookupTableDto
    				{
    					Id = grade.Id,
    					DisplayName = grade.GradeName.ToString()
    				});
    			}
    
                return new PagedResultDto<GradeLookupTableDto>(
                    totalCount,
                    lookupTableDtoList
                );
             }		 [AbpAuthorize(AppPermissions.Pages_Institutions)]
             public async Task<PagedResultDto<SectionLookupTableDto>> GetAllSectionForLookupTable(GetAllForLookupTableInput input)
             {
                 var query = _sectionRepository.GetAll().WhereIf(
                        !string.IsNullOrWhiteSpace(input.Filter),
                       e=> e.SectionName.ToString().Contains(input.Filter)
                    );
    
                var totalCount = await query.CountAsync();
    
                var sectionList = await query
                    .PageBy(input)
                    .ToListAsync();
    
    			var lookupTableDtoList = new List<SectionLookupTableDto>();
    			foreach(var section in sectionList){
    				lookupTableDtoList.Add(new SectionLookupTableDto
    				{
    					Id = section.Id,
    					DisplayName = section.SectionName.ToString()
    				});
    			}
    
                return new PagedResultDto<SectionLookupTableDto>(
                    totalCount,
                    lookupTableDtoList
                );
             }		 [AbpAuthorize(AppPermissions.Pages_Institutions)]
             public async Task<PagedResultDto<AcademicyearLookupTableDto>> GetAllAcademicyearForLookupTable(GetAllForLookupTableInput input)
             {
                 var query = _academicyearRepository.GetAll().WhereIf(
                        !string.IsNullOrWhiteSpace(input.Filter),
                       e=> e.Year_Attended.ToString().Contains(input.Filter)
                    );
    
                var totalCount = await query.CountAsync();
    
                var academicyearList = await query
                    .PageBy(input)
                    .ToListAsync();
    
    			var lookupTableDtoList = new List<AcademicyearLookupTableDto>();
    			foreach(var academicyear in academicyearList){
    				lookupTableDtoList.Add(new AcademicyearLookupTableDto
    				{
    					Id = academicyear.Id,
    					DisplayName = academicyear.Year_Attended.ToString()
    				});
    			}
    
                return new PagedResultDto<AcademicyearLookupTableDto>(
                    totalCount,
                    lookupTableDtoList
                );
             }
        }
    }
    
  • User Avatar
    0
    alper created
    Support Team

    <cite>avanekar02: </cite> yes it is

    <code> using System; using System.Threading.Tasks; using Abp.Application.Services; using Abp.Application.Services.Dto; using NOOR.Sched.District.Dtos; using NOOR.Sched.Dto;

    namespace NOOR.Sched.District { public interface IInstitutesAppService : IApplicationService { Task<PagedResultDto<GetInstituteForView>> GetAll(GetAllInstitutesInput input);

      Task&lt;GetInstituteForEditOutput&gt; GetInstituteForEdit(EntityDto input);
    
      Task CreateOrEdit(CreateOrEditInstituteDto input);
    
      Task Delete(EntityDto input);
    
      Task&lt;FileDto&gt; GetInstitutesToExcel(GetAllInstitutesForExcelInput input);
    
      
      Task&lt;PagedResultDto&lt;CityLookupTableDto&gt;> GetAllCityForLookupTable(GetAllForLookupTableInput input);
      
      Task&lt;PagedResultDto&lt;SchoolLookupTableDto&gt;> GetAllSchoolForLookupTable(GetAllForLookupTableInput input);
      
      Task&lt;PagedResultDto&lt;GradeLookupTableDto&gt;> GetAllGradeForLookupTable(GetAllForLookupTableInput input);
      
      Task&lt;PagedResultDto&lt;SectionLookupTableDto&gt;> GetAllSectionForLookupTable(GetAllForLookupTableInput input);
      
      Task&lt;PagedResultDto&lt;AcademicyearLookupTableDto&gt;> GetAllAcademicyearForLookupTable(GetAllForLookupTableInput input);
      
    

    } } </code>

    pls wrap your code with

    [code]
    

    [/code:xl5fd9gn]

  • User Avatar
    0
    alper created
    Support Team

    I think you have problem with

    IInstitutionsExcelExporter institutionsExcelExporter
    

    Try to remove this dependency and try again. If problem goes away then we can focus on this object.

  • User Avatar
    0
    avanekar02 created

    i did remove the IInstitutionsExcelExporter _institutionsExcelExporter;

    but no still the same issues

  • User Avatar
    0
    avanekar02 created

    please let me know the next step an i need to deploy this.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Can you rename "ProxyInstitutionAppService" to "ProxyInstitutionsAppService" and try again ?

  • User Avatar
    0
    alper created
    Support Team

    Your interface: <span style="color:#000080">IInstitutionsAppService</span> Your implementation class: <span style="color:#FF0000">ProxyInstitutionAppService ✘ </span> Correct implementation class: <span style="color:#008040">ProxyInstitutionsAppService ✔</span>

    From the ABP docs;

    Naming conventions are very important here. For example, you can change the name of PersonAppService to MyPersonAppService or another name which contains the 'PersonAppService' postfix. This registers it to IPersonAppService because it has the same postfix. You can not, however, name your service without the postfix, such as 'PeopleService'. If you do so, it's not registered to the IPersonAppService automatically. Instead, it's registered to the DI framework using self-registration (not the interface). In this case, you can manually register it.

    <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Dependency-Injection#conventional-registrations">https://aspnetboilerplate.com/Pages/Doc ... istrations</a>

  • User Avatar
    0
    avanekar02 created

    thanks alper

  • User Avatar
    0
    alper created
    Support Team

    fixed?