Archive for October, 2010

I guess most of you will know by now that ItPro|DevConnections is holding a lottery for two msdn subscriptions for all of those that took advantage of the early bird offer and subscribed for the event before the 30th of September.

Well, I was assigned to perform the lottery which is going to take place today. This got me thinking, What would be the easiest (don’t have time) and geekiest (after all it’s a tech event) way to perform this lottery? And then it stuck me “why don’t I try LightSwitch, it’ll probably take me 10 minutes to prepare a full blown application”? And so it did, here’s what I’ve done:

1. Get the Data

OrdersSchemaSo first I needed the data, meaning the details (first name, last name, email etc.) of all of those that registered before the 30th of September. Luckily this year all the registrations went through a computerized system (that Techaholics made Winking smile) so it was very easy to extract all the data I needed, in a new table “Orders” in a new database.

The “Orders” table schema in the new database looked something like this.

2. Create LightSwitch Project

Next I created a new LightSwitch project using Visual Studio 2010 and the new template that you get when you install the LightSwitch framework. You can watch the video that I’ve made to see how I did it.

LightSwitch Draw application screencast

3. Randomly selecting a winner

The random selection logic that was put inside the button click handler was as shown in the video was:

Timer tm = null;
partial void Button_Execute()
  var orderList = this.OrderCollection.ToList();

  if (tm == null)
    tm = new Timer(new TimerCallback((callbackState) =>
        var list = (List)callbackState;
        Random r = new Random((int)DateTime.Now.Ticks);
        var selectedindex = r.Next(list.Count);
        var winner = list[selectedindex];

        IContentItemProxy proxy = this.FindControl("txtWinner");
        proxy.Invoke(() =>
          var txtWinner = (System.Windows.Controls.TextBox)proxy.Control;
          txtWinner.Text = string.Format("{0} {1} ({2})", 
            winner.Name, winner.LastName, winner.Code);

    tm.Change(Timeout.Infinite, Timeout.Infinite);
    tm = null;


  • None of the selected winners in the above video are the real ones. Winners will be picked later today and officially announced at
  • I don’t guarantee that the winner selection will be made using this application. I just made this one for fun – to explore LightSwitch.
  • The data shown on the screencast are sample data and were deleted once the sample was completed


Great news arrived this week, once again I have been selected to participate in Tech·Ed Europe 2010 as a Microsoft Product Expert in the Technical Learning Center (TLC). I’m very excited and look forward for this.

So if you’re planning on attending this TechEd this year, ping me to have a chat with me ;-). See you all there…

SiteNext month, on the 27th – 28th of November, the Greek IT ( and Developers ( communities are going to host a two day, four track event for IT Professionals and Developers that need to get in touch with cutting edge technology, meet and discuss with fellow professionals and interact with a bunch of great speakers. This is a great opportunity to advance your career as all the sessions are going to be first class.

I’m also going to be there and will give two speeches. First one is going to be on the 27th at 15:30-16:45 | Cloud (IE)9 Browser Star Fantastica where I’m going to show off all the great new features of IE9, and the second one on the 28th at 11:00-12:45 | Caching for Cash where me and my colleague Dimos are going to present advanced caching patterns for our applications.

From what I’m learning seats are already limited (the event is almost sold out), so if you plan to be there, I suggest you hurry up and register.

See you all there…