erotik film
bodyheat full moves www xxx kajal video la figa che sborra ver video de sexo porno
Luxury replica watches
sex
asyabahis
escort antalya

** THIS SITE IS AN ARCHIVE ** - New Content is at:
BlazorHelpWebsite.com

May 5

Written by: Richard Waddell
5/5/2011 5:40 PM  RssIcon

Often we don’t care who the logged-in User is because we can control what they can do through Roles and Permissions. But if the User is a member of some group, it would be handy to place the Users table in a many-to-one relationship with that group. In this example the groups are SalesTeams made up of SalesPersons. All Sales made by a particular team are accessible only by members of that team.

To make that happen a new User is created, if necessary, when a SalesPerson is created. Since a SalesPerson is in a many-to-one relationship with SalesTeam, so is the User. This article shows you how to create the UserRegistration and then two ways to identify the SalesPerson associated with the logged-in User and thereby the relationship with SalesTeam and Sales.

Start by adding a SalesTeam entity:

image

A SalesTeam is composed of SalesPersons:

image

We’re going to associate each SalesPerson with a User. Let’s make sure we’re agreed on what I mean by ‘User’. Under Solution Explorer / Properties / Access Control select ‘User Forms authentication’ and check ‘Granted for debug’ next to SecurityAdministration.

image

Press F5 to run the application, expand the Administration menu, and click on ‘Users’.

image

As you can see, there are no Users defined. In the lower-right corner we see that we are logged in as the special user TestUser by virtue of running under Visual Studio. If this were a deployed application it would prompt for user and password on startup. Instead we are automatically logged-in for convenience during development.  The upshot is that in a deployed application the current User, which can be determined through Application.Current.User.Name, will always be one of the Users you see on the Administration/Users page shown above. Under Visual Studio it will always be TestUser, which isn’t necessarily one of the Users you see above.

First of all, we need a property to bind User to SalesPerson. As I said, User.Name is actually UserRegistration.UserName, so we’ll add a UserName property to SalesPerson. We can use the Name property for the person’s actual name.

Before we can add SalesPersons we need SalesTeams. Add a SalesTeam Editable Grid Screen:

image

Add some SalesTeams:

image

Save them and create a SalesPerson Editable Grid Screen where we find we can select the Sales Team when we create a Sales Person:

image

The point of SalesPersons.UserName is to map to UserRegistration.UserName so at run time we can tell which SalesPerson we are dealing with by matching Application.User.Name to SalesPerson.UserName. This in effect gives us the ability to create relationships between User and other tables; In this case a many-to-one relationship to SalesTeam. You could also create one-to-many relationships, such as a scenario where a SalesPerson got an individualized commission on each Sale made by the team requiring a one-to-many relationship between SalesPerson and Commissions.

When we create a new SalesPerson…

image

…if necessary we also create a new UserRegistration. We don’t want to deal with passwords, so we set it to some default value the user should change the first time they log on:

namespace LightSwitchApplication
{
    public partial class ApplicationDataService
    {
        partial void SalesPersons_Inserting(SalesPerson entity)
        {
            var reg = (from regs in this.DataWorkspace.SecurityData.UserRegistrations
                       where regs.UserName == entity.UserName
                       select regs).FirstOrDefault();
            if (reg == null)
            {
                var newUser = this.DataWorkspace.SecurityData.UserRegistrations.AddNew();
                newUser.UserName = entity.UserName;
                newUser.FullName = entity.Name;
                newUser.Password = "changeme/123";
                this.DataWorkspace.SecurityData.SaveChanges();
            }

        }
    }
}

If we now go to Administration/Users we find the new User there.

image

When launched from Visual Studio, the logged-on user is always TestUser, so we’ll create add a SalesPerson to Red Team with that UserName.

image

Now we need something to test. The point of belonging to a SalesTeam is that you have access to whatever the SalesTeam has access to. So we’ll create a Sale entity with a many-to-one relationship to SalesTeam.

image

Create an Editable Grid Screen for Sales and add some:

image

Now you can see I’ve added Sales for both teams. For obvious reasons, team members would not be allowed access to this screen. So we’ll add another Editable Grid Screen and filter it by the SalesTeam of the logged-in User. There’s a couple of ways we could do this. We could go ahead and create the screen and then modify the query, but I’m going to go ahead and create the query and then generate a screen based on the query.

Right-Click the Sales Data Source and select Add Query.

image

