Base solution for your next web application

Activities of "Leonardo.Willrich"

Hi @ismcagdas, I have sent you and email. Sorry, I haven't noticed your answer before!

Hi,

Unfortunately, the same error even removing the line above.

@ismcagdas,

New issue created as requested:

https://github.com/aspnetzero/aspnet-zero-core/issues/3633

Hi @ismcagdas

Yes, I can, see below:

JS (Just the dataTable creation):

var dataTable = _$apiariesTable.DataTable({
            scrollY: "calc(100vh - 505px)",
            scrollCollapse: false,
            paging: true,
            serverSide: true,
            processing: true,
            listAction: {
                ajaxFunction: _apiariesService.getAll,
                inputFilter: function () {
                    return {
					filter: $('#ApiariesTableFilter').val(),
					apiaryNameFilter: $('#ApiaryNameFilterId').val(),
					minNumberOfBoxesFilter: $('#MinNumberOfBoxesFilterId').val(),
					maxNumberOfBoxesFilter: $('#MaxNumberOfBoxesFilterId').val(),
					apiaryStatusStatusTextFilter: $('#ApiaryStatusStatusTextFilterId').val(),
					apiaryTypeTextFilter: $('#ApiaryTypeTextFilterId').val(),
					geolocationGeocodedAddressFilter: $('#GeolocationGeocodedAddressFilterId').val(),
					landOwnerNameFilter: $('#LandOwnerNameFilterId').val()
                    };
                }
            },
            columnDefs: [
                {
                    width: 120,
                    targets: 0,
                    data: null,
                    orderable: false,
                    autoWidth: false,
                    defaultContent: '',
                    rowAction: {
                        cssClass: 'btn btn-brand dropdown-toggle',
                        text: '<i class="fa fa-cog"></i> ' + app.localize('Actions') + ' <span class="caret"></span>',
                        items: [
						{
                                text: app.localize('View'),
                                action: function (data) {
                                    _viewApiariesModal.open({ data: data.record });
                                }
                        },
						{
                            text: app.localize('Edit'),
                            visible: function () {
                                return _permissions.edit;
                            },
                            action: function (data) {
                                _createApiaryModalManager.open({ id: data.record.apiaries.id });
                                //_createOrEditModal.open({ id: data.record.apiaries.id });
                            }
                        }, 
						{
                            text: app.localize('Delete'),
                            visible: function () {
                                return _permissions.delete;
                            },
                            action: function (data) {
                                deleteApiaries(data.record.apiaries);
                            }
                        }]
                    }
                },					
					{
						targets: 1,
						data: "apiaries.apiaryName",
						name: "apiaryName"   
                    },                    
					{
						targets: 2,
                        data: "apiaries.estimatedNoOfHives",
                        name: "estimatedNoOfHives"   
					},					
					{
						targets: 3,
						data: "apiaryStatusStatusText",
						name: "apiaryStatus.StatusText" 
                    },
                    {
						targets: 4,
						data: "apiaryTypeText",
						name: "apiaryType.Type" 
					},
					{
						targets: 5,
						data: "geolocationGeocodedAddress",
						name: "geolocation.GeocodedAddress" 
					},					
					{
						targets: 6,
						data: "landOwnerName",
						name: "landOwner.Name" 
                    },
                    {
                        targets: 7,
                        data: "apiaries.creationTime",
                        name: "creationTime",
                        render: function (creationTime) {
                            console.log('creationTime', creationTime);
                            return app.utils.date.getUTCtoLocalDateTime(creationTime, 'ddd DD-MMM-YYYY HH:mm');
                        }
                    },
                    {
                         targets: 8,
                         data: "createdBy",
                         name: "CreatorUser.UserName"
                    }
            ]
        });

CSHTML (All):

