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

Activities of "MellowoodMedical"

Hi,

How can I access log4net.ThreadContext.Properties in my service class to support custom log4net properties.

Thanks

We are using multiple databases for the our project. Now we have created a custom implementation for IEntityHistoryStore and used it to replace the default implementation. Also, we have uncommented lines to write change logs for the entities and added the entity type for Entity History selectors. The problem is that Entity History works for entities stored in the one database and doesn't work for entities stored in another databases. Do you have any suggestions for that?

The version of Asp.net Zero is v6.6.0 and we are using EntityFramework Core.

Hi,

I have added second DbContext to my aspnetzero project and it works fine on my local but as soon as I deploy it to azure it throws following exception:

System.Exception: Could not find content root folder!   at PatientPortal.Web.WebContentDirectoryFinder.CalculateContentRootFolder() in D:\a\1\s\src\PatientPortal.Core\Web\WebContentFolderHelper.cs:line 27   at PatientPortal.EntityFrameworkCore.PatientPortalConnectionStringResolver.GetNameOrConnectionString(ConnectionStringResolveArgs args) in D:\a\1\s\src\PatientPortal.EntityFrameworkCore\EntityFrameworkCore\PatientPortalConnectionStringResolver.cs:line 19   at Abp.Domain.Uow.UnitOfWorkBase.ResolveConnectionString(ConnectionStringResolveArgs args)   at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.GetOrCreateDbContext[TDbContext](Nullable`1 multiTenancySide, String name)   at Abp.EntityFrameworkCore.Uow.UnitOfWorkExtensions.GetDbContext[TDbContext](IActiveUnitOfWork unitOfWork, Nullable`1 multiTenancySide, String name)   at Abp.EntityFrameworkCore.Uow.UnitOfWorkDbContextProvider`1.GetDbContext(Nullable`1 multiTenancySide)   at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.get_Context()   at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.get_Table()   at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.GetAllIncluding(Expression`1[] propertySelectors)   at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.GetAll()   at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.FirstOrDefaultAsync(TPrimaryKey id)   at Abp.Domain.Repositories.AbpRepositoryBase`2.GetAsync(TPrimaryKey id)   at Abp.Threading.InternalAsyncHelper.AwaitTaskWithPostActionAndFinallyAndGetResult[T](Task`1 actualReturnValue, Func`1 postAction, Action`1 finalAction)   at PatientPortal.Demographic.Service.DemographicService.GetDemograph(Int32 input)   at lambda_method(Closure , Object )   at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExec...

Please suggest.

Thanks, Gaurav Singh

Question

Hi,

I am trying to unit test plugin service and getting following error:

Castle.MicroKernel.ComponentNotFoundException : No component for supporting the service Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager was found

Can you please suggest.

Thanks, Gaurav Singh

Question

Hi, all unit tests shipped with aspnet zero project are failing with following exception:

"format of the initialization string does not conform to specification starting at index 0"

Please suggest.

thanks, Gaurav

Hi, I'm developing a Plugin Module as separate asembly and here is the project structure.

here is the full exception:
Castle.MicroKernel.Handlers.HandlerException
  HResult=0x80131500
  Message=Can't create component 'PatientPortal.PatientStripePayment.StripePatientPaymentAppService' as it has dependencies to be satisfied.

'PatientPortal.PatientStripePayment.StripePatientPaymentAppService' is waiting for the following dependencies:
- Service 'Abp.Domain.Repositories.IRepository`2[[PatientPortal.PatientStripePayment.Entities.Payment, PatientPortal.PatientStripePayment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Guid, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' which was not registered.
- Service 'Abp.Domain.Repositories.IRepository`2[[PatientPortal.PatientStripePayment.Entities.Invoice, PatientPortal.PatientStripePayment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Guid, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' which was not registered.

  Source=Castle.Windsor
  StackTrace:
   at Castle.MicroKernel.Handlers.DefaultHandler.AssertNotWaitingForDependency()
   at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)
   at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)
   at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy, Boolean ignoreParentContext)
   at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy, Boolean ignoreParentContext)
   at Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments)
   at Abp.Modules.AbpModuleManager.CreateModules(ICollection`1 moduleTypes, List`1 plugInModuleTypes)
   at Abp.Modules.AbpModuleManager.LoadAllModules()
   at Abp.AbpBootstrapper.Initialize()
   at Abp.AspNetCore.AbpApplicationBuilderExtensions.InitializeAbp(IApplicationBuilder app)
   at Abp.AspNetCore.AbpApplicationBuilderExtensions.UseAbp(IApplicationBuilder app, Action`1 optionsAction)
   at PatientPortal.Web.Startup.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in C:\Users\serge\Source\Repos\Ideas Patient Portal v2.0\src\PatientPortal.Web.Host\Startup\Startup.cs:line 154

here is the source code:

using Stripe;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Castle.Core.Logging;
using Abp.Application.Services;
using Abp.Domain.Repositories;
using Abp.UI;
using Abp.Modules;
using System.Reflection;
using Abp.Zero;

namespace PatientPortal.PatientStripePayment
{
    [DependsOn(typeof(AbpZeroCoreModule))]
    public class StripePatientPaymentAppService : AbpModule, IApplicationService, IStripePatientPaymentAppService
    {
        private readonly IRepository<Entities.PatientPayment, Guid> _paymentRepository;

        private readonly IRepository<Entities.PatientInvoice, Guid> _invoiceRepository;

        public StripePatientPaymentAppService(IRepository<Entities.PatientPayment, Guid> paymentRepository,
            IRepository<Entities.PatientInvoice, Guid> invoiceRepository)
        {
            Logger = NullLogger.Instance;
            _paymentRepository = paymentRepository;
            _invoiceRepository = invoiceRepository;

        }


        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
        }


        public override void PostInitialize()
        {
            var paymentService = IocManager.Resolve<IStripePatientPaymentAppService>();
        }

        public async Task<string> CreateCharge(long amount, string currency, string invoiceId,
                                                string patientAcuID, string description,
                                                string token, string patientId = "")
        {
            // CheckPermission();
            StripeConfiguration.SetApiKey("sk_test_ktjohPHzIy5vsWJezVIUTq8m");

            var options = new ChargeCreateOptions
            {
                Amount = amount,
                Currency = currency, //"cad"
                Description = description,
                SourceId = token // obtained with Stripe.js,

            };
            var service = new ChargeService();
            Charge charge;
            try
            {
                Logger.Debug(string.Format("Creating Charge of {0} {1} with Stripe ", amount, currency));
                charge = await service.CreateAsync(options);


                var resPayment = await _paymentRepository.InsertAndGetIdAsync(new Entities.PatientPayment()
                {
                    //TODO CreatorUserId = AbpSession.UserId,
                    InvoiceId = invoiceId,
                    Amount = charge.Amount,
                    Currency = charge.Currency,
                    FailureCode = charge.FailureCode,
                    FailureMessage = charge.FailureMessage,
                    Paid = charge.Paid,
                    Status = charge.Status,
                    PatientID = patientId,
                    PatientAcuID = patientAcuID,
                    PaymentId = charge.Id
                });

                Entities.PatientInvoice invoiceUpdate = await _invoiceRepository.FirstOrDefaultAsync(i => i.InvoiceId == invoiceId);
                if (invoiceUpdate != null)
                {
                    invoiceUpdate.PaidDate = charge.Created;
                    var resInvoice = await _invoiceRepository.UpdateAsync(invoiceUpdate);
                }
                else
                {
                    //invoice wasn't found
                    Logger.Warn(string.Format("Payment has been made for invoice {0} PatientId {1} PatientAcuId {2} but the invoice was not found.", invoiceId, patientId, patientAcuID));
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message);
                throw new UserFriendlyException("Stripe Payment call has failed.", ex);
            }


            return charge.Id;
        }

        public async Task<IList<Entities.PatientPayment>> GetPayments()
        {
            return await _paymentRepository.GetAllListAsync(r => r.IsLedgerUpdated == false);
        }

        public async Task ConfirmLedgerUpdate(Guid transactionId)
        {
            var paymentTrx = await _paymentRepository.FirstOrDefaultAsync(r => r.Id == transactionId);
            if (paymentTrx != null && !paymentTrx.IsLedgerUpdated)
            {
                paymentTrx.IsLedgerUpdated = true;
                paymentTrx.LedgerUpdateDate = DateTime.Now;
            }
            else
            {
                throw new UserFriendlyException(string.Format("Transaction  ID {0} was not found or already synced with patient's ledger.", transactionId));
            }

        }


        /// <summary>
        /// g
        /// </summary>
        /// <param name="patientId"></param>
        /// <param name="invoiceId"></param>
        /// <param name="invoiceDate"></param>
        /// <param name="debit"></param>
        /// <param name="credit"></param>
        /// <param name="balance"></param>
        /// <param name="currency">ASCII code of currency symbol </param>
        /// <returns></returns>

        public async Task<Entities.PatientInvoice> CreateInvoice(string patientId, string patientAcuId, string invoiceId, DateTime invoiceDate, double debit, double credit, double balance, int currency)
        {
            Entities.PatientInvoice newInvoice = new Entities.PatientInvoice()
            {
                PatientID = patientId,
                PatientAcuID = patientAcuId,
                InvoiceDate = invoiceDate,
                InvoiceId = invoiceId,
                Debit = debit,
                Credit = credit,
                Balance = balance,
                Currency = currency
            };

            try
            {
                return await _invoiceRepository.InsertAsync(newInvoice);
            }
            catch (Exception ex)
            {

                throw new UserFriendlyException(ex.Message);
            }



        }
        /// <summary>
        /// Updates date,credit, debit,balance of existing invoice. 
        /// </summary>
        /// <param name="patientId"></param>
        /// <param name="invoiceId"></param>
        /// <param name="invoiceDate"></param>
        /// <param name="debit"></param>
        /// <param name="credit"></param>
        /// <param name="balance"></param>
        /// <returns></returns>
        public async Task<Entities.PatientInvoice> UpdateInvoice(string patientId,
                            string invoiceId, DateTime invoiceDate, double debit,
                            double credit, double balance, DateTime paidDate)
        {
            Entities.PatientInvoice existingInvoice = await _invoiceRepository.FirstOrDefaultAsync(r => r.InvoiceId == invoiceId && r.PatientID == patientId);

            if (existingInvoice == null)
                throw new UserFriendlyException(String.Format("No invoice with Id ={0} for patient with Id {1} was found", invoiceId, patientId));

            else
            {
                existingInvoice.InvoiceDate = invoiceDate;
                existingInvoice.Debit = debit;
                existingInvoice.Credit = credit;
                existingInvoice.Balance = balance;
                existingInvoice.PaidDate = paidDate;

                return await _invoiceRepository.UpdateAsync(existingInvoice);
            }
        }
        /// <summary>
        /// Soft deletes an invoice
        /// </summary>
        /// <param name="invoiceId"></param>
        /// <param name="patientId"></param>
        /// <returns></returns>
        public async Task DeleteInvoice(string patientId, string invoiceId)
        {
            var invoice = await _invoiceRepository.FirstOrDefaultAsync(p => p.InvoiceId == invoiceId && p.PatientID == patientId);

            if (invoice != null && !invoice.IsDeleted)
                await _invoiceRepository.DeleteAsync(invoice.Id);
            else
            {
                new UserFriendlyException(String.Format("No invoice with Id ={0} for patient with Id {1} was found", invoiceId, patientId));
            }

        }

        /// <summary>
        /// Gets all unpaid invoices for a patient
        /// </summary>
        /// <param name="patientId"></param>
        /// <returns></returns>
        public async Task<IList<Entities.PatientInvoice>> GetInvoices(string patientId)
        {

            return await _invoiceRepository.GetAllListAsync(r => r.PatientID == patientId
                                                                && r.PaidDate <= DateTime.MinValue
                                                                && r.IsDeleted == false);


        }


    }
}

HI, I am working on .NET visual studio 2019 (.net core 2.2) and I am trying to use Asp.Net Zero Power tools extension but its says it is unavailable for the .net framework 2.2. Is there any work around for it and when can we be it avaiable for the latest .net core framework. It would boost our development l if we can use it in our project.

Thanks

Showing 31 to 37 of 37 entries