look for task

Discussions related to custom development with Select.
Post Reply
czentman
Posts: 157
Joined: Tue Dec 02, 2008 12:02 pm

look for task

Post by czentman »

within an order (IOrderInterface), I want to just see if a specific task exists as completed and just return a bool. Can I do this in a one or two line code instead of looping through the tasks?
czentman
Posts: 157
Joined: Tue Dec 02, 2008 12:02 pm

Re: look for task

Post by czentman »

Also, I want to check if any of the properties' address1 matches another address - can I do this without looping through the properties?
BobRichards
Posts: 1377
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: look for task

Post by BobRichards »

You can use LINQ expressions to hide the ugliness of some search loops. For example, if you know the checklist item Description, you can use the following to retrieve its status.

Code: Select all

dynamic order = iOrder;
IEnumerable<dynamic> tasks = order.Tasks;
bool taskCompleted = tasks.Any(t => t.Description == "Checklist Item Description" && t.Status == TaskStatusType.Completed);
Bob Richards, Senior Software Developer, SoftPro
BobRichards
Posts: 1377
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: look for task

Post by BobRichards »

Also, I want to check if any of the properties' address1 matches another address - can I do this without looping through the properties?

There is no single line answer to this.
Bob Richards, Senior Software Developer, SoftPro
Post Reply