Task Creation Refactoring

In the task details interface, when we create or update the task, certain properties were created that we no longer need.  We have this setup right now:

task.Name = this.TaskName;
task.Category = this.Category;
task.SetPropertyValue<bool>("IsReoccurring", this.IsReoccuring);
if (this.cboReoccurrenceMeasurement.Visible)
     task.SetPropertyValue<string>("ReoccurrenceMeasurement", this.ReoccurrenceMeasurement);
if (this.txtReoccurrenceAmount.Visible)
     task.SetPropertyValue<int>("ReoccurrenceAmount", this.ReoccurrenceAmount);
task.SetPropertyValue<string>("Description", this.Description);
task.SetPropertyValue<DateTime>("CreationDate", DateTime.Today);
task.SetPropertyValue<DateTime>("DueDate", this.DueDate); 

But, we don't need most of the reoccurring information and the due date; this will now be rolled into the Triggers collection that belongs to the task.  The reason is, maybe we don't want due date limitations, but would rather want limitations based upon other factors, such as mileage or another evaluation method.  With the new features coming up, task reoccurring criteria will be more advanced.

So, instead of using this, I loop through and create what I call trigger objects.  What is this trigger and value objects I mentioned before?  What I am using a trigger for is to allow the user to setup multiple constraints.  For instance, if you want to set multiple constraints on an item, you can do so.  Take an "Oil Change" task, for example, you can set two triggers on it: a trigger based on the mileage and a trigger based on a specific period of time.  The mileage trigger can be based on a value; a static list of values that can be updated by the user, and whenever the value is updated, any trigger associated with it can be updated as well.  This value will be in a list that can be updated whenever you would like.


No Comments