And there are a couple of ways to write the query to restrict Sales to only those belonging to the same SalesTeam as the logged-on SalesPerson / User.

  • A ‘pre-process’ query that runs before the query we’re modifying
  • A Global Variable that we can add as a filter.

The Pre-Process Query

To add the pre-process query,

image

In the query we find the SalesPerson associated with the logged on User. This gives us the SalesTeam and thereby a means to select only Sales linked to the same SalesTeam as the SalesPerson / User.:

partial void UserSalesTeamSales_PreprocessQuery(ref IQueryable query)
{
    SalesPerson person = (from persons in this.DataWorkspace.ApplicationData.SalesPersons
                            where persons.UserName == Application.Current.User.Name
                            select persons).FirstOrDefault();
    int salesTeamId = person == null ? -1 : person.SalesTeam.Id;
    query = from theSales in query
            where theSales.SalesTeam.Id == salesTeamId
            select theSales;

}

Now we create the screen:

image

The first thing I see is that when logged-in as TestUser I can only see Red Team Sales:

image

If I go to the Editable Sales Persons Grid I find that TestUser should be restricted to Red Team sales. So far so good:

image

If I change the Sales Team to Blue Team, click Save, go back to Editable User Sales Team Sales Grid and click Refresh:

image

I find that TestUser now is restricted to Blue Team Sales.

The Global Variable Query Parameter

The scary thing about creating a Global Variable is that you have to modify an lsml file, which can disable the designer and lead to strange error messages if mishandled, so we have to proceed with care. First, switch to file view:

image

We’re going to edit Common/ ApplicationDefinition.lsml. You may want to back up the file first.

image

You may get a Catastrophic failure when you try to edit this file. I discovered that if I first opened this one under data, then closed it I was able to edit the one under Common. If you look at properties you’ll find they both map to the same file, the one under data.

image

Insert the following GlobalValueContainerDefinition element after the initial ModelFragment element tag as shown below:

<ModelFragment xmlns="http://schemas.microsoft.com/LightSwitch/2010/xaml/model"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <GlobalValueContainerDefinition Name="GlobalSalesTeamInfo">
    <GlobalValueDefinition Name="UserSalesTeamId" ReturnType=":Int32">
      <GlobalValueDefinition.Attributes>
        <DisplayName Value="User SalesTeam ID" />
        <Description Value ="Gets the logged on User's SalesTeam ID." />
      </GlobalValueDefinition.Attributes>
    </GlobalValueDefinition>
  </GlobalValueContainerDefinition>

Now you have to provide the code behind the variable. Create a new class in the Common folder named GlobalSalesTeamInfo. When created there will be a bunch of using statements at the top that show errors. Replace everything with this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.LightSwitch;

namespace LightSwitchApplication
{
    public class GlobalSalesTeamInfo
    {
        public static int UserSalesTeamId()
        {
            SalesPerson person = (from persons in Application.Current.CreateDataWorkspace().ApplicationData.SalesPersons
                                  where persons.UserName == Application.Current.User.Name
                                  select persons).FirstOrDefault();
            return person != null ? person.SalesTeam.Id : -1;
        }
    }
}

Now we need to switch to logical view so we can modify the query to use this new variable. But when we do the designer will throw a hissy and tell you that you must reload. Once upon a time you could right-click in Solution Explorer and reload from there. Now, if you’re lucky, BindingToUsersTable Designer will be in a tab at the top. Click on that tab and you’ll get a page with a Reload button. If you can’t get to that tab the only other way I know is to reload the solution. In other words, you need for the screen designer to be open in a tab when you edit the .lsml file. That way, when you need to reload, the tab will be there to select. In my experience once you change the .lsml file the Solution Explorer is hosed as far as the logical view, so you can’t get to the designer. Actually I didn’t think of the View menu. Anyway, don’t panic when you start getting all the incomprehensible messages. At best you have to exit and restart. At worst you have to exit, restore the .lsml file, and restart.

Back in logical view, open the UserSalesTeamSales query:

image

We can now filter on User Sales Team ID. (LightSwitch insists on breaking the name up into words).

image

Get rid of the pre-process query:

//partial void UserSalesTeamSales_PreprocessQuery(ref IQueryable query)
//{
// SalesPerson person = (from persons in this.DataWorkspace.ApplicationData.SalesPersons
// where persons.UserName == Application.Current.User.Name
// select persons).FirstOrDefault();
// int salesTeamId = person == null ? -1 : person.SalesTeam.Id;
// query = from theSales in query
// where theSales.SalesTeam.Id == salesTeamId
// select theSales;

