Question

I'm working on an ASP.NET project where I need to split our current application into a Canada/USA/International System. This split will allow certain users to only view/modify the Data in Regions that they have permission for.

To avoid a maintenance nightmare in the future I've added a RegionID to the main tables of the application, including permissions. This should allow me to easily split everything up, and manage what people are allowed to see and what people aren't allowed to see. Based on the AD user, I can then save their default region which will save them hassle of seeing a Region Splash screen every time they try to access the application.

As I've never built a regional web application, this sounds fairly simple in my head, but before I dive completely in I was wondering if there is a "by the book" way to do this? Keeping in mind that I would rather not have to completely re-build this app as I do not have the time or resources to do so.

Was it helpful?

Solution

in my opinion the best way to achieve this is using the same kind of approach as when you have different languages or countries. probably you will need to develop a file defining the context of the user, languagecontext, countrycontext - region in your case -. You can achieve this using database persistence with an ID for each region in user - anonymous is ok too - profile table or using cookies to save details of regioncontext. then you can consume that information in your normal classes displaying information taking into consideration user region.

public Region RegionContext
{
    get
    {
        if (this.user != null &&
            this.user.Region!= null)
            return this.user.Region;

        var region= _region.GetAllRegions().FirstOrDefault();
        return region;
    }
    set
    {
        if (this.user == null)
            return;

        this.user.region = value;
        _user.UpdateUser(this.User);
    }
}

where region has the ID and user has a fk to region. brgds!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top