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

Activities of "geoteam"

What is your product version? 11.4.0 RC1 What is your product type (Angular or MVC)? Angular What is product framework type (.net framework or .net core)? .NET 6

Hi, we are using an Angular-Module that requires raw Html-Links to our WebApi. When we try to use the raw link to the WebApi-methode the request will be redirected to the login page, since the user isn't authenticated because of the missing token. Since the servers WebApi is hosted under a different domain (http://localhost:44301) then the client-application (http://localhost:4200) there isn't even an authentication cookie for this domain. We are aware of using the AbpAllowAnonymous decorator attribute to allow anonymous access to the WebApi. But in our methode we have to use the tenantId which isn't set since we are not authorized.

What is the correct way to request the WebApi directly with authorization information.

Thanks

What is your product version? 11.1.0 What is your product type (Angular or MVC)? Angular What is product framework type (.net framework or .net core)? .NET 6 What theme are you using? metronic default

Hi support, we wanted to use the function KTSwapper (seen in metronic HTML) to display the PageTitle in the header (kt_header_nav) instead of the menu and to automatically switch the title to the body on small displays.

Under metronic/app/kt/components many KT components are already available. Unfortunately, there is no SwapperComponent.

Is this component currently being implemented or is there a better way to solve our problem? In VueJS and React, this componente seems to already exist.

Many thanks in advance, Frank

Hi, I tried to update an exiting project to an new release of AspNet Zero as described in your docu under Common->Other->Version Upgrade. I stuck on the point "copy your exisitng project's source code to migrate branche".

How should I copy my code to the migrate branch? In the explorer from the backupfolder of my existing code to the folder where the newly created AspNet Zero project is created, somehow in VS or from explorer to VS-Window?

What should I copy? The complet project folder under repros or for example only css, cshtm, cs... files without for example github-files?

After copying my existing project from base folder over the new created AspNet Zero folder switched to migrate branch before, I get an error from Github like "sh an das Remoterepository: rejected Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes before pushing again.."

Can you explain the part "Copy your existing project's source code to migrate branch" in more detail?

What I have done so far:

  1. Downloaded my initial version of AspNet Zero and create a runable project (as described in getting started).
  2. Pushed this project to a new github repository (as master).
  3. Created the branches dev from master and migrate and aspnetzero from dev.

Kind regards, Frank

Hello, I'm having trouble embedding a view component into a Modal Insert/Edit form. Is it possible that this does not work? I have tried to analyze the error, but the only thing that is displayed: POST http://localhost:62114/App/Addresses/CreateOrEditAddressModal 500 (Internal Server Error) in app-layout-libs.min.js:10320

_CreateOrEditAddressModal.cshtml:

@using Zero.Addresses
@using Zero.Web.Areas.App.Models.Common.Modals
@using Zero.Web.Areas.App.Views.Shared.Components.AppModalRegTable

@model Zero.Web.Areas.App.Models.Addresses.CreateOrEditAddressModalViewModel
@await Html.PartialAsync("\~/Areas/App/Views/Common/Modals/\_ModalHeader.cshtml", new ModalHeaderViewModel(Model.IsEditMode ? (L("EditAddress") + ": " + Model.AddressPersonCompany.PersonCompanyNameCompany) : L("CreateNewAddress")))

<div class="modal-body">
    <form role="form" novalidate class="form-validation kt-form">
        .
        .
        .
     </form>
    @await Html.PartialAsync("~/Areas/App/Views/Common/Modals/_ModalFooterWithSaveAndCancel.cshtml")
</div>
<div class="modalForm__RegisterTablePartial">
    @await Component.InvokeAsync(typeof(AppModalRegisterTableViewComponent), new { registerTable = "Title" })
</div>

Default.cshtml (for testing) of Viewcomponent

@model TreasureMap.Web.Areas.App.Models.RegisterTable.RegisterTableViewModel
<div></div>

AppModalRegisterTableViewComponent:

public class AppModalRegisterTableViewComponent : ZeroMapViewComponent
    {      
        public AppModalRegisterTableViewComponent()
        {
            
        }

        public IViewComponentResult Invoke(string registerTable)
        {
            var regTableModel = new RegisterTableViewModel
            {
                DisplayName = string.Empty,
                TableName = string.Empty
            };

            return View(regTableModel);
        }        
    }

Comment out the line @await Component.Invoke... then modal window is shown. At another place (in the menu bar) I also have a ViewComponent. There it works.