@using ASL.iAPIS.Authorization
@using ASL.iAPIS.Web.Areas.iAPIS.Models.Apiaries
@using ASL.iAPIS.Web.Areas.iAPIS.Startup
@model ApiariesViewModel
@{
    ViewBag.CurrentPageName = iAPISPageNames.Tenant.ApiariesMaint;
}
@section Scripts
    {
    <link rel="stylesheet" href="/leaflet_files/screen.css" />
    <link href="~/leaflet_files/leaflet.css" rel="stylesheet" />
    <script src="~/leaflet_files/leaflet.js"></script>
    <script src="~/leaflet_files/bundle.min.js"></script>


    <script src="~/leaflet_files/dist/esri-leaflet.js"></script>

    <link href="~/leaflet_files/dist/esri-leaflet-geocoder.css" rel="stylesheet" />
    <script src="~/leaflet_files/dist/esri-leaflet-geocoder.js"></script>


    <script src="~/lib/kendo-ui/js/jszip.min.js" asp-append-version="true"></script>
    <script src="~/lib/kendo-ui/js/kendo.all.min.js" asp-append-version="true"></script>
    <script src="~/lib/kendo-ui/js/kendo.aspnetmvc.min.js" asp-append-version="true"></script>

    @*<script src="~/lib/fileuploader/file-upload-with-preview.min.js" asp-append-version="true"></script>
    <link href="~/lib/fileuploader/file-upload-with-preview.min.css" rel="stylesheet" asp-append-version="true"/>*@

    <link href="/leaflet_files/extramarkers/leaflet.extra-markers.min.css" rel="stylesheet" />
    <script src="~/leaflet_files/extramarkers/leaflet.extra-markers.js"></script>

    <script src="/leaflet_files/Leaflet.Control.Custom.js"></script>
    <script src="~/leaflet_files/leaflet-omnivore.min.js"></script>
    @*<script src='//api.tiles.mapbox.com/mapbox.js/plugins/leaflet-omnivore/v0.3.1/leaflet-omnivore.min.js'></script>*@

    <script abp-src="/view-resources/Areas/iAPIS/Views/Apiaries/Index.js" asp-append-version="true"></script>
}
<div class="content d-flex flex-column flex-column-fluid" id="kt_content">
    <div class="subheader py-2 py-lg-4 subheader-solid" id="kt_subheader" kt-hidden-height="54" style="">
        <div class="container-fluid d-flex align-items-center justify-content-between flex-wrap flex-sm-nowrap">
            <!--begin::Info-->
            <div class="col-md-6">
                <div class="d-flex align-items-center flex-wrap mr-1">
                    <!--begin::Page Title-->
                    <h5 class="text-dark font-weight-bolder mt-2 mb-2 mr-5 font-size-h3">
                        @L("Apiaries")
                    </h5>
                    <!--end::Page Title-->
                    <div class="subheader-separator subheader-separator-ver mt-2 mb-2 mr-5 bg-gray-200"></div>
                    <span class="text-dark font-weight-normal font-sub-title mr-4">@L("ApiariesHeaderInfo")</span>

                </div>
            </div>
            <div class="col-md-6 text-right">
                <button id="ExportToExcelButton" class="btn btn-outline-success"><i class="fa fa-file-excel-o"></i> @L("ExportToExcel")</button>
                @if (IsGranted(AppPermissions.Pages_Apiaries_Create))
                {
                    <button id="CreateNewApiariesButton" class="btn btn-primary blue"><i class="fa fa-plus"></i> @L("CreateNewApiaries")</button>
                }
            </div>
            <!--end::Info-->
        </div>
    </div>



    <div class="container-fluid">
        <div class="card card-custom gutter-b">
            <div class="card-body">
                <div class="m-content">
                    <div class="m-portlet m-portlet--mobile">
                        <div class="m-portlet__body portlet-body-pd">
                            <div class="m-form m-form--label-align-right">
                                <div class="row align-items-center m--margin-bottom-10">
                                    <div class="col-xl-12 pd-0">
                                        <div class="form-group m-form__group align-items-center">
                                            <div class="input-group">
                                                <input type="text" id="ApiariesTableFilter" class="form-control m-input" placeholder="@L("SearchWithThreeDot")" value="@Model.FilterText">
                                                <span class="input-group-btn">
                                                    <button id="GetApiariesButton" class="btn btn-primary" type="submit"><i class="flaticon-search-1"></i></button>
                                                </span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div id="AdvacedAuditFiltersArea" style="display: none" class="row m--margin-bottom-10">
                                <div class="col-md-12">
                                    <div class="m-separator m-separator--dashed"></div>
                                </div>


                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label for="ApiaryNameFilterId">@L("ApiaryName")</label>
                                        <input type="text" class="form-control" name="apiaryNameFilter" id="ApiaryNameFilterId">
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label for="MinNumberOfBoxesFilterId">@L("MinMax") @L("NumberOfBoxes")</label>
                                        <div class="input-group">
                                            <input type="number" class="form-control m-input" placeholder="@L("MinValue")" name="minNumberOfBoxesFilter" id="MinNumberOfBoxesFilterId" />
                                            <input type="number" class="form-control m-input" placeholder="@L("MaxValue")" name="maxNumberOfBoxesFilter" id="MaxNumberOfBoxesFilterId" />
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label for="ApiaryStatusStatusTextFilterId">(@L("ApiaryStatus")) @L("StatusText")</label>
                                        <input type="text" class="form-control" name="apiaryStatusStatusTextFilter" id="ApiaryStatusStatusTextFilterId">
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label for="ApiaryTypeTextFilterId">@L("Type")</label>
                                        <input type="text" class="form-control" name="apiaryTypeTextFilter" id="ApiaryTypeTextFilterId">
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label for="GeolocationGeocodedAddressFilterId">(@L("Geolocation")) @L("GeocodedAddress")</label>
                                        <input type="text" class="form-control" name="geolocationGeocodedAddressFilter" id="GeolocationGeocodedAddressFilterId">
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label for="LandOwnerNameFilterId">(@L("LandOwner")) @L("Name")</label>
                                        <input type="text" class="form-control" name="landOwnerNameFilter" id="LandOwnerNameFilterId">
                                    </div>
                                </div>

                            </div>
                            <div class="row m--margin-bottom-10">
                                <div class="col-xl-12">
                                    <span id="ShowAdvancedFiltersSpan" class="text-muted clickable-item"><i class="fa fa-angle-down"></i> @L("ShowAdvancedFilters")</span>
                                    <span id="HideAdvancedFiltersSpan" class="text-muted clickable-item" style="display: none"><i class="fa fa-angle-up"></i> @L("HideAdvancedFilters")</span>
                                </div>
                            </div>
                            <div class="row align-items-center">
                                <table id="ApiariesTable" class="display table table-striped table-bordered table-hover dt-responsive nowrap">
                                    <thead>
                                        <tr>
                                            <th>@L("Actions")</th>
                                            <th>@L("ApiaryName")</th>
                                            <th>@L("NumberOfHives")</th>
                                            <th>@L("Status")</th>
                                            <th>@L("Type")</th>
                                            <th>@L("Location")</th>
                                            <th>@L("LandOwnerName")</th>
                                            <th>@L("CreationTime")</th>
                                            <th>@L("CreatedBy")</th>

                                        </tr>
                                    </thead>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version? - 9.0.1

  • What is your product type (Angular or MVC)? - MVC

  • What is product framework type (.net framework or .net core)? - .NET Core

  • Which theme are you using? - Metronic Default

  • What are the theme settings? The default settings, I have removed the Visual Settings from my project, then the user will not be able to change that.

