[First Module] Raffle module

Topics: Writing modules
May 19, 2014 at 5:35 PM
Hello,

I am just starting off with orchard (and asp.net to be honest(mediocre PHP, beginner Dlang and some other stuff)), not sure how the community binds here and how eager are you to give advice to fresh meat, so if you have any tips please share them if not I will figure stuff out by myself.. Any implementation, security tips, reading links appreciated (anything that would help me in general and that's not from orchard documentation..). Note: I do not have a specific question right now, this is more of a awkward 'hello' post.

I have defined myself a learning project and part of it would be a 'raffle' module- registered user -> would be allowed to enter a draw ->admin would be able to manually initiate the draw whenever needed -> giving the name of one winner and resetting the raffle. Maybe you know of a specific module I could look into or use as sort of a base for what I want to do? Tried playing around with Vote module/API, but decided I could simplify the module for this specific need by starting more or less from scratch.

Is it a good idea to add a field to UserPart in the Database to see if the user is in the current draw or not (1/0) and then select a random user through a SQL query? Or should I create a separate table and add the users who entered to it? Which way would be more effective or is there no difference, not even if there are let's say million entries?
Developer
May 19, 2014 at 11:29 PM
Uhm, hi :-). I guess you're already over the docs so make sure to also check out the Dojo Course, the Training Demo, as well as the Orchard Dojo Library (and the examples there).

We only interact with SQL directly in extremely rare cases, so what you're looking for in Orchard terms is having a content part attached to the User content type, possible with a content part record. You can execute ContentQuery or HQL queries on content items, filtering on content part record properties.