Activities of "moinahmed"

I have multiple custom modules implemented in my project and they have their own dbcontext classes.I'm unsure about the order of execution in such cases. How the different dbcontexts gets called? What is the best practice out here? I also need to implement some filtering as described here in each dbcontext: https://abp.io/community/articles/switching-between-organization-units-i5tokpzt

I tried to disable the feature but it didn't work

Configure<AbpAspNetCoreMvcOptions>(options =>
{
    options.ConventionalControllers.Create(typeof(IosIdentityApplicationModule).Assembly);
});

Adding above lines made it working, but for some reason all the filters of the GET listing call have become mandatory. Getting the following error:

{
  "error": {
    "code": null,
    "message": "Your request is not valid!",
    "details": "The following errors were detected during validation.\r\n - The Name field is required.\r\n - The FilterText field is required.\r\n",
    "data": {},
    "validationErrors": [
      {
        "message": "The Name field is required.",
        "members": [
          "name"
        ]
      },
      {
        "message": "The FilterText field is required.",
        "members": [
          "filterText"
        ]
      }
    ]
  }
}

for some reason the controllers were not auto generated; any idea what could be wrong?

It seems we are using Dynamic proxy, but for some reason it is not being generated; any idea what could be the reason?

How can I make it part of build process?

how to do that, can you share the steps?

Here's my Application Service:

using IosIdentity.Shared;
using Volo.Abp.Identity;
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Linq.Dynamic.Core;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using IosIdentity.Permissions;
using IosIdentity.PS3;

namespace IosIdentity.PS3
{

    [Authorize(IosIdentityPermissions.AgencyCustomers.Default)]
    public class AgencyCustomersAppService : ApplicationService, IAgencyCustomersAppService
    {

        private readonly IAgencyCustomerRepository _agencyCustomerRepository;
        private readonly AgencyCustomerManager _agencyCustomerManager;
        private readonly IRepository<OrganizationUnit, Guid> _organizationUnitRepository;

        public AgencyCustomersAppService(IAgencyCustomerRepository agencyCustomerRepository, AgencyCustomerManager agencyCustomerManager, IRepository<OrganizationUnit, Guid> organizationUnitRepository)
        {

            _agencyCustomerRepository = agencyCustomerRepository;
            _agencyCustomerManager = agencyCustomerManager; _organizationUnitRepository = organizationUnitRepository;
        }

        public virtual async Task<PagedResultDto<AgencyCustomerWithNavigationPropertiesDto>> GetListAsync(GetAgencyCustomersInput input)
        {
            var totalCount = await _agencyCustomerRepository.GetCountAsync(input.FilterText, input.Name, input.BrandId, input.AnswerDataUploadOptionId, input.SubAccountInventoryControlTypeId, input.AllowSubAccounts, input.OrganizationUnitId);
            var items = await _agencyCustomerRepository.GetListWithNavigationPropertiesAsync(input.FilterText, input.Name, input.BrandId, input.AnswerDataUploadOptionId, input.SubAccountInventoryControlTypeId, input.AllowSubAccounts, input.OrganizationUnitId, input.Sorting, input.MaxResultCount, input.SkipCount);

            return new PagedResultDto<AgencyCustomerWithNavigationPropertiesDto>
            {
                TotalCount = totalCount,
                Items = ObjectMapper.Map<List<AgencyCustomerWithNavigationProperties>, List<AgencyCustomerWithNavigationPropertiesDto>>(items)
            };
        }

        public virtual async Task<AgencyCustomerWithNavigationPropertiesDto> GetWithNavigationPropertiesAsync(Guid id)
        {
            return ObjectMapper.Map<AgencyCustomerWithNavigationProperties, AgencyCustomerWithNavigationPropertiesDto>
                (await _agencyCustomerRepository.GetWithNavigationPropertiesAsync(id));
        }

        public virtual async Task<AgencyCustomerDto> GetAsync(Guid id)
        {
            return ObjectMapper.Map<AgencyCustomer, AgencyCustomerDto>(await _agencyCustomerRepository.GetAsync(id));
        }

        public virtual async Task<PagedResultDto<LookupDto<Guid>>> GetOrganizationUnitLookupAsync(LookupRequestDto input)
        {
            var query = (await _organizationUnitRepository.GetQueryableAsync())
                .WhereIf(!string.IsNullOrWhiteSpace(input.Filter),
                    x => x.DisplayName != null &&
                         x.DisplayName.Contains(input.Filter));

            var lookupData = await query.PageBy(input.SkipCount, input.MaxResultCount).ToDynamicListAsync<OrganizationUnit>();
            var totalCount = query.Count();
            return new PagedResultDto<LookupDto<Guid>>
            {
                TotalCount = totalCount,
                Items = ObjectMapper.Map<List<OrganizationUnit>, List<LookupDto<Guid>>>(lookupData)
            };
        }

        [Authorize(IosIdentityPermissions.AgencyCustomers.Delete)]
        public virtual async Task DeleteAsync(Guid id)
        {
            await _agencyCustomerRepository.DeleteAsync(id);
        }

        [Authorize(IosIdentityPermissions.AgencyCustomers.Create)]
        public virtual async Task<AgencyCustomerDto> CreateAsync(AgencyCustomerCreateDto input)
        {

            var agencyCustomer = await _agencyCustomerManager.CreateAsync(
            input.OrganizationUnitId, input.Name, input.AllowSubAccounts, input.BrandId, input.AnswerDataUploadOptionId, input.SubAccountInventoryControlTypeId
            );

            return ObjectMapper.Map<AgencyCustomer, AgencyCustomerDto>(agencyCustomer);
        }

