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

Activities of "nipunjoshi"

Excellent! We'll give it a try today and let you know how it goes. Thanks a lot!

Thanks for the response!

My concern is that with this approach, using the trick you mentioned, the data would not be shared between multiple tenants. Or would it be possible to do that?

In our scenario, the data needs to be shared. Employee of one company should be able to add information into the system, and that information should be available to employees of other companies if they have the right permission in the other company account. I believe multi-tenancy would not let us achieve that.

Could you please advise on the best way to achieve this?

I was thinking to may be introduce a concept of sub-tenants, where we add a new table related to sub-tenants and map them to users. Then at the click of login, we can check if the user is associated with more than one sub-tenant, then show a list to select from and if not, then just continue the current way. But that may require mapping to lot of other entities like roles, permissions etc and we do not have much time to get this done. We need a smart solution, which I am hoping you can provide! :)

Thanks a lot!

Hello Halil,

I have an urgent requirement that kind of aligns at the intersection of Tenants and OUs. Our company has acquired multiple small companies, and we want to create users in the system from each company. However, some of the users may belong to multiple companies as well.

When the user logs in, if they are members of multiple companies, then I want to show them an option to select which company they want to manage. They select one and that loads the app with the features and permissions for that company. They should have the ability to switch to another company and manage things in for another company.

For some staff, once they are set up they might never see the menu to select company because they belong to only one company.

What is the best way to achieve this? I would greatly appreciate if you could elaborate a little bit on how to achieve this quickly.

Thanks in advance! Nipun

Yes,Now it's working.Thanks a lot :)

Other issue is according to the above exception where it checks the data on the tables also no (i.e "IpProperties" and "IpCounties" are my physical tables) ? Am I right ? Here it is :

NMemory.Exceptions.ForeignKeyViolationException : Foreign key violation [IpProperties :: CountyId]. The key value [3] does not exists in the referenced table [IpCounties :: Id]..

It's there on the seed data also. Then why's that ? Please see that below. Thanks.

Note : the exception happens here in the below class : _context.SaveChanges();

InitialPropertiesCreator.cs

public class InitialPropertiesCreator
    {
        private readonly IpDbContext _context;

        public InitialPropertiesCreator(IpDbContext context)
        {
            _context = context;
        }

        public void Create()
        {
            var dist1 = _context.Properties.FirstOrDefault(p => p.Dist == "dist1");
            if (dist1 == null)
            {
                _context.Properties.Add(
                    new Property
                    {
                        IsVacant = true,
                        IsPropertyToConsider = false,
                        Dist = "dist1",
                        Sec = "sec1",
                        Blk = "blk1",
                        Lot = "lot1",
                        Lot2 = "lot2",
                        Mls = "mls1",
                        Priority = "priority1",
                        Tfmv = "Tfmv1",
                        Fmv = "Fmv1",
                        Construction = "Construction1",
                        Bid = "Bid1",
                        ListingPrice = 12.25m,
                        Contact = "Contact1",
                        DeedDate = DateTime.UtcNow,
                        TransferTax = 12.9m,
                        OriginalPurchasePrice = 45.6m,
                        Taxes = 85.3m,
                        TotalValuation = 41.2m,
                        Ev = 47.3m,
                        BuyBackAmount = 50.2m,
                        CountyId = 3,
                        PropertyClassId = 1,
                        SchoolDistrictId = 1,
                        StatusId = 1,
                        Address = new Address
                        {
                            StreetName = "1st Street",
                            StreetNumber = "1581",
                            CityId = 1,
                            StateId = 1,
                        },
                        PurchasedById = 1,
                        ShowId = 1,
                        CodeId = 1,

                    });
            }

            var dist2 = _context.Properties.FirstOrDefault(p => p.Dist == "dist2");
            if (dist2 == null)
            {
                _context.Properties.Add(
                    new Property
                    {
                        IsVacant = true,
                        IsPropertyToConsider = false,
                        Dist = "dist2",
                        Sec = "sec2",
                        Blk = "blk2",
                        Lot = "lot2",
                        Lot2 = "lot3",
                        Mls = "mls2",
                        Priority = "priority2",
                        Tfmv = "Tfmv2",
                        Fmv = "Fmv2",
                        Construction = "Construction2",
                        Bid = "Bid2",
                        ListingPrice = 12.25m,
                        Contact = "Contact2",
                        DeedDate = DateTime.UtcNow,
                        TransferTax = 12.9m,
                        OriginalPurchasePrice = 45.6m,
                        Taxes = 85.3m,
                        TotalValuation = 41.2m,
                        Ev = 47.3m,
                        BuyBackAmount = 50.2m,
                        CountyId = 4,
                        PropertyClassId = 2,
                        SchoolDistrictId = 2,
                        StatusId = 2,
                        Address = new Address
                        {
                            StreetName = "2nd Street",
                            StreetNumber = "1582",
                            CityId = 2,
                            StateId = 2,
                        },
                        PurchasedById = 2,
                        ShowId = 2,
                        CodeId = 2,
                    });
            }

            _context.SaveChanges(); // it gives the exception here
        }
    }