//}

And sure enough I get the same results when I switch TestUser’s team membership.

The advantage of the Global Variable approach is that it’s simpler to add the filter to each query that needs it, as you can see above, than it is to write a custom pre-process query for every query that needs to filter on SalesTeam membership as you can see in the now commented-out code immediately above.

Testing Other Users

To really test, we need to deploy the application so we can log in as different Users. When you do, you’ll find that all your Users and data have disappeared, so we’ll have to create new SalesTeams, SalesPersons, and Sales.

image

We’ll log in as a Blue Team Member:

image

And we only see Blue Team Sales:

image

Now we log in as a Red Team Member:

image

And we’re restricted to Red Team Sales:

image

So there you have it. In a less restricted application you’d want to make the Entity associated with User a little more generic, such as Person, so they could participate in a variety of scenarios but always be identifiable as an individual User. Which means a more succinct example would be a Global Variable that identifies the User/Person. Here I use the example of SalesPerson. I’ve added the UserSalesPersonID GlobalValueDefinition to ApplicationDefinition.lsml.

<ModelFragment xmlns="http://schemas.microsoft.com/LightSwitch/2010/xaml/model"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <GlobalValueContainerDefinition Name="GlobalSalesTeamInfo">
    <GlobalValueDefinition Name="UserSalesTeamId" ReturnType=":Int32">
      <GlobalValueDefinition.Attributes>
        <DisplayName Value="User SalesTeam ID" />
        <Description Value ="Gets the logged on User's SalesTeam ID." />
      </GlobalValueDefinition.Attributes>
    </GlobalValueDefinition>
    <GlobalValueDefinition Name="UserSalesPersonId" ReturnType=":Int32">
      <GlobalValueDefinition.Attributes>
        <DisplayName Value="User SalesPerson ID" />
        <Description Value ="Gets the logged on User's SalesPerson ID." />
      </GlobalValueDefinition.Attributes>
    </GlobalValueDefinition>
  </GlobalValueContainerDefinition>

Visual Studio was particularly cranky about these changes. I had to reload the solution twice, once because I made a mistake and it wouldn’t recognize that I had fixed it. The second time I don’t know why. The change was what you see above and I could reload in the designer, but Logical View would not come up. After I reloaded the solution, there it was. So don’t assume you’ve made a mistake when Logical View won’t come up, even if you hit the designer reload button.

Here’s the code behind UserSalesPersonId. I’ve kept UserSalesTeamId because it’s still what I really need, but you can see that you could spin off Global Variables for every relationship that the logged-on user is involved from the one core method LoggedOnPerson() .

namespace LightSwitchApplication
{
    public class GlobalSalesTeamInfo
    {
        public static int UserSalesPersonId()
        {
            SalesPerson person = LoggedOnPerson();
            return person != null ? person.Id : -1;
        }
        public static int UserSalesTeamId()
        {
            SalesPerson person = LoggedOnPerson();
            return person != null ? person.SalesTeam.Id : -1;
        }
        private static SalesPerson LoggedOnPerson()
        {
            return (from persons in Application.Current.CreateDataWorkspace().ApplicationData.SalesPersons
                              where persons.UserName == Application.Current.User.Name
                              select persons).FirstOrDefault();
        }
    }
}

The LightSwitch project is available at http://lightswitchhelpwebsite.com/Downloads.aspx

Tags:
Categories:

43 comment(s) so far...


Thanks so much for this article, I was looking and waiting for somebody to show us how to implement this concept for a long time.
Lightswitch is really powerful.
Rachida

By Rachida dukes on   5/6/2011 5:29 AM

Rachida - Thanks, glad you find it to be helpful. LightSwitch is an ongoing revelation for me.

By Richard Waddell on   5/6/2011 5:32 AM

Yes, excellent blog. The contents of this example can be used in many situations.

By Garth Henderson on   5/6/2011 11:06 AM

Garth - Thanks for the kind words.

By Richard Waddell on   5/6/2011 11:08 AM

Garth, thanks for this post. I have a question:
Can you provide a sample illustrating how to prevent the end-user from deleting an existing user from Users entity
when this user had made a sale?
Thanks,
Rachida

By Rachida Dukes on   5/9/2011 6:06 PM

I'm not sure what you mean I only add a User if necessary when creating a SalesPerson.

In general you have to add security at various levels. For instance you definitely would want some security on SalesPerson maintenance