Hi,

I am getting an odd behaviour from DataTables in my Settings forms. If the grid (database) has some columns and there is a long text in some of the columns, when sorting the grid it is messing the header as you can see in the picture below:

Do you guys have any idea what is wrong here?

I cannot share my project, but we can set up a remote access to my local machine if you want to!

Kind Regards,

Leonardo Willrich.

Here is were is the issue, when clicking on "Selected permission (0)" it will open the permission tree. Selecting too many permission, it create that url request too long.

Hi. He is the url:

/api/services/app/Role/GetRoles?permissions[0]=Pages.Administration.TaskVistsGroup&permissions[1]=Pages.Administration.iAPIS.Settings&permissions[2]=Pages&permissions[3]=Pages.Administration.Hazards&permissions[4]=Pages.Administration.Hazards.Create&permissions[5]=Pages.Administration.Hazards.Delete&permissions[6]=Pages.Administration.Hazards.Edit&permissions[7]=Pages.Administration.Materials&permissions[8]=Pages.Administration.Materials.Create&permissions[9]=Pages.Administration.Materials.Delete&permissions[10]=Pages.Administration.Materials.Edit&permissions[11]=Pages.Administration.VisitObservationQuestionTemplates&permissions[12]=Pages.Administration.VisitObservationQuestionTemplates.Create&permissions[13]=Pages.Administration.VisitObservationQuestionTemplates.Delete&permissions[14]=Pages.Administration.VisitObservationQuestionTemplates.Edit&permissions[15]=Pages.TaskGroups&permissions[16]=Pages.TaskGroups.Create&permissions[17]=Pages.TaskGroups.Delete&permissions[18]=Pages.TaskGroups.Edit&permissions[19]=Pages.TaskStatus&permissions[20]=Pages.TaskStatus.Create&permissions[21]=Pages.TaskStatus.Delete&permissions[22]=Pages.TaskStatus.Edit&permissions[23]=Pages.Tasks&permissions[24]=Pages.Tasks.Create&permissions[25]=Pages.Tasks.Delete&permissions[26]=Pages.Tasks.Edit&permissions[27]=Pages.Administration.VisitStatus&permissions[28]=Pages.Administration.VisitStatus.Create&permissions[29]=Pages.Administration.VisitStatus.Delete&permissions[30]=Pages.Administration.VisitStatus.Edit&permissions[31]=Pages.Administration.VisitTemplates&permissions[32]=Pages.Administration.VisitTemplates.Create&permissions[33]=Pages.Administration.VisitTemplates.Delete&permissions[34]=Pages.Administration.VisitTemplates.Edit&permissions[35]=Pages.Administration.WorkerCrews&permissions[36]=Pages.Administration.WorkerCrews.Create&permissions[37]=Pages.Administration.WorkerCrews.Delete&permissions[38]=Pages.Administration.WorkerCrews.Edit&permissions[39]=Pages.Administration.WorkerMPE&permissions[40]=Pages.Administration.WorkerVehicles&permissions[41]=Pages.Administration.WorkerVehicles.Create&permissions[42]=Pages.Administration.WorkerVehicles.Delete&permissions[43]=Pages.Administration.WorkerVehicles.Edit