InitialCountiesCreator.cs

public class InitialCountiesCreator
    {
        private readonly IpDbContext _context;

        public InitialCountiesCreator(IpDbContext context)
        {
            _context = context;
        }

        public void Create()
        {
            var county1 = _context.Counties.FirstOrDefault(p => p.Name == "Orange");
            if (county1 == null)
            {
                _context.Counties.Add(
                    new County
                    {
                        Name = "Orange",
                        State = "NY",
                    });
            }

            var county2 = _context.Counties.FirstOrDefault(p => p.Name == "Ulster");
            if (county2 == null)
            {
                _context.Counties.Add(
                   new County
                   {
                       Name = "Ulster",
                       State = "NY",
                   });
            }
        }
    }

Hi, Actually it worked before the V 1.7 update.Now it's not working.I have changed all the other icons also after the version update. Please see the image below.Thanks.

.AddItem(new MenuItemDefinition(
                    PageNames.App.Tenant.Imports,
                    L("Imports"),
                    url: "tenant.imports",
                    icon: "glyphicon glyphicon-import"
                 )

Hi, Actually those values are there. Really strange.What could be the other reason for this ? Please see the images.

I have written my first test case.But unfortunately it gives below mentioned exception :cry: Could you tell me why ? Thanks.

Test case :

public class AcquisitionTypeAppServiceTests : AppTestBase
    {
        private readonly IAcquisitionTypeAppService _acquisitionTypeAppService;

        public AcquisitionTypeAppServiceTests()
        {
            _acquisitionTypeAppService = Resolve<IAcquisitionTypeAppService>();
        }

        [Fact]
        public async Task Test_GetAllAcquisitionTypesAsync()
        {
            //Act
            var acquisitionTypes = await _acquisitionTypeAppService.GetAllAcquisitionTypesAsync();

            //Assert
            acquisitionTypes.Items.Count.ShouldBe(5);
        }


    }

Exception :

Test Name:	IP.Tests.AcquisitionTypes.AcquisitionTypeAppServiceTests.Test_GetAllAcquisitionTypesAsync
Test FullName:	 IP.Tests.AcquisitionTypes.AcquisitionTypeAppServiceTests.Test_GetAllAcquisitionTypesAsync
Test Source:	\Tests\IP.Tests\AcquisitionTypes\AcquisitionTypeAppServiceTests.cs : line 19
Test Outcome:	Failed
Test Duration:	0:00:00.001

Result Message:	
System.Data.Entity.Infrastructure.DbUpdateException : An error occurred while updating the entries. See the inner exception for details.
---- System.Data.Entity.Core.UpdateException : An error occurred while updating the entries. See the inner exception for details.
-------- System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
------------ NMemory.Exceptions.ForeignKeyViolationException : Foreign key violation [IpProperties :: CountyId]. The key value [3] does not exists in the referenced table [IpCounties :: Id].. Error code: RelationError
Result StackTrace:	
at System.Data.Entity.Internal.InternalContext.SaveChanges()
   at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
   at Abp.EntityFramework.AbpDbContext.SaveChanges()
   at Joshi.IP.Migrations.Seed.InitialPropertiesCreator.Create() in d:\Freelance Work\Nipun-SPA\SPA\island\Joshi.IP.EntityFramework\Migrations\Seed\InitialPropertiesCreator.cs:line 111
   at Joshi.IP.Migrations.Seed.InitialDbBuilder.Create() in d:\Freelance Work\Nipun-SPA\SPA\island\Joshi.IP.EntityFramework\Migrations\Seed\InitialDbBuilder.cs:line 22
   at Joshi.IP.Tests.AppTestBase.<.ctor>b__0(IpDbContext context) in d:\Freelance Work\Nipun-SPA\SPA\island\Tests\Joshi.IP.Tests\AppTestBase.cs:line 36
   at Joshi.IP.Tests.AppTestBase.UsingDbContext(Action`1 action) in d:\Freelance Work\Nipun-SPA\SPA\island\Tests\Joshi.IP.Tests\AppTestBase.cs:line 70
   at Joshi.IP.Tests.AppTestBase..ctor() in d:\Freelance Work\Nipun-SPA\SPA\island\Tests\Joshi.IP.Tests\AppTestBase.cs:line 34
   at Joshi.IP.Tests.AcquisitionTypes.AcquisitionTypeAppServiceTests..ctor() in d:\Freelance Work\Nipun-SPA\SPA\island\Tests\Joshi.IP.Tests\AcquisitionTypes\AcquisitionTypeAppServiceTests.cs:line 12
----- Inner Stack Trace -----
   at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
   at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.&lt;Update&gt;b__2(UpdateTranslator ut)
   at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update[T](T noChangesResult, Func`2 updateFunction)
   at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update()
   at System.Data.Entity.Core.Objects.ObjectContext.<SaveChangesToStore>b__35()
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
   at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
   at System.Data.Entity.Core.Objects.ObjectContext.&lt;&gt;c__DisplayClass2a.&lt;SaveChangesInternal&gt;b__27()
   at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
   at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
   at System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions options)
   at System.Data.Entity.Internal.InternalContext.SaveChanges()