Hello, I have an area in my program which repeats itself in different places again and again. I would like to implement this as a view component. A database table is always retrieved in this view component. This database table always has the structure ID, "name". Depending on the area where the view component is used, a different database table is required. The table name of the view component is therefore passed as a parameter. What is the best way to implement this in the existing abp structure, since you normally always work with a particular (named) repository using dependency injection. In my case I would need a "generic" repository, which is filled by the required database table (parameter table name). Even custom repositories always seem to depend on a specific entity. I hope this is understandable :-)

Hello, I have three database tables Address, PersonCompany and a link table AddressPersonCompany (m:n). In the frontend there is a display form which is very similar to the page "users" - a text field for a search word and a datatable to display the search result (addresses).

Following the instructions "Using-Stored-Procedures,-User-Defined-Functions-and-Views" I created three custom repositories.

If a new address is created via the modal window, first the Address table, then the PersonCompany table and finally the link table AddressPersonCompany is filled. In AddressPersonCompany there is an additional column in which a search text is written. For test purposes, the search text is predefined as "Spieth".

The problem is that before the insert the search was restricted to "S", for example. Accordingly the new dataset should appear immediately in the datatable, because it also starts with "S". After the insert, as with "Users" a

function getAddresses() {
            dataTable.ajax.reload();
        }

triggered. However, the new data record is only displayed after a page update (for example, F5).

When the record is updated, you can see that the Address and PersonCompany table is written on time, but the search text is changed too late. In the Datatable the changed values already exist, but the dataset should not be displayed anymore, because the search text was changed from "Spieth" to e.g. "Test".

Therefore I think that the function "getAddresses()" is executed before the dataset has been updated or completely inserted.

Can you give me a hint how to solve the problem?

Here is my insert function

public async Task CreateOrUpdateAddress(CreateOrUpdateAddressInput input)
        {
            if (input.AddressPersonCompanyId.HasValue)
            {
                // Update addressPersonCompany
                await UpdateAddressAsync(input);
            }
            else
            {
                // Insert addressPersonCompany
                await InsertAddressAsync(input);
            }            
            
            // Save changes to database
            //await CurrentUnitOfWork.SaveChangesAsync();            
        }
        
protected virtual async Task InsertAddressAsync(CreateOrUpdateAddressInput input)
        {
            var addressPersonCompany = ObjectMapper.Map<AdrAddressPersonCompany>(input);

            addressPersonCompany.AddressId = await _addressRepository.InsertAndGetIdAsync(addressPersonCompany.Address);
            addressPersonCompany.PersonCompanyId = await _personCompanyRepository.InsertAndGetIdAsync(addressPersonCompany.PersonCompany);
            addressPersonCompany.Searchtext = "Spieth";
            
            await CurrentUnitOfWork.SaveChangesAsync(); //To get new user's Id.

            //AdrAddressPersonCompany _newAdrAddressPersonCompany = await _addressPersonCompanyRepository.InsertAsync(addressPersonCompany);
            var addressPersonCompanyId = await _addressPersonCompanyRepository.InsertAndGetIdAsync(addressPersonCompany);

            await CurrentUnitOfWork.SaveChangesAsync(); //To get new user's Id.
            // Create searchtext in table adrAddressPersonCompanies
            //await _addressPersonCompanyRepository.UpdateSearchtextOnAddressPersonCompanies(addressPersonCompany.AddressId, addressPersonCompany.PersonCompanyId, _session.TenantId);
            }
            
protected virtual async Task UpdateAddressAsync(CreateOrUpdateAddressInput input)
        {
            //Update existing AddressPersonCompany
            var address = await _addressRepository.GetAsync(input.AddressId);
            address.Street = input.AddressStreet;
            address.Location = input.AddressLocation;
            address.HouseNumber = input.AddressHouseNumber;
            address.Zipcode = input.AddressZipcode;
            await _addressRepository.UpdateAsync(address);


            var personCompany = await _personCompanyRepository.GetAsync(input.PersonCompanyId);
            personCompany.NameCompany = input.PersonCompanyNameCompany;
            personCompany.Firstname = input.PersonCompanyFirstname;
            personCompany.TitleId = input.PersonCompanyTitleId;
            personCompany.CompanyAddOn = input.PersonCompanyCompanyAddOn;
            await _personCompanyRepository.UpdateAsync(personCompany);

            await CurrentUnitOfWork.SaveChangesAsync(); //To get new user's Id.

            // Create searchtext in table adrAddressPersonCompanies
            await _addressPersonCompanyRepository.UpdateSearchtextOnAddressPersonCompanies(input.AddressId, input.PersonCompanyId, _session.TenantId);
        }

