+1-888-365-2779
Try Now
More in this section
Categories
Bloggers
Blogs RSS feed

Sitefinity Meets Web 2.0 (part 2) : Dating site

by Ivan Osmak

Sitefinity Meets Web 2.0 - Dating site

Undoubtedly, it takes a programmer to write about dating and romance, while using diagrams, classes, methods… Furthermore, it is also only a programmer that won’t be considered pervert if writes about dating and titles one of the sections “Basic implementation idea”. So without further ado…

This post will describe how you can use Sitefinity to roll out your own dating site.

Basic idea

As complicated as it may sometimes seem, dating is nothing more than two people meeting each other. So that’s the premise we’ll use for our application as well. Each user that wishes to find a date through our site needs to create his/her own profile. Profile is a collection of arbitrarily important facts about that person (ranging from very important such as who is the person looking for - man or a woman - to trivial facts as preferred drink). For each profile we are going to create an actual web page, so each user can have a unique url.

We’ll create two templates that will be used for creating user pages. One for female users and one for male users.

All profiles will be accessible only to other users with other profiles and they will be able to filter out potential dates on certain criteria.

Short features list

  • Each user creates a profile in order to participate in dating site
  • Each profile has it’s own page
  • To create a profile users need to supply following information :
    • First name ( required )
    • Sex ( required )
    • Sex of a person user is seeking ( required )
    • Birth date ( required )
    • Picture ( required )
    • Number of optional information : height, weight, body type, eye color, hair, smoking, drinking, education, employment status, marital status…
  • Users will be able to send private messages to each other. That will be the only way for two users to get in contact, since no email addresses or phone numbers will be displayed.
  • Users will be able to browse profiles of other users by filtering the preferences

Basic implementation idea

Similar to the Digg-clone application in this application we don’t need administrative controls, since users are doing all the work. Take a look at the simple diagram showing the components we’ll need to build in order to create dating site.

Dating site components

Let me start by explaining the web controls that we need to create.

  • User Profile - this is a key web control of this web application. This control we will implement as a DetailsView control. The view mode will be accessible by all users who have their own Profile. The edit mode will be accessible only by the user that owns the profile. And the insert mode we will use when user is creating the profile for the very first time.
  • User Messages - this is the control that will allow users to communicate among each other. To protect each user’s privacy we won’t display email or phone on the user profile and initial contact will be possible only through the User Messages control. This control has two modes : a) post a message and b) read / reply / delete messages. To the owner of a profile this control will appear in b) mode, while to other users it will appear in a) mode.
  • All Profiles - this is a control that will display all the profiles in RadGrid control. Profiles can be sorted, filtered by specific criteria (such as age, sex, smoking etc.). By clicking on a particular profile user will be taken to the individual page of that profile.

Two other things we need to create are templates for a man profile and woman profile. In case you are unfamiliar with templates and how to create them you can consult a developer manual (I’ll write a blog post on this topic this week as well). So, when user creates a profile, we’ll create a new page in Sitefinity and assign appropriate template to that page based on the user’s sex.

Creating a data provider

Since we are working with a structured data (we can’t just let users type whatever they feel like, we need a very specific info about them) we need to create a data provider for user profiles. Consider the following diagram to see how are we going to work with data.

Dating site - data provider

UserProfile.dbclass is a Nolics implementation of database table that will hold all information regarding a user profile. As you can see there is also a PageID field in this table. That field holds the id of Sitefinity page where this User profile will be located. But that will also gives us a reference other way around. When user opens a particular page we will simply search all the profiles to find a profile whose PageID matches the id of that page and load that profile in User Profile DetailsView control.

Note that all the pages will be exactly the same (they will look like a template). All the web controls will be added directly to the templates. Based on the page (and it’s id) we will just bind DetailsView (User Profile) and RadGrid (User Messages) to different data.

Since we can dynamically set the template of each page, when we create a page that will hold user’s profile we’ll take into account the sex of user and set the appropriate (man/woman) template for that page.

UserMessages.dbclass is a Nolics implementation of database table that will hold all the messages users exchange. All the fields are pretty obvious, except maybe ParentMessageID. This we’ll use for replies so that we can group messages and replies to be more user friendly.

And the very least thing we have on the diagram is Telerik.CMS namespace. This namespace we will use to create Sitefinity pages when user creates a profile and to set templates.

In case you are not sure how would you create Data Provider (it should be an assembly, .dll file) you can check how is Contacts.Data assembly implemented in following posts (there is also a link to download the project in the second post) :

Ideas for improving the application

  • Implement “hot or not” voting on each profile
  • Create an algorithm that will attempt to match “perfect” couples and give suggestions to users
  • Provider users with an ability to post video clips on their profiles

List of Sitefinity API members and namespaces you should use to accomplish this task

Namespace : Telerik.CMS

  • ICmsPage - interface that defines cms page
  • IPage - more abstract page interface implemented by ICmsPage
  • IPageBase - interface that descibes any page (not necessarily cms page) in Sitefinity. Implemented by IPage interface
  • CmsManager - class with methods for working with pages and templates

Summary

If you are about to create this application you can learn a lot by examining the JobsIntraSite module that comes with Sitefinity. Obviously, you would not care about the ControlPanel and CommandPanel controls of JobsIntraSite module since you don’t need administrative access, but you can see how data provider (Telerik.Samples.Jobs.Data) is implemented there and also learn how to work with Nolics from declarative code which you will use for all of your web controls.

Good luck!

 

2 comments

Leave a comment
  1. ben Jun 07, 2007

    So in this post when the user adds a profile record you are using CreatePage to add a page to the CMS system? Is that a better idea then say just using a GUID query string on one page like profile.aspx?ID=1288c2fb-0899-4abe-a03d-eea312d77734? Perhaps I don’t quite understand what you are doing with the CreatePage. I look forward to reading your posts in the future.

    PS How come you don’t use the sitefinity blog module? Were there some features that you thought were missing?

    Sincerely,

    Ben

  2. John Jul 15, 2007
    hello there - we are looking for a good sitefinity developer. Do you guys know any? we are a web company and likes sitefinity so far from the site info. if you know any, would you please email us at john.aster@productiveT.com Thanks John

    Leave a comment