On the server in ApplicationDataService to validate at the data level:
partial void SalesPersons_Validate(SalesPerson entity, EntitySetValidationResultsBuilder results)
{
if (Application.User.HasPermission(Permissions.SecurityAdministration) == false)
results.AddEntityError("Permission denied");
}

To restrict the screen EditableSalesPerson so it doesn't even show up in the menu:
partial void EditableSalesPersonsGrid_CanRun(ref bool result)
{
result = User.HasPermission(Permissions.SecurityAdministration);
}

By Richard Waddell on   5/9/2011 6:04 PM

Thanks Richard fro your fast response.
This is my question from a different angle.
When we add a new Salesperson with a UserName, it is added automatically to the users entity using this code:
partial void SalesPersons_Inserting(SalesPerson entity)
{
var reg = (from regs in this.DataWorkspace.SecurityData.UserRegistrations
where regs.UserName == entity.UserName
select regs).FirstOrDefault();
if (reg == null)
{
var newUser = this.DataWorkspace.SecurityData.UserRegistrations.AddNew();
newUser.UserName = entity.UserName;
newUser.FullName = entity.Name;
newUser.Password = "changeme/123";
this.DataWorkspace.SecurityData.SaveChanges();
}
}
If we delete a user from the Users entity, how can we delete him (or her) from the SalesPerson entity automatically?
Thanks so much for your support.

By Rachida Dukes on   5/11/2011 5:46 PM

As far as I know you'd have to write your own Users maintenance screen; and avoid deleting Users through the Administrators screen. You could write code to look for each SalesPerson UserName on the SecurityData.UserRegistrations table and run it on some startup event, maybe Application_Initialize. However you don't want to delete a SalesPerson because the associated UserRegistration was deleted by accident, so that might not be a good idea.

An easier approach would be to change the SalesPerson Entity code so the associated UserRegistration is deleted when the SalesPerson is deleted
partial void SalesPersons_Deleting(SalesPerson entity)
{
var reg = (from regs in this.DataWorkspace.SecurityData.UserRegistrations
where regs.UserName == entity.UserName
select regs).FirstOrDefault();
if (reg != null)
{
reg.Delete();
this.DataWorkspace.SecurityData.SaveChanges();
}
}

By Richard Waddell on   5/11/2011 5:44 PM

Thanks Richard for your help, your code works beautifully for what I was looking for.
Rachida

By Rachida Dukes on   5/12/2011 11:15 AM

@Rachida - Outstanding. Thanks for the comment.

By Richard Waddell on   5/12/2011 11:16 AM

@Rachida - It occurs to me that the more logical place to delete the UserRegistration rnay be in SalesPerson_Deleted. It depends on whether you want to make sure the SalesPerson is successfully deleted before you delete the UserRegistration row.

By Richard Waddell on   5/12/2011 4:34 PM

Thanks again Richard for your second answer.

By Rachida Dukes on   9/2/2011 6:35 PM

What about us that use VB.net, i can understand the code in c#. please post for vb developers.

thanks.

By James on   9/2/2011 6:35 PM

Hi Richard - very useful article. I used the design pattern you illustrated on creating new application users in a solution I'm writing for a client and it worked a treat! I'm new to the Entity Data Model and Silverlight, so I don't have a deep understanding of how the lightswitch plumbing hangs together yet (I've come from a data warehousing/BI background).

A quick extension question - have you had any thoughts as to how you'd also add a new user to a specified role if you wanted users added through a normal data entry screen to also pick up a default role?

In my situation, I have an Approvers role which I'd like to auto-generate logins for in the manner you prescribed, but also add them to a role called Approvers which gives them the right to edit data in some screens but not others.

Cheers


Ozziemedes

By Ozziemedes on   9/28/2011 5:09 PM

Hi,

Glad you found it useful.

See this post if you want to create Roles on the fly
http://dearmusings.wordpress.com/2011/04/22/accessing-security-entities-in-a-lightswitch-application/

You should be able to just add this code to SalesPersons_Inserting right after the exitsting call to this.DataWorkspce.SecuritData.SaveChanges(). I added a role named "Approver" through the normal Role Administration screen. After I added a new SalesTeamMember I went to the Users screen and the Role assignment showed up, so the code should work.


var approverRole = (from role in this.DataWorkspace.SecurityData.Roles
where role.Name == "Approver"
select role).FirstOrDefault();

if (approverRole != null)
{
var newRA = this.DataWorkspace.SecurityData.RoleAssignments.AddNew();
newRA.Role = approverRole;
newRA.User = newUser;
this.DataWorkspace.SecurityData.SaveChanges();
}

