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

Activities of "avanekar02"

Answer

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

Answer

i did remove the IInstitutionsExcelExporter _institutionsExcelExporter;

but no still the same issues

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

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>

Answer

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

Answer

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

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

if you are refrerring to call from indes.js of user to createoreditmodal.js i fail to understand can you please point me to the part .

regards Anwar

Thanks

what do you mean by "i write PM" my email id is <a href="mailto:[email protected]">[email protected]</a>

Showing 71 to 80 of 185 entries