Open Question to the Community About Dependency

I am going to show by green skin here, but that is what this blog is all about…

I am working on a project management application where all task would be stored in one table. These tasks have a status field. The status field had a pick list (waiting, in progress, complete). Some tasks depend on the completion of other tasks (zero or one to many relationship in a single table). If a an item has a child item, I want the status to automatically be “waiting” and I want it to be read-only unless the status in the child item is set to “complete.”

I hope that makes sense. For clarity’s sake:

  • If the child item’s status is “waiting” or “in progress”, the parent item’s status is automatically set to “waiting” and it cannot be changed.
  • If the child item’s status is “complete”, the parent item’s status is editable.

I am not looking for complete instructions, but pointers to resources would be appreciated.

Tagged , , ,

Seriously, Don’t Be Afraid of Code

I am loosely following the ProjectTrek example in “Beginning Microsoft Visual Studio LightSwitch Development” to create a project tracker of my own. As I was learning about calculated fields, an epiphany hit. Here it is.

LightSwitch is a great tool for modeling and displaying data, but its real value exists in its ability to empower non-coders (like me) to use code to accomplish the things they want to do when code is needed. In fact, it may be a great way to start learning how to write code.

For example, I want to add calculated fields to add total hours and total costs for a project. I can’t point-and-click to make that happen, but LightSwitch makes it very easy. All I need to do is add a calculated field to the entity (using the Computed Property button) and then click the Edit Method link in the Properties Pane for the property I just added.

When I click that Edit Method link, LightSwitch adds a method to the code for me. All I have to do is add the calculation function. Below is the code for two calculated fields. The only part I had to write are highlighted.

I didn’t know how to write those lines, but finding help on the Web is pretty easy. Also notice that LightSwitch called all the appropriate methods it needed (the first five lines) and then set up my new method for me. This may seem simple for a seasoned coder, but it probably would have taken me days to figure it out.

Tagged , ,