Hope it helps!!!
Richard

By Richard Waddell on   9/28/2011 5:16 PM

Very usefull ... I was in this situation right now, and found your excellent post. Great job.

By BLANK on   10/25/2011 5:52 PM

Richard,
Since I built a users maintenance screen, I would to disable the asp.net users so the users can't add users using the lightswitch user screen.
Do you have any idea how to get started?
Thanks,
Rachida

By Rachida Dukes on   10/25/2011 5:52 PM

Rachida,

Can you restrict the users you give SecurityAdministration permission to? Other than that I don't know.

Sorry,
Richard

By Richard Waddell on   10/25/2011 6:00 PM

Richard, I want to restrict every body from adding a new user using the lightswitch users screen, so they're forced to use the custom users screen.
Thanks

By Rachida Dukes on   10/26/2011 5:49 PM

Hi Rachida,

I was talking to Michael about this today, and if you use a custom shell you can prevent access to the adminstration screens. He's written several posts on the subject of shells that will tell probably you pretty much all you need to know. Just type "Shell" in the search box under 'Home' and above 'Topics' at the top far left of this page to get to them.

Good Luck!
Richard

By Richard Waddell on   10/26/2011 5:55 PM

Where is the completed project downloadable from? I didn't see it in the downloads sections as mentioned at the bottom of the article.

By Derek Kirkman on   11/2/2011 10:58 AM

Thanks, I will try your suggestion.
Rachida

By Rachida dukes on   11/2/2011 10:58 AM

I was successful creating my custom screen users, and I added the necessary codes so when I add a new user using my custom users screen, they're added automatically to the aspnet users.

Now I'm trying to find a way to load the persmissions (created through the LS membeship) in a custom dropdown box to use them in my custom roles screen.

Any idea how to get started?

Thanks,

Rachida

By Rachida Dukes on   11/2/2011 10:58 AM

Its good.But i need screen filtering.when login to the user which displays some of the screen and login to the admin which displays some of the screen.

By archanaa on   11/2/2011 10:59 AM

Thank you Richard, great post! - Here are some mods I made....

Using a 'Choice List' called 'UserRoleSelect' and filling it with the roles I configured to match the 'Property' 'Access Controls' permissions. I used the following code changes to build the new users w/ relationship to 'Business Entities' and assigning roles. Also able to delete user from the same screen, relationships are automatically dropped. By associating the UserCreatorName in the same table I'm testing using this as a multi-tenant app solution.

namespace LightSwitchApplication
{
public partial class ApplicationDataService
{
partial void ClientUsers_Inserting(ClientUser entity)
{
var reg = (from regs in this.DataWorkspace.SecurityData.UserRegistrations
where regs.UserName == entity.UserName
select regs).FirstOrDefault();

if (reg == null)
{
var NewUser = this.DataWorkspace.SecurityData.UserRegistrations.AddNew();

NewUser.UserName = entity.UserName;
NewUser.FullName = entity.UserFirstName + " " + entity.UserLastName;
NewUser.Password = "changeme/123";
this.DataWorkspace.SecurityData.SaveChanges();

var UserRole = (from role in this.DataWorkspace.SecurityData.Roles
where role.Name == entity.UserRoleSelect //"Client Admin"
select role).FirstOrDefault();

if (UserRole != null)
{
var newRA = this.DataWorkspace.SecurityData.RoleAssignments.AddNew();
newRA.Role = UserRole;
newRA.User = NewUser;
this.DataWorkspace.SecurityData.SaveChanges();
}
}

}
partial void ClientUsers_Deleting(ClientUser entity)
{
var dsu = (from dsus in this.DataWorkspace.SecurityData.UserRegistrations
where dsus.UserName == entity.UserName
select dsus).FirstOrDefault();
if (dsu != null)
{
dsu.Delete();
this.DataWorkspace.SecurityData.SaveChanges();
}
}
}
}


By Chris Anderson on   11/2/2011 10:59 AM

Hi Derek,

The link should work now. Sorry for the delay

Richard

By Richard Waddell on   11/2/2011 11:00 AM

It looks cool but risky for me....

By YJ on   1/15/2012 8:10 AM

YJ - Why so?

By Richard Waddell on   1/15/2012 8:10 AM

I found this blog to be very helpful. However, in the Editable Sales Grid, if I am adding Sales I should not have to choose the Sales Team because I am already only looking at a list of Sales for my Sales Team. If I delete the Sales Team data item from this screen (or make it not visible), where and how should I store the current Sales Team and use it to initialize a new Sale? I'm using the pre-process query (not a Global Variable) in my application. Thanks.

