protected static List <Task <QueryContainer <CMFAQ> > > GetFAQTask(string q, int timeout, string domain = null) { Faq faq = new Faq(); List <Task <QueryContainer <CMFAQ> > > taskList = new List <Task <QueryContainer <CMFAQ> > >(); if (!string.IsNullOrEmpty(domain)) { taskList.Add(TimedTask.CallWithTimeoutAsync(timeout, () => new Faq().Get(q, domain), null, null)); } else { List <string> dList = faq.GetDomain(); if (dList == null) { return(taskList); } DomainMapUnit confine = GetConfigLimit("Library"); if (confine != null && confine.FAQEX != null && confine.FAQEX.Count > 0) { dList = dList.Except(confine.FAQEX).ToList <string>(); } foreach (var d in dList) { taskList.Add(TimedTask.CallWithTimeoutAsync(timeout, () => new Faq().Get(q, d), null, null)); } } return(taskList); }
private List <Task <bool> > GetFAQTaskExist(string q, int timeout, List <string> filterDomain) { Faq faq = new Faq(); List <Task <bool> > taskList = new List <Task <bool> >(); List <string> dList = faq.GetDomain(); if (dList == null) { return(taskList); } foreach (var domain in dList) { if (filterDomain.Contains(domain)) { continue; } taskList.Add(TimedTask.CallWithTimeoutAsync(timeout, () => new Faq().IsExist(q, domain), null, null)); } return(taskList); }