----- Inner Stack Trace -----
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Effort.Internal.Common.DatabaseReflectionHelper.InsertEntity(ITable table, Object entity, Transaction transaction)
   at Effort.Internal.CommandActions.InsertCommandAction.CreateAndInsertEntity(ITable table, IList`1 memberBindings, Transaction transaction)
   at Effort.Internal.CommandActions.InsertCommandAction.ExecuteDataReader(ActionContext context)
   at Effort.Provider.EffortEntityCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.&lt;Reader&gt;b__c(DbCommand t, DbCommandInterceptionContext`1 c)
   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
   at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.Execute(Dictionary`2 identifierValues, List`1 generatedValues)
   at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
----- Inner Stack Trace -----
   at NMemory.Tables.Relation`4.ValidateEntityCore(TForeign foreign)
   at NMemory.Tables.Relation`4.NMemory.Tables.IRelationInternal.ValidateEntity(Object foreign)
   at NMemory.Execution.ExecutionHelper.ValidateForeignKeys(IList`1 relations, IEnumerable`1 referringEntities)
   at NMemory.Execution.CommandExecutor.ExecuteInsert[T](T entity, IExecutionContext context)
   at NMemory.Tables.DefaultTable`2.InsertCore(TEntity entity, Transaction transaction)
   at Effort.Internal.DbManagement.Engine.ExtendedTable`2.InsertCore(TEntity entity, Transaction transaction)
   at NMemory.Tables.Table`2.Insert(TEntity entity, Transaction transaction)
   at Effort.Internal.Common.DatabaseReflectionHelper.WrapperMethods.InsertEntity[TEntity](ITable`1 table, TEntity entity, Transaction transaction)
Question

Hi, Could you tell me how to add import iconto my app ? There is no such icon on this file : \simple-line-icons.css Thanks.

Showing 1 to 10 of 25 entries