By Russell Eubanks on   3/3/2012 7:17 AM

Hi Russell,

I'm glad you found this helpful. The Sales Team concept was contrived to illustrate the point of the article, so is not well thought out, or at all. I'm pretty tied up, which is why I seldom blog anymore, so I don't know when or if I'll get a chance to look into the issue. Sorry.

Thanks,
Richard

By Richard Waddell on   3/3/2012 7:21 AM

Richard, is it possible to rewrite your samples using Odata using lightswitch 11?
Thanks,
Rachida Dukes

By Rachida Dukes on   4/4/2012 5:40 PM

Richard,

This is great. But what if users who add salespeople don't have security administration rights? Won't they get an error during insert of sapesperson caused by failure to create user? I'm trying this to allow anonymous users to save their account and create a relationship between account and users.
Any clue how to control permissions on the hidden users & roles entiries?

Russel,

You can default the value Sales Team in the Inserting event of Sales enetity in ApplicationDataService code.

Something like this (air-code not tested):

partial void Sales_Inserting(Sale entity)
{
SalesPerson person = (from persons in this.DataWorkspace.ApplicationData.SalesPersons
where persons.UserName == Application.Current.User.Name
select persons).FirstOrDefault();

int salesTeamId = person == null ? -1 : person.SalesTeam.Id;

entity.SalesTeam.Id = salesTeamId
}

By Jbooker on   6/10/2012 6:54 AM

Hi Rachida,

Sorry, I just don't have the time to follow up on this article.

Richard

By Richard Waddell on   4/4/2012 5:43 PM

Hi Russel,

That's really outside the scope of the article. I was just showing how to set up the relationship and the SalesTeam was just the quickest contrivance I could come up with.

Richard

By Richard Waddell on   4/4/2012 5:44 PM

Excellent article.
Unfortunately I got lost in the middle because I am a VB programmer.
Is there a VB version of the article?
Dan

By Dan on   5/21/2012 12:53 PM

Wonderful Article..I have been looking everywhere for something that explains this setup so clearly. Sure would be nice to see the code in VB.NET. Either way,
thanks for taking the time to write this up!!

By Heather on   5/21/2012 12:53 PM

Heather and Dan,

Glad you liked the article. I used to know VB.NET and C# but alas no longer.

By Richard Waddell on   5/21/2012 12:54 PM

Great article Richard. I’ve created a custom Users table and screen and this has helped me with authenticating network users on my domain.
If a user doesn’t exist on the domain, where would be best to trap this error and inform the inputter? I’ve tried using the Users_Validate(User entity, EntitySetValidationResultsBuilder results) but can’t get it to work correctly?

By jerry on   9/17/2012 6:21 AM

Jerry,

Not sure what you mean. What are you trying to match and when?

Richard

By Richard Waddell on   9/17/2012 6:28 AM

Richard, thanks about this great article!

Posted as solution in stackoverflow for How to store additional user info question

By Daniel on   1/27/2013 2:55 PM

Thanks Daniel

By Richard Waddell on   2/7/2013 9:04 AM

Great article, this architecture is a must have for my application, & your article has made it possible, Thank you very much.
One question though, I am using VS 2012 & every time I use a global variable I got an error 'LightSwitchCommonModule' is not a member of '' on below line:
Dim userBaseLocationId1 As Integer = Global. LightSwitchCommonModule.CurrentUserInfo.UserBaseLocationId()
Then I have to change it to:
Dim userBaseLocationId1 As Integer = Global.LightSwitchApplication.CurrentUserInfo.UserBaseLocationId()
(The BaseLocation here is Sales Team & User is Sales Person)

By divyang_dv on   10/3/2013 2:15 PM

@divyan_dv

Hi,

Glad the article was helpful. Sorry, but I don't have an answer for your question. That's the one and only time I've used a global variable. Looks like they scrapped LightSwitchCommonModule. I'm ashamed that I'm not up on architecture given that I work in the same office with the greatest LightSwitch resource outside Redmond, and he'd give them a run for the title.

RIchard

By Richard Waddell on   6/9/2013 6:06 AM

Your name:
Comment:
Security Code
CAPTCHA image
Enter the code shown above in the box below
Add Comment   Cancel 
Microsoft Visual Studio is a registered trademark of Microsoft Corporation / LightSwitch is a registered trademark of Microsoft Corporation