if (AllTaskReject(relatedTasks))
{
trace.Trace("check condition");
if (relatedTasks.Equals(769190003))
{
regardingCase["statuscode"] = new OptionSetValue(912450000);
regardingCase["description"] = "All task update csutaskstatus";
regardingCase["cos_csucasestatus"] = new OptionSetValue(769190006);
trace.Trace("bool 1");
}else
if (relatedTasks.Equals(769190002))
{
regardingCase["statuscode"] = new OptionSetValue(912450000);
regardingCase["description"] = "All task update csutaskstatus";
regardingCase["cos_csucasestatus"] = new OptionSetValue(769190002);
}
}
}
catch
{
throw;
}
}
public bool AllTaskReject(EntityCollection relatedTasks)
{
//check all the the task if rejected continue if on task not rejected do nothing
if (relatedTasks.Entities.All(x => x.GetAttributeValue<OptionSetValue>("cos_csutaskstatus")?.Value == 769190003))
{
return true;
//reject
}else
{
if (relatedTasks.Entities.All(x => x.GetAttributeValue<OptionSetValue>("cos_csutaskstatus")?.Value == 769190001))
{
return true;
//approve
}
else
{
return false;
}
}