        [Authorize(IosIdentityPermissions.AgencyCustomers.Edit)]
        public virtual async Task<AgencyCustomerDto> UpdateAsync(Guid id, AgencyCustomerUpdateDto input)
        {

            var agencyCustomer = await _agencyCustomerManager.UpdateAsync(
            id,
            input.OrganizationUnitId, input.Name, input.AllowSubAccounts, input.BrandId, input.AnswerDataUploadOptionId, input.SubAccountInventoryControlTypeId, input.ConcurrencyStamp
            );

            return ObjectMapper.Map<AgencyCustomer, AgencyCustomerDto>(agencyCustomer);
        }
    }
}

Yes, I'm using MVC Razor. When I debug the code and put the breakpoint on var agencyCustomerService = window.iosIdentity.pS3.agencyCustomers; I can see iosIdentity namespace is picked, however, the next part pS3 never realized and throws error.

$(function () {
    var l = abp.localization.getResource("IosIdentity");
	
    var agencyCustomerService = window.iosIdentity.pS3.agencyCustomers;
	
        var lastNpIdId = '';
        var lastNpDisplayNameId = '';

        var _lookupModal = new abp.ModalManager({
            viewUrl: abp.appPath + "Shared/LookupModal",
            scriptUrl: "/Pages/Shared/lookupModal.js",
            modalClass: "navigationPropertyLookup"
        });

        $('.lookupCleanButton').on('click', '', function () {
            $(this).parent().find('input').val('');
        });

        _lookupModal.onClose(function () {
            var modal = $(_lookupModal.getModal());
            $('#' + lastNpIdId).val(modal.find('#CurrentLookupId').val());
            $('#' + lastNpDisplayNameId).val(modal.find('#CurrentLookupDisplayName').val());
        });
	
    var createModal = new abp.ModalManager({
        viewUrl: abp.appPath + "AgencyCustomers/CreateModal",
        scriptUrl: "/Pages/AgencyCustomers/createModal.js",
        modalClass: "agencyCustomerCreate"
    });

	var editModal = new abp.ModalManager({
        viewUrl: abp.appPath + "AgencyCustomers/EditModal",
        scriptUrl: "/Pages/AgencyCustomers/editModal.js",
        modalClass: "agencyCustomerEdit"
    });

	var getFilter = function() {
        return {
            filterText: $("#FilterText").val(),
            name: $("#NameFilter").val(),
			brandId: $("#BrandIdFilter").val(),			
			answerDataUploadOptionId: $("#AnswerDataUploadOptionIdFilter").val(),			
			subAccountInventoryControlTypeId: $("#SubAccountInventoryControlTypeIdFilter").val(),			
            allowSubAccounts: (function () {
                var value = $("#AllowSubAccountsFilter").val();
                if (value === undefined || value === null || value === '') {
                    return '';
                }
                return value === 'true';
            })(),
			organizationUnitId: $("#OrganizationUnitIdFilter").val()
        };
    };

    var dataTable = $("#AgencyCustomersTable").DataTable(abp.libs.datatables.normalizeConfiguration({
        processing: true,
        serverSide: true,
        paging: true,
        searching: false,
        scrollX: true,
        autoWidth: true,
        scrollCollapse: true,
        order: [[1, "asc"]],
        ajax: abp.libs.datatables.createAjax(agencyCustomerService.getList, getFilter),
        columnDefs: [
            {
                rowAction: {
                    items:
                        [
                            {
                                text: l("Edit"),
                                visible: abp.auth.isGranted('IosIdentity.AgencyCustomers.Edit'),
                                action: function (data) {
                                    editModal.open({
                                     id: data.record.agencyCustomer.id
                                     });
                                }
                            },
                            {
                                text: l("Delete"),                                
                                visible: false, // abp.auth.isGranted('IosIdentity.AgencyCustomers.Delete'),
                                confirmMessage: function () {
                                    return l("DeleteConfirmationMessage");
                                },
                                action: function (data) {
                                    return false;
                                    //agencyCustomerService.delete(data.record.agencyCustomer.id)
                                    //    .then(function () {
                                    //        abp.notify.info(l("SuccessfullyDeleted"));
                                    //        dataTable.ajax.reload();
                                    //    });
                                }
                            }
                        ]
                }
            },
			{ data: "agencyCustomer.name" },
			{ data: "agencyCustomer.brandId" },
            {
                data: "agencyCustomer.answerDataUploadOptionId",
                render: function (data) {
                    return l('Enum:UploadOption.' + data);
                }
            },
            {
                data: "agencyCustomer.subAccountInventoryControlTypeId",
                render: function (data) {
                    return l('Enum:ControlType.' + data);
                }
            },
            {
                data: "agencyCustomer.allowSubAccounts",
                render: function (allowSubAccounts) {
                    return allowSubAccounts ? 'Yes' : 'No';
                    //return allowSubAccounts ? '<i class="fa fa-check"></i>' : '<i class="fa fa-times"></i>';
                }
            },
            {
                data: "organizationUnit.displayName",
                defaultContent : ""
            }
        ]
    }));

    createModal.onResult(function () {
        dataTable.ajax.reload();
    });

    editModal.onResult(function () {
        dataTable.ajax.reload();
    });

    $("#NewAgencyCustomerButton").click(function (e) {
        e.preventDefault();
        createModal.open();
    });

	$("#SearchForm").submit(function (e) {
        e.preventDefault();
        dataTable.ajax.reload();
    });

    $('#AdvancedFilterSectionToggler').on('click', function (e) {
        $('#AdvancedFilterSection').toggle();
    });

    $('#AdvancedFilterSection').on('keypress', function (e) {
        if (e.which === 13) {
            dataTable.ajax.reload();
        }
    });

    $('#AdvancedFilterSection select').change(function() {
        dataTable.ajax.reload();
    });
    
    
});
Showing 1 to 10 of 29 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on December 26, 2024, 06:07