Hi,

I am using AspNetZero MVC JQuery .NET CORE framework, version 9.0.1.

In Roles, there is a new filter for Roles based on Permission. Clicking in the button, it will popup a modal form with all permission in a tree (PermissionTreeModal).

If the user select too many permissions (44 in my case), the request url is too big and an exception is thrown:

HTTP Error 404.15 - Not Found The request filtering module is configured to deny a request where the query string is too long.

Is there some fix for that?

Hi @ismcagdas,

I am aware about that. But, the point is that I don't want to commit my changes into the database yet. If something is wrong next, I want to rollback my transaction (raising an exception in this case). If I call SaveChanges, it will be persisted straightaway in the database and there is no way to revert that, only doing it manually by delete command instead of using the rollback on the transaction created by the CurrentUnitOfWork.

Any other solution for that?

The most strange thing is, in another routine where I am importing a record from a spreadsheet, I have a loop that create the entity, assign the fields and insert the new entity and get the ID for that. In the begin, I have a validation to check if the name already exist in the database just to avoid duplicated records. And in this method it is working like I wish. Has the function InsertAndGetId() a different behaviour?

e.g.:

name = spreadsheet[row, colName];
While (name != '')
{
    var person = _personRepository.GetAll().Where(p => p.name == name).FirstOrDefault();
    if (person != null)
    {
        AddError("Person already exists: " + name);
    }

    var record = new person();
    record.name = name;
    
    record.Id = _personRepository.InsertAndGetId(person);
    
    row++;
    name = spreadsheet[row, colName];
}

So, in this example above, it seems to be reading the person insert previously, even though I haven't used SaveChanges to commit the records inserted.

Thank you in advanced!

Hi,

I am trying to import records from a file and I do have separated files for each entity. So, first I want to insert all master records, and next insert all details record, however, when I try to read the master from the DB using EF, it is not working.

Basically, I would like it be working:

_typeRepository.Insert(new Type()
{
    Type = "test",
});

var typed = _typeRepository.GetAll().Where(a => a.Type == "test").FirstOrDefault();

In this example, typed is always null.

In the SQL Server Management Studio, If I create a transaction, insert a new record and perform a select, the record will be there.

How can I use the same transaction to performance the GetAll command?

Thanks in advance!

Showing 31 to 40 of 78 entries