Base solution for your next web application

Activities of "mgcode"

Hello,

I'm trying to implement in the xamarin application the mechanism that already exists on the web for social logins. Is there an example about this or can you help me with some code instructions on how to implement this?

Thank you very much. Best Regards

Prerequisites

What is your product version? v12.0.0

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

What is product framework type (.net framework or .net core)? .net core

Hello,

I try to add an accordion control from metronic library in a modal form but it does not work. https://preview.keenthemes.com/metronic/demo1/features/custom/accordions.html

@using System.Globalization
@using IMS.Enums;
@using IMS.Web.Areas.ims.Models.Common.Modals
@using IMS.Web.Areas.ims.Models.Incidents
@model CreateOrEditIncidentsModalViewModel
@using Abp.Extensions
@await Html.PartialAsync("~/Areas/ims/Views/Common/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(Model.IsEditMode ? (L("EditIncidents")) : L("CreateNewIncidents")))

<div class="modal-body">
  <div id="IncidentsInformationsTab">
        <form name="IncidentsInformationsForm" role="form" novalidate class="form-validation">

            <div class="accordion accordion-toggle-arrow" id="accordionExample1">
                <div class="card">
                    <div class="card-header">
                        <div class="card-title" data-toggle="collapse" data-target="#collapseOne1">
                            Latest Orders
                        </div>
                    </div>
                    <div id="collapseOne1" class="collapse show" data-parent="#accordionExample1">
                        <div class="card-body">
                            ...
                        </div>
                    </div>
                </div>
                <div class="card">
                    <div class="card-header">
                        <div class="card-title collapsed" data-toggle="collapse" data-target="#collapseTwo1">
                            Product Updates
                        </div>
                    </div>
                    <div id="collapseTwo1" class="collapse" data-parent="#accordionExample1">
                        <div class="card-body">
                            ...
                        </div>
                    </div>
                </div>
                <div class="card">
                    <div class="card-header">
                        <div class="card-title collapsed" data-toggle="collapse" data-target="#collapseThree1">
                            ...
                        </div>
                    </div>
                    <div id="collapseThree1" class="collapse" data-parent="#accordionExample1">
                        <div class="card-body">
                            ...
                        </div>
                    </div>
                </div>
            </div>      
    </form>
</div>
</div>
@await Html.PartialAsync("~/Areas/ims/Views/Common/Modals/_ModalFooterWithSaveAndCancel.cshtml")

Maybe I have not add an appropriate js file.

Can you please tell me exactly which js and css files I need to add so that I can get exactly the same result as the example https://preview.keenthemes.com/metronic/demo1/features/custom/accordions.html

Thank you in advance!

Hello,

I want to migrate my Xamarin application to the new MAUI project template. In Xamarin, I have a page view (xaml) with a map control bound to the view model Map property <ContentView HeightRequest="650" Content="{Binding Map}"/>

Now in MAUI, I am trying to create a new razor page but I do not know how to bind the MAUI Map control to the razor page.

I also tried to use xaml page but I had trouble navigating and couldn't set the menu item to go to the xaml page. Is this possible to use both razor pages and xaml pages in MAUI?

I would appreciate any help. Thank you in advance.

Prerequisites

  • What is your product version? v11.3.0
  • What is your product type (Angular or MVC)? MVC
  • What is product framework type (.net framework or .net core)? .net core

Hi,

I use notificationPublisher to send a notification to all users using the below code and it works for the web application. await _notificationPublisher.PublishAsync(AppNotificationNames.NewIncident, notificationData,severity: NotificationSeverity.Warn);

But when I connect, using signalr, to abpcommonhub in xamarin application (connection established successfully based on https://support.aspnetzero.com/QA/Questions/6841/Push-notification-implementation-in-Xamarin-Mobile-application) and subscribe to above notification message, I cannot receive it with the below hubconnection message subscription code. HubConnection.On(AppNotificationNames.NewIncident, (message) => { Console.WriteLine("TEST"); });

Below is the code of NotificationService in Xamarin application.

public class NotificationService : ISingletonDependency, INotificationService { public HubConnection HubConnection { get; }

private readonly IAccessTokenManager _accessTokenManager;
private bool _isConnecting;

public NotificationService(IAccessTokenManager accessTokenManager)
{
    try
    {
        _accessTokenManager = accessTokenManager;

        HubConnection = new HubConnectionBuilder()
            .WithUrl(CreateHubUrl(),

            (opts) =>
                {
                    opts.HttpMessageHandlerFactory = (message) =>
                    {
                        if (message is HttpClientHandler clientHandler)
                            // bypass SSL certificate
                            clientHandler.ServerCertificateCustomValidationCallback +=
                                (sender, certificate, chain, sslPolicyErrors) => { return true; };
                        return message;
                    };
                }
            )
            .ConfigureLogging(logging => {
                logging.SetMinimumLevel(LogLevel.Debug);
                logging.AddConsole();
                logging.AddDebug();
            })
            .Build();


        HubConnection.On<string>(AppNotificationNames.NewIncident, (message) =>
        {
            Console.WriteLine("TEST");
        });


        HubConnection.Closed += TryToConnectIfNeeds;

        ConnectAsync().ConfigureAwait(true);
    }
    catch (Exception ex)
    {
        ExceptionHandler.LogException(ex);
    }
}

private async Task TryToConnectIfNeeds(Exception connectionException)
{
    try
    {
        ExceptionHandler.LogException(connectionException);

        if (!_accessTokenManager.IsUserLoggedIn)
        {
            return;
        }

        await Task.Delay(new Random().Next(0, 5) * 1000);
        await HubConnection.StartAsync();
    }
    catch (Exception ex)
    {
        ExceptionHandler.LogException(ex);
    }
}

public async Task<bool> ConnectAsync()
{
    try
    {
        if (HubConnection.State == HubConnectionState.Connected)
        {
            return true;
        }

        if (_isConnecting)
        {
            return false;
        }

        _isConnecting = true;

        await HubConnection.StartAsync();

        Console.WriteLine(@"Connected!");
        return true;
    }
    catch (Exception ex)
    {
        ExceptionHandler.LogException(ex);
        return false;
    }
    finally
    {
        _isConnecting = false;
    }
}


public async Task<bool> DisconnectAsync()
{
    try
    {
        if (HubConnection.State == HubConnectionState.Disconnected)
        {
            return true;
        }

        await HubConnection.StopAsync();

        Console.WriteLine(@"Disconnected!");
        return true;
    }
    catch (Exception ex)
    {
        ExceptionHandler.LogException(ex);
        return false;
    }
}

private string CreateHubUrl()
{
    string accessToken = _accessTokenManager.AuthenticateResult.EncryptedAccessToken;
    return ApiUrlConfig.BaseUrl +
           AppConsts.SignalRAbpCommonHubPath.TrimStart('/')
           + "?" +
           AppConsts.EncryptedAuthTokenQueryStringName + "=" +
           Uri.EscapeDataString(accessToken);
}

}`

Could you please help me?
Thank you in advance!

Hi, with the following snippet of code I have implemented a customAppService method (SubmitQuestionnaireForm) in which I retrieve the object quesionnaire from questionnaireRepository and I set the status property to "UploadedByClient" value.

Then I call the CreateOrEdit default method in which I try to enforce some logic using the previous and new values. In real time, I realised that both questionnaire and input had the new value.

Please advice on which is the proper way to achieve this functionality and perform validation and notifications logic prior to update.

        public async Task<bool> SubmitQuestionnaireForm(object obj, int id)
        {
            var questionnaire = await _questionnaireRepository.GetAsync(id);
            questionnaire.Status = QuestionnaireStatus.UploadedByClient;

            CreateOrEditQuestionnaireDto questionnaireDto = new CreateOrEditQuestionnaireDto();
            questionnaireDto = ObjectMapper.Map<CreateOrEditQuestionnaireDto>(questionnaire);
            await _questionnairesAppService.CreateOrEdit(questionnaireDto);

            return true;
        }    
  
  
  public async Task CreateOrEdit(CreateOrEditQuestionnaireDto input)
         {
            if(input.Id == null){
				await Create(input);
			}
			else{
				await Update(input);
			}
         }
         
         

        private async Task Update(CreateOrEditQuestionnaireDto input)
        {
            var questionnaire = await _questionnaireRepository.FirstOrDefaultAsync((int)input.Id);
            
            bool sendIMS_Questionnaire_Update_Status_QuestionnaireUploadedNotification = false;

            if (questionnaire.Status != QuestionnaireStatus.UploadedByClient && input.Status == QuestionnaireStatus.UploadedByClient)
            {
                sendIMS_Questionnaire_Update_Status_QuestionnaireUploadedNotification = true;
            }

            ObjectMapper.Map(input, questionnaire);

            if (sendIMS_Questionnaire_Update_Status_QuestionnaireUploadedNotification)
            {
                await _appNotifier.IMS_Questionnaire_Update_Status_QuestionnaireUploaded(questionnaire);
            }
        }

Thank you in advance for your time and help

Hello,

I have three user roles: administrators, supervisors and agents. I have set their role permissions so that supervisors have access to the agents and actions entities.

What is the proper way to limit the supervisors' access only to their agents and the actions their agents have conducted?

Thank you in advance for your time and help,

PS. Agents entity has a property SupervisorID and a property UserID and the Actions entity has a property AgentID

Best Regards,

Hello,

I have been assigned a project and my client has not decided on the application name yet. I have to develop a demo application, deploy it in the cloud (Azure), demonstrate it to my client, and, if the client is satisfied, deploy the live version of my project and get paid.

With that in mind, please advice on what is the best way to do it.

  1. Will I be able to achieve the above-mentioned requirements by generating a demo project? What are the actual limitations of a demo project?
  2. Is there a simple way or tool to migrate my code from the demo project with the "whatever" name to my live generated project with the right name?
  3. If I go with one name to generate a live project can I change the name later?

Thank you in advance for your time and help,

Best Regards,

Showing 1 to 7 of 7 entries