and the standard part of _CreateOrEditModal

this.save = function () {
            if (!_$form.valid()) {
                return;
            }

            var address = _$form.serializeFormToObject();

            _modalManager.setBusy(true);

            // direkt die Funktion aus AddressAppService verwendet
            _addressService.createOrUpdateAddress(address).done(function () {
                abp.notify.info(app.localize('SavedSuccessfully'));
                _modalManager.close();
                abp.event.trigger('app.createOrEditAddressModalSaved');
                //location.reload();
            }).always(function () {
                _modalManager.setBusy(false);
            });
        };

I am trying to create a query that queries an address and person using multiple keywords. There is a person table, an address table and a link table addressPerson (m:n). The query looks like this:

var searchwords = !input.Filter.IsNullOrEmpty() ? input.Filter.Split(" ") : null;

            var query = _addressPersonCompanyRepository
                .GetAll()
                .Include(a => a.Address)
                .Include(p => p.PersonCompany)
                .Include(t => t.PersonCompany.Title)
                .WhereIf(
                    !input.Filter.IsNullOrEmpty(),
                    e => searchwords.All(w => String
                    .Join(" ", e.PersonCompany.NameCompany, e.PersonCompany.Firstname, e.Address.Street, e.Address.Location)
                    .Contains(w, StringComparison.InvariantCultureIgnoreCase))
                    )
                //.ToList();
                .AsQueryable();

            var addressCount = await query.CountAsync();

            var addressPersonCompanies = query
                .OrderBy(input.Sorting)
                //.PageBy(input)
                .ToList();

            var addressPersonCompanyListDto = ObjectMapper.Map<List<AddressPersonCompanyDto>>(addressPersonCompanies);

            return new PagedResultDto<AddressPersonCompanyDto>(
                addressCount,
                addressPersonCompanyListDto
                );

Without the namespace Abp.Linq.Extensions and .ToList() the query works if searchwords contains one or more strings. If the namespace is added because it is needed for .PageBy, I get the following error message:

System.InvalidOperationException HResult=0x80131509 Nachricht = The LINQ expression 'DbSet<AdrAddressPersonCompany> .Where(a => __ef_filter__p_0 || !(((ISoftDelete)a).IsDeleted) && __ef_filter__p_1 || (Nullable<int>)((IMustHaveTenant)a).TenantId == __ef_filter__CurrentTenantId_2) .Join( outer: DbSet<AdrPersonCompany> .Where(a0 => __ef_filter__p_3 || !(((ISoftDelete)a0).IsDeleted) && __ef_filter__p_4 || (Nullable<int>)((IMustHaveTenant)a0).TenantId == __ef_filter__CurrentTenantId_5), inner: a => EF.Property<Nullable<long>>(a, "PersonCompanyId"), outerKeySelector: a0 => EF.Property<Nullable<long>>(a0, "Id"), innerKeySelector: (o, i) => new TransparentIdentifier<AdrAddressPersonCompany, AdrPersonCompany>( Outer = o, Inner = i )) .Join( outer: DbSet<AdrAddress> .Where(a1 => __ef_filter__p_6 || !(((ISoftDelete)a1).IsDeleted) && __ef_filter__p_7 || (Nullable<int>)((IMustHaveTenant)a1).TenantId == __ef_filter__CurrentTenantId_8), inner: a => EF.Property<Nullable<long>>(a.Outer, "AddressId"), outerKeySelector: a1 => EF.Property<Nullable<long>>(a1, "Id"), innerKeySelector: (o, i) => new TransparentIdentifier<TransparentIdentifier<AdrAddressPersonCompany, AdrPersonCompany>, AdrAddress>( Outer = o, Inner = i )) .Where(a => __searchwords_0 .All(w => string.Join( separator: " ", value: new string[] { a.Outer.Inner.NameCompany, a.Outer.Inner.Firstname, a.Inner.Street, a.Inner.Location }).Contains( value: w, comparisonType: InvariantCultureIgnoreCase)))' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information. Quelle = Microsoft.EntityFrameworkCore

I have tested:

  1. ToList() without namesspace => work
  2. ToList() with namespace => error
  3. .AsQueryable() with/without namespace => shows intern error

Is there any workaround or a better way to get results from database with multiple keywords over multiple columns? I'm using .netCore & JQuery

Showing 1 to 7 of 7 entries