public IMessage GetContactList(int tenantDbId, StringList attributeList, SearchCriteriaCollection SearchCriteria, int maxCount = 0) { IMessage response = null; try { OutputValues output = Pointel.Interactions.Contact.Core.Request.RequestContactLists.GetContactList(tenantDbId, SearchCriteria, attributeList, maxCount); if (output.IContactMessage != null) { logger.Info("RequestContactListGet result:" + output.IContactMessage.ToString()); if ("200".Equals(output.MessageCode)) { response = output.IContactMessage; } } else { logger.Error("Error occurred while RequestContactListGet : " + output.Message); } } catch (Exception generalException) { logger.Error("Error occurred as : " + generalException.ToString()); } return(response); }
public NewsItemSearchCancelEventArgs(string searchID, string resultContainerName, SearchCriteriaCollection searchCriteria, ArrayList categoryScope, ArrayList feedScope, bool cancel) : base(cancel) { this.SearchID = searchID; this.ResultContainerName = resultContainerName; this.SearchCriteria = searchCriteria; this.CategoryScope = categoryScope; this.FeedScope = feedScope; }
private FinderNode OnBeforeSearch(string id, string resultContainerName, SearchCriteriaCollection criteria, ArrayList categoryScope, ArrayList feedScope) { if (this.BeforeNewsItemSearch != null) { bool cancel = false; NewsItemSearchCancelEventArgs args = new NewsItemSearchCancelEventArgs(id, resultContainerName, criteria, categoryScope, feedScope, cancel); this.BeforeNewsItemSearch(this, args); if (args.Cancel || args.ResultContainer == null) { return(null); } return(args.ResultContainer); } return(new FinderNode()); }
public static OutputValues GetContactList(int tenantDbId, SearchCriteriaCollection SearchCriteria, StringList attributeList, int pageMaxSize) { OutputValues result = new OutputValues(); if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened) { RequestContactListGet requestContactListGet = new RequestContactListGet(); // requestContactListGet.AttributeList = attributeList; requestContactListGet.TenantId = tenantDbId; requestContactListGet.ContactCount = true; if (pageMaxSize > 0) { requestContactListGet.PageMaxSize = pageMaxSize; } else { requestContactListGet.PageMaxSize = 100; } requestContactListGet.SearchCriteria = SearchCriteria; IMessage response = Settings.UCSProtocol.Request(requestContactListGet); if (response != null && response.Id == EventContactListGet.MessageId) { result.IContactMessage = response; result.MessageCode = "200"; result.Message = "Get ContactList Successful."; } else { result.IContactMessage = null; result.MessageCode = "2001"; result.Message = "Error Occurred while ContactListGet."; } } else { result.IContactMessage = null; result.MessageCode = "2001"; result.Message = "Contact server is not active."; } return(result); }
/// <summary> /// Search for NewsItems, that match a provided criteria collection within a optional search scope. /// </summary> /// <param name="criteria">SearchCriteriaCollection containing the defined search criteria</param> /// <param name="scope">Search scope: an array of NewsFeed</param> /// <param name="tag">optional object to be used by the caller to identify this search</param> /// <param name="cultureName">Name of the culture.</param> /// <param name="returnFullItemText">if set to <c>true</c>, full item texts are returned instead of the summery.</param> public void SearchNewsItems(SearchCriteriaCollection criteria, INewsFeed[] scope, object tag, string cultureName, bool returnFullItemText) { // if scope is an empty array: search all, else search only in spec. feeds int feedmatches = 0; int itemmatches = 0; IList <INewsItem> unreturnedMatchItems = new List <INewsItem>(); var fiList = new FeedInfoList(String.Empty); Exception ex; bool valid = SearchHandler.ValidateSearchCriteria(criteria, cultureName, out ex); if (ex != null) // report always any error (warnings) { // render the error in-line (search result): fiList.Add(FeedSource.CreateHelpNewsItemFromException(ex).FeedDetails); feedmatches = fiList.Count; unreturnedMatchItems = fiList.GetAllNewsItems(); itemmatches = unreturnedMatchItems.Count; } if (valid) { try { // do the search (using lucene): LuceneSearch.Result r = SearchHandler.ExecuteSearch(criteria, scope, this.Sources.Select(entry => entry.Source), cultureName); // we iterate r.ItemsMatched to build a // NewsItemIdentifier and ArrayList list with items, that // match the read status (if this was a search criteria) // then call FindNewsItems(NewsItemIdentifier[]) to get also // the FeedInfoList. // Raise ONE event, instead of two to return all (counters, lists) SearchCriteriaProperty criteriaProperty = null; foreach (ISearchCriteria sc in criteria) { criteriaProperty = sc as SearchCriteriaProperty; if (criteriaProperty != null && PropertyExpressionKind.Unread == criteriaProperty.WhatKind) { break; } } ItemReadState readState = ItemReadState.Ignore; if (criteriaProperty != null) { readState = criteriaProperty.BeenRead ? ItemReadState.BeenRead : ItemReadState.Unread; } if (r != null && r.ItemMatchCount > 0) { /* append results */ var nids = new SearchHitNewsItem[r.ItemsMatched.Count]; r.ItemsMatched.CopyTo(nids, 0); //look in every feed source to find source feed for matching news items IEnumerable <FeedInfoList> results = Sources.Select(entry => entry.Source.FindNewsItems(nids, readState, returnFullItemText)); foreach (FeedInfoList fil in results) { fiList.AddRange(fil); } feedmatches = fiList.Count; unreturnedMatchItems = fiList.GetAllNewsItems(); itemmatches = unreturnedMatchItems.Count; } } catch (Exception searchEx) { // render the error in-line (search result): fiList.Add(FeedSource.CreateHelpNewsItemFromException(searchEx).FeedDetails); feedmatches = fiList.Count; unreturnedMatchItems = fiList.GetAllNewsItems(); itemmatches = unreturnedMatchItems.Count; } } RaiseSearchFinishedEvent(tag, fiList, unreturnedMatchItems, feedmatches, itemmatches); }
/// <summary> /// Gets the contacts. /// </summary> /// <param name="contactId">The contact identifier.</param> /// <param name="media">The media.</param> /// <param name="tenantId">The tenant identifier.</param> /// <returns></returns> public static OutputValues GetContacts(SearchCriteriaCollection searchCriteriaCollection, string contactID, int tenantId, int pagemaxSize, List <string> attributesNames) { Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); OutputValues output = OutputValues.GetInstance(); try { RequestGetInteractionsForContact requestGetContacts = RequestGetInteractionsForContact.Create(); requestGetContacts.DataSource = new NullableDataSourceType(DataSourceType.Main); requestGetContacts.SortCriteria = new SortCriteriaCollection(); SortCriteriaCollection sortCC = new SortCriteriaCollection(); SortCriteria sortc = new SortCriteria() { AttrName = InteractionSearchCriteriaConstants.StartDate, SortOperator = new NullableSortMode(SortMode.Descending), SortIndex = 0 }; sortCC.Add(sortc); requestGetContacts.SortCriteria = sortCC; requestGetContacts.SearchCriteria = searchCriteriaCollection; StringList stringList = new StringList(); if (attributesNames != null && attributesNames.Count > 0) { for (int index = 0; index < attributesNames.Count; index++) { stringList.Add(attributesNames[index]); } } requestGetContacts.AttributeList = stringList; requestGetContacts.TenantId = tenantId; requestGetContacts.ContactId = contactID; if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened) { logger.Info("---------------------------------------------------------"); IMessage message = Settings.UCSProtocol.Request(requestGetContacts); if (message != null) { logger.Trace(message.ToString()); output.IContactMessage = message; output.MessageCode = "200"; output.Message = "Get Interactions For Contact Successful"; } else { output.IContactMessage = null; output.MessageCode = "2001"; output.Message = "Don't Get Interactions For Contact Successful"; } } else { output.IContactMessage = null; output.MessageCode = "2001"; output.Message = "Universal Contact Server protocol is Null or Closed"; logger.Warn("GetContacts() : Universal Contact Server protocol is Null.."); } } catch (Exception generalException) { logger.Error("Error Occurred while Get Interactions For Contact request" + generalException.ToString()); output.IContactMessage = null; output.MessageCode = "2001"; output.Message = generalException.Message; } return(output); }
private void OnSearchCancelClick(object sender, EventArgs e) { switch (_rssSearchState) { case ItemSearchState.Pending: SetControlStateTo(ItemSearchState.Searching, SR.RssSearchStateMessage); string searchID = Guid.NewGuid().ToString(); string newName = textFinderCaption.Text.Trim(); SearchCriteriaCollection criteria = this.SearchDialogGetSearchCriterias(); //Test scope: // ArrayList cs = new ArrayList(1); // cs.Add("Weblogs"); // ArrayList fs = new ArrayList(1); // fs.Add("http://www.rendelmann.info/blog/GetRss.asmx"); // fs.Add("http://www.25hoursaday.com/webblog/GetRss.asmx"); // activate for scope tests: // resultContainer.Finder = new RssFinder(resultContainer, this.SearchDialogGetSearchCriterias(), // cs, fs, new RssFinder.SearchScopeResolveCallback(this.ScopeResolve) , true); ArrayList catScope = null; ArrayList feedScope = null; // if we have scope nodes, and not all selected: if (this.treeRssSearchScope.Nodes.Count > 0 && !this.treeRssSearchScope.Nodes[0].Checked) { ArrayList cs = new ArrayList(), fs = new ArrayList(); TreeHelper.GetCheckedNodes(this.treeRssSearchScope.Nodes[0], cs, fs); if (cs.Count > 0) { catScope = new ArrayList(cs.Count); } if (fs.Count > 0) { feedScope = new ArrayList(fs.Count); } foreach (TreeNode n in cs) { catScope.Add(TreeHelper.BuildCategoryStoreName(n)); } foreach (TreeNode n in fs) { feedScope.Add((string)n.Tag); } } FinderNode resultContainer; try { resultContainer = this.OnBeforeSearch(searchID, newName, criteria, catScope, feedScope); } catch (Exception validationException) { SetControlStateTo(ItemSearchState.Failure, validationException.Message); break; } this.Refresh(); if (resultContainer != null) { try { OnSearch(resultContainer); } catch (Exception validationException) { SetControlStateTo(ItemSearchState.Failure, validationException.Message); break; } } break; case ItemSearchState.Searching: _rssSearchState = ItemSearchState.Canceled; //this.SetSearchStatusText(SR.RssSearchCancelledStateMessage); btnSearchCancel.Enabled = false; break; case ItemSearchState.Canceled: Debug.Assert(false); // should not be able to press Search button while it is canceling break; } }
public void SearchDialogSetSearchCriterias(FinderNode node) { if (node == null) { return; } SearchCriteriaCollection criterias = node.Finder.SearchCriterias; string searchName = node.Finder.FullPath; ResetControlState(); Queue itemAgeCriterias = new Queue(2); foreach (ISearchCriteria criteria in criterias) { SearchCriteriaString str = criteria as SearchCriteriaString; if (str != null) { SearchStringElement where = str.Where; if ((where & SearchStringElement.Title) == SearchStringElement.Title) { checkBoxRssSearchInTitle.Checked = true; } else { checkBoxRssSearchInTitle.Checked = false; } if ((where & SearchStringElement.Content) == SearchStringElement.Content) { checkBoxRssSearchInDesc.Checked = true; } else { checkBoxRssSearchInDesc.Checked = false; } if ((where & SearchStringElement.Subject) == SearchStringElement.Subject) { checkBoxRssSearchInCategory.Checked = true; } else { checkBoxRssSearchInCategory.Checked = false; } if ((where & SearchStringElement.Link) == SearchStringElement.Link) { checkBoxRssSearchInLink.Checked = true; } else { checkBoxRssSearchInLink.Checked = false; } SearchFieldsGroupExpanded = true; // if (str.WhatKind == StringExpressionKind.Text) // radioRssSearchSimpleText.Checked = true; // else if (str.WhatKind == StringExpressionKind.RegularExpression) // radioRssSearchRegEx.Checked = true; // else if (str.WhatKind == StringExpressionKind.XPathExpression) // radioRssSearchExprXPath.Checked = true; // // if (!radioRssSearchSimpleText.Checked) // this.collapsiblePanelRssSearchExprKindEx.Collapsed = false; textSearchExpression.Text = str.What; } SearchCriteriaProperty prop = criteria as SearchCriteriaProperty; if (prop != null) { if (prop.WhatKind == PropertyExpressionKind.Unread) { if (!prop.BeenRead) { checkBoxRssSearchUnreadItems.Checked = true; } else { checkBoxRssSearchUnreadItems.Checked = false; } } IsAdvancedOptionReadStatusActive = true; AdvancedOptionsGroupExpanded = true; } SearchCriteriaAge age = criteria as SearchCriteriaAge; if (age != null) { if (age.WhatRelativeToToday.CompareTo(TimeSpan.Zero) != 0) { // relative item age specified IsAdvancedOptionItemAgeActive = true; if (age.WhatKind == DateExpressionKind.NewerThan) { this.optionSetItemAge.CheckedIndex = 0; } else { this.optionSetItemAge.CheckedIndex = 1; } this.comboRssSearchItemAge.SelectedIndex = Utils.RssSearchItemAgeToIndex(age.WhatRelativeToToday); } else { // absolute item age or range specified, queue for later handling itemAgeCriterias.Enqueue(age); } if (!AdvancedOptionsGroupExpanded) { AdvancedOptionsGroupExpanded = true; } } } if (itemAgeCriterias.Count > 0) { // absolute date specified IsAdvancedOptionItemPostedActive = true; SearchCriteriaAge ageAbs = (SearchCriteriaAge)itemAgeCriterias.Dequeue(); if (ageAbs.WhatKind == DateExpressionKind.Equal) { this.comboBoxRssSearchItemPostedOperator.SelectedIndex = 0; } else if (ageAbs.WhatKind == DateExpressionKind.OlderThan) { this.comboBoxRssSearchItemPostedOperator.SelectedIndex = 1; } else if (ageAbs.WhatKind == DateExpressionKind.NewerThan) { this.comboBoxRssSearchItemPostedOperator.SelectedIndex = 2; } else // between (range): { this.comboBoxRssSearchItemPostedOperator.SelectedIndex = 3; } this.dateTimeRssSearchItemPost.Value = ageAbs.What; if (itemAgeCriterias.Count > 1) { // range specified SearchCriteriaAge ageFrom = (SearchCriteriaAge)itemAgeCriterias.Dequeue(); SearchCriteriaAge ageTo = (SearchCriteriaAge)itemAgeCriterias.Dequeue(); this.dateTimeRssSearchItemPost.Value = ageFrom.What; this.dateTimeRssSearchPostBefore.Value = ageTo.What; } } itemAgeCriterias.Clear(); if (!node.IsTempFinderNode) { textFinderCaption.Text = searchName; } if (textFinderCaption.Text.Length > 0) { SaveSearchGroupExpanded = true; } PopulateTreeRssSearchScope(); // init, all checked. Common case if (this.treeRssSearchScope.Nodes.Count == 0 || (node.Finder.CategoryPathScope == null || node.Finder.CategoryPathScope.Count == 0) && (node.Finder.FeedUrlScope == null || node.Finder.FeedUrlScope.Count == 0)) { return; } this.treeRssSearchScope.Nodes[0].Checked = false; // uncheck all. TreeHelper.CheckChildNodes(this.treeRssSearchScope.Nodes[0], false); TreeHelper.SetCheckedNodes(this.treeRssSearchScope.Nodes[0], node.Finder.CategoryPathScope, node.Finder.FeedUrlScope); }
private SearchCriteriaCollection SearchDialogGetSearchCriterias() { SearchCriteriaCollection sc = new SearchCriteriaCollection(); SearchStringElement where = SearchStringElement.Undefined; if (textSearchExpression.Text.Length > 0) { if (checkBoxRssSearchInTitle.Checked) { where |= SearchStringElement.Title; } if (checkBoxRssSearchInDesc.Checked) { where |= SearchStringElement.Content; } if (checkBoxRssSearchInCategory.Checked) { where |= SearchStringElement.Subject; } if (checkBoxRssSearchInLink.Checked) { where |= SearchStringElement.Link; } } StringExpressionKind kind = StringExpressionKind.LuceneExpression; // if (radioRssSearchSimpleText.Checked) // kind = StringExpressionKind.Text; // else if (radioRssSearchRegEx.Checked) // kind = StringExpressionKind.RegularExpression; // else if (radioRssSearchExprXPath.Checked) // kind = StringExpressionKind.XPathExpression; SearchCriteriaString scs = new SearchCriteriaString(textSearchExpression.Text, where, kind); sc.Add(scs); if (this.IsAdvancedOptionReadStatusActive) { SearchCriteriaProperty scp = new SearchCriteriaProperty(); scp.BeenRead = !checkBoxRssSearchUnreadItems.Checked; scp.WhatKind = PropertyExpressionKind.Unread; sc.Add(scp); } if (this.IsAdvancedOptionItemAgeActive) { SearchCriteriaAge sca = new SearchCriteriaAge(); if (this.optionSetItemAge.CheckedIndex == 0) { sca.WhatKind = DateExpressionKind.NewerThan; } else { sca.WhatKind = DateExpressionKind.OlderThan; } sca.WhatRelativeToToday = Utils.RssSearchItemAgeToTimeSpan(this.comboRssSearchItemAge.SelectedIndex); sc.Add(sca); } if (this.IsAdvancedOptionItemPostedActive) { if (comboBoxRssSearchItemPostedOperator.SelectedIndex == 0) { sc.Add(new SearchCriteriaAge(dateTimeRssSearchItemPost.Value, DateExpressionKind.Equal)); } else if (comboBoxRssSearchItemPostedOperator.SelectedIndex == 1) { sc.Add(new SearchCriteriaAge(dateTimeRssSearchItemPost.Value, DateExpressionKind.OlderThan)); } else if (comboBoxRssSearchItemPostedOperator.SelectedIndex == 2) { sc.Add(new SearchCriteriaAge(dateTimeRssSearchItemPost.Value, DateExpressionKind.NewerThan)); } else { // handle case: either one date is greater than the other or equal if (dateTimeRssSearchItemPost.Value > dateTimeRssSearchPostBefore.Value) { sc.Add(new SearchCriteriaDateRange(dateTimeRssSearchPostBefore.Value, dateTimeRssSearchItemPost.Value)); } else if (dateTimeRssSearchItemPost.Value < dateTimeRssSearchPostBefore.Value) { sc.Add(new SearchCriteriaDateRange(dateTimeRssSearchItemPost.Value, dateTimeRssSearchPostBefore.Value)); } else { sc.Add(new SearchCriteriaAge(dateTimeRssSearchPostBefore.Value, DateExpressionKind.Equal)); } } } return(sc); }
public IMessage GetContactsforForwardMail(string searchText, int maxresults, out bool isIndex, string[] contactIDs = null) { IMessage response = null; try { var stringlist = new string[] { "EmailAddress", "FirstName", "LastName", "PhoneNumber" }; if (ContactDataContext.GetInstance().IsContactIndexFound) { isIndex = true; string query = "TenantId:" + ConfigContainer.Instance().TenantDbId; //Add EmailAddress, FirstName, LastName and PhoneNumber for searching string subQuery = ""; foreach (string key in stringlist) { if (!Settings.ContactDataContext.GetInstance().ContactValidAttribute.ContainsKey(key)) { continue; } subQuery += (!string.IsNullOrEmpty(subQuery) ? " OR " : "") + key + ":" + searchText + "*"; } if (!string.IsNullOrEmpty(subQuery)) { query += " AND (" + subQuery + ")"; } //Add ContactIDs for searching subQuery = string.Empty; if (contactIDs != null && contactIDs.Length > 0) { //System.Threading.Tasks.Parallel.ForEach(contactIDs, contactID => //{ // subQuery += (!string.IsNullOrEmpty(subQuery) ? " OR " : "") + "Id" + ":" + contactID; //}); for (int i = 0; i < contactIDs.Length; i++) { subQuery += (!string.IsNullOrEmpty(subQuery) ? " OR " : "") + "Id" + ":" + contactIDs[i]; } if (!string.IsNullOrEmpty(subQuery)) { query += " AND (" + subQuery + ")"; } maxresults = contactIDs.Length; } response = SearchContact(query, maxresults); } else { isIndex = false; if (contactIDs != null && contactIDs.Length > 0) { return(response); } //Assign Search Criteria Collection for searching SearchCriteriaCollection searchCriteriaCollection = new SearchCriteriaCollection(); //Assign Complex Search Criteria for searching var csub1 = new ComplexSearchCriteria() { Prefix = Prefixes.And }; // Add cChildOr1 in csub1 var csub2 = new ComplexSearchCriteria() { Prefix = Prefixes.And }; // Add cChildOr2 in csub2 //Add EmailAddress, FirstName, LastName and PhoneNumber for searching StringList attributeList = new StringList(); string attributeValue = "*".Equals(searchText) ? "" : searchText; csub1.Criterias = new SearchCriteriaCollection(); for (int index = 0; index < stringlist.Length; index++) { attributeList.Add(stringlist[index]); var cChildOr1 = new ComplexSearchCriteria() { Prefix = Prefixes.Or }; cChildOr1.Criterias = new SearchCriteriaCollection(); SimpleSearchCriteria simpleSearchCriteria = new SimpleSearchCriteria() { AttrName = stringlist[index], AttrValue = attributeValue + "*", Operator = new NullableOperators(Operators.Like) }; cChildOr1.Criterias.Add(simpleSearchCriteria); if (contactIDs != null && contactIDs.Length > 0) { csub1.Criterias.Add(cChildOr1); } else { searchCriteriaCollection.Add(cChildOr1); } } //if (contactIDs != null && contactIDs.Length > 0) //{ //Add ContactIDs for searching //csub2.Criterias = new SearchCriteriaCollection(); //for (int i = 0; i < contactIDs.Length; i++) //{ // var cChildOr2 = new ComplexSearchCriteria() { Prefix = Prefixes.Or }; // cChildOr2.Criterias = new SearchCriteriaCollection(); // SimpleSearchCriteria simpleSearchCriteria = new SimpleSearchCriteria() { AttrName = Genesyslab.Platform.Contacts.Protocols.ContactSearchCriteriaConstants.ContactId, AttrValue = contactIDs[i], Operator = new NullableOperators(Operators.Equal) }; // cChildOr2.Criterias.Add(simpleSearchCriteria); // // Add cChildOr2 in csub2 // csub2.Criterias.Add(cChildOr2); //} //Finally add sub1 and sub2 in searchCriteriaCollection //searchCriteriaCollection.Add(csub1); //searchCriteriaCollection.Add(csub2); //} attributeList.Add("MergeId"); response = GetContactList(ConfigContainer.Instance().TenantDbId, attributeList, searchCriteriaCollection, maxresults); } } catch (Exception generalException) { isIndex = false; logger.Error("Error occurred as : " + generalException.ToString()); } return(response); }
public IMessage GetInteractionList(int tenantId, int pagemaxSize, EntityTypes entitypes, SearchCriteriaCollection searchCriteriaCollection, List <string> attributesNames) { return(RequestGetInteractionList.GetInteractionList(tenantId, pagemaxSize, entitypes, searchCriteriaCollection, attributesNames).IContactMessage); }
/// <summary> /// Gets the recent interaction list. /// </summary> /// <param name="universalContactServerProtocol">The universal contact server protocol.</param> /// <param name="mediaType">Type of the media.</param> /// <returns></returns> public static OutputValues GetRecentInteractionList(string mediaType, string contactID) { Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); OutputValues output = OutputValues.GetInstance(); try { RequestInteractionListGet requestInteractionListGet = RequestInteractionListGet.Create(); requestInteractionListGet.DataSource = new NullableDataSourceType(DataSourceType.Main); requestInteractionListGet.SortCriteria = new SortCriteriaCollection(); SortCriteriaCollection sortCC = new SortCriteriaCollection(); SortCriteria sortc = new SortCriteria() { AttrName = InteractionSearchCriteriaConstants.StartDate, SortOperator = new NullableSortMode(SortMode.Descending), SortIndex = 0 }; sortCC.Add(sortc); requestInteractionListGet.SortCriteria = sortCC; SimpleSearchCriteria sSC1 = new SimpleSearchCriteria() { AttrName = InteractionSearchCriteriaConstants.MediaTypeId, AttrValue = mediaType.ToLower(), Operator = new NullableOperators(Operators.Equal) }; SimpleSearchCriteria sSC2 = new SimpleSearchCriteria() { AttrName = InteractionSearchCriteriaConstants.StartDate, AttrValue = DateTime.Now.ToString("yyyy") + "-" + DateTime.Now.Month.ToString() + "-" + (DateTime.Now.Day).ToString() + "T00:00:00.000Z", Operator = new NullableOperators(Operators.GreaterOrEqual) }; SimpleSearchCriteria sSC3 = new SimpleSearchCriteria() { AttrName = InteractionSearchCriteriaConstants.Status, AttrValue = ((int)Statuses.Stopped).ToString(), Operator = new NullableOperators(Operators.Equal) }; SimpleSearchCriteria sSC4 = new SimpleSearchCriteria() { AttrName = InteractionSearchCriteriaConstants.ContactId, AttrValue = contactID, Operator = new NullableOperators(Operators.Equal) }; ComplexSearchCriteria cmpSC = new ComplexSearchCriteria() { Prefix = Prefixes.And }; cmpSC.Criterias = new SearchCriteriaCollection(); cmpSC.Criterias.Add(sSC1); ComplexSearchCriteria cmpSC2 = new ComplexSearchCriteria() { Prefix = Prefixes.And }; cmpSC2.Criterias = new SearchCriteriaCollection(); cmpSC2.Criterias.Add(sSC2); ComplexSearchCriteria cmpSC3 = new ComplexSearchCriteria() { Prefix = Prefixes.And }; cmpSC3.Criterias = new SearchCriteriaCollection(); cmpSC3.Criterias.Add(sSC3); ComplexSearchCriteria cmpSC4 = new ComplexSearchCriteria() { Prefix = Prefixes.And }; cmpSC4.Criterias = new SearchCriteriaCollection(); cmpSC4.Criterias.Add(sSC4); SearchCriteriaCollection srchCrit = new SearchCriteriaCollection(); srchCrit.Add(cmpSC); srchCrit.Add(cmpSC2); srchCrit.Add(cmpSC3); srchCrit.Add(cmpSC4); requestInteractionListGet.SearchCriteria = new SearchCriteriaCollection(); requestInteractionListGet.SearchCriteria = srchCrit; StringList stringList = new StringList(); stringList.Add("StartDate"); stringList.Add("Subject"); requestInteractionListGet.AttributeList = stringList; requestInteractionListGet.TenantId = Settings.tenantDBID; if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened) { logger.Info("------------RequestGetRecentInteractionList-------------"); logger.Info("Media Type :" + mediaType); logger.Info("Contact ID :" + contactID); logger.Info("----------------------------------------------"); IMessage response = Settings.UCSProtocol.Request(requestInteractionListGet); if (response != null) { logger.Trace(response.ToString()); output.IContactMessage = response; output.MessageCode = "200"; output.Message = "Received Recent Interaction List Successfully"; } else { output.IContactMessage = null; output.MessageCode = "200"; output.Message = "Doesn't Received Recent Interaction List Successfully"; } } else { output.IContactMessage = null; output.MessageCode = "2001"; output.Message = "Universal Contact Server protocol is Null or Closed"; logger.Warn("GetRecentInteractionList() : Contact Server protocol is Null.."); } } catch (Exception generalException) { logger.Error("Error occurred while Request Get Recent Interaction List " + generalException.ToString()); output.IContactMessage = null; output.MessageCode = "2001"; output.Message = generalException.Message; } return(output); }
/// <summary> /// Gets the interaction count. /// </summary> /// <param name="universalContactServerProtocol">The universal contact server protocol.</param> /// <param name="mediaType">Type of the media.</param> /// <param name="contactID">The contact unique identifier.</param> /// <returns></returns> public static OutputValues GetTotalInteractionCount(string contactID, string interactionId) { Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); OutputValues output = OutputValues.GetInstance(); try { RequestCountInteractions requestCountInteractions = RequestCountInteractions.Create(); requestCountInteractions.TenantId = Settings.tenantDBID; SimpleSearchCriteria sSC1 = new SimpleSearchCriteria() { AttrName = InteractionSearchCriteriaConstants.MediaTypeId, AttrValue = "voice", Operator = new NullableOperators(Operators.NotEqual) }; SimpleSearchCriteria sSC2 = new SimpleSearchCriteria() { AttrName = InteractionSearchCriteriaConstants.Status, AttrValue = ((int)Statuses.InProcess).ToString(), Operator = new NullableOperators(Operators.Equal) }; SimpleSearchCriteria sSC3 = new SimpleSearchCriteria() { AttrName = InteractionSearchCriteriaConstants.Id, AttrValue = null, Operator = new NullableOperators(Operators.NotEqual) }; SimpleSearchCriteria sSC4 = new SimpleSearchCriteria() { AttrName = InteractionSearchCriteriaConstants.ContactId, AttrValue = contactID, Operator = new NullableOperators(Operators.Equal) }; ComplexSearchCriteria cmpSC = new ComplexSearchCriteria() { Prefix = Prefixes.And }; cmpSC.Criterias = new SearchCriteriaCollection(); cmpSC.Criterias.Add(sSC1); ComplexSearchCriteria cmpSC2 = new ComplexSearchCriteria() { Prefix = Prefixes.And }; cmpSC2.Criterias = new SearchCriteriaCollection(); cmpSC2.Criterias.Add(sSC2); ComplexSearchCriteria cmpSC3 = new ComplexSearchCriteria() { Prefix = Prefixes.And }; cmpSC3.Criterias = new SearchCriteriaCollection(); cmpSC3.Criterias.Add(sSC3); ComplexSearchCriteria cmpSC4 = new ComplexSearchCriteria() { Prefix = Prefixes.And }; cmpSC4.Criterias = new SearchCriteriaCollection(); cmpSC4.Criterias.Add(sSC4); SearchCriteriaCollection srchCrit = new SearchCriteriaCollection(); srchCrit.Add(cmpSC); srchCrit.Add(cmpSC2); srchCrit.Add(cmpSC3); srchCrit.Add(cmpSC4); requestCountInteractions.SearchCriteria = new SearchCriteriaCollection(); requestCountInteractions.SearchCriteria = srchCrit; if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened) { logger.Info("------------RequestCountInteractions-------------"); logger.Info("Interaction ID :" + interactionId); logger.Info("Contact ID :" + contactID); logger.Info("-------------------------------------------------"); IMessage response = Settings.UCSProtocol.Request(requestCountInteractions); if (response != null) { logger.Trace(response.ToString()); output.IContactMessage = response; output.MessageCode = "200"; output.Message = "Received Total InProcess Interaction count Successfully"; } else { output.IContactMessage = null; output.MessageCode = "2001"; output.Message = "Don't Received Total InProcess Interaction count Successfully"; } } else { output.IContactMessage = null; output.MessageCode = "2001"; output.Message = "Universal Contact Server protocol is Null or Closed"; logger.Warn("GetInteractionCount() : Universal Contact Server Protocol is Null"); } } catch (Exception error) { logger.Error("GetInteractionCount(): Error occurred while retrieving total in-process interaction count :" + error.ToString()); output.IContactMessage = null; output.MessageCode = "2001"; output.Message = error.Message; } return(output); }
/// <summary> /// Gets the recent interaction list. /// </summary> /// <param name="mediaType">Type of the media.</param> /// <param name="contactID">The contact unique identifier.</param> /// <param name="tenantId">The tenant unique identifier.</param> /// <param name="attributesNames">The attributes names.</param> /// <returns></returns> public static OutputValues GetRecentInteractionList(string contactID, int tenantId, string interactionID, List <string> attributesNames) { Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); OutputValues output = OutputValues.GetInstance(); try { RequestInteractionListGet requestInteractionListGet = RequestInteractionListGet.Create(); requestInteractionListGet.DataSource = new NullableDataSourceType(DataSourceType.Main); requestInteractionListGet.SortCriteria = new SortCriteriaCollection(); SortCriteriaCollection sortCC = new SortCriteriaCollection(); SortCriteria sortc = new SortCriteria() { AttrName = InteractionSearchCriteriaConstants.StartDate, SortOperator = new NullableSortMode(SortMode.Descending), SortIndex = 0 }; sortCC.Add(sortc); requestInteractionListGet.SortCriteria = sortCC; SimpleSearchCriteria sSC1 = new SimpleSearchCriteria() { AttrName = InteractionSearchCriteriaConstants.MediaTypeId, AttrValue = "voice", Operator = new NullableOperators(Operators.NotEqual) }; SimpleSearchCriteria sSC2 = new SimpleSearchCriteria() { AttrName = InteractionSearchCriteriaConstants.StartDate, AttrValue = DateTime.Now.ToString("yyyy") + "-" + DateTime.Now.Month.ToString() + "-" + (DateTime.Now.Day).ToString() + "T00:00:00.000Z", Operator = new NullableOperators(Operators.GreaterOrEqual) }; SimpleSearchCriteria sSC3 = new SimpleSearchCriteria() { AttrName = InteractionSearchCriteriaConstants.Id, AttrValue = interactionID, Operator = new NullableOperators(Operators.NotEqual) }; SimpleSearchCriteria sSC4 = new SimpleSearchCriteria() { AttrName = InteractionSearchCriteriaConstants.ContactId, AttrValue = contactID, Operator = new NullableOperators(Operators.Equal) }; ComplexSearchCriteria cmpSC = new ComplexSearchCriteria() { Prefix = Prefixes.And }; cmpSC.Criterias = new SearchCriteriaCollection(); cmpSC.Criterias.Add(sSC1); ComplexSearchCriteria cmpSC2 = new ComplexSearchCriteria() { Prefix = Prefixes.And }; cmpSC2.Criterias = new SearchCriteriaCollection(); cmpSC2.Criterias.Add(sSC2); ComplexSearchCriteria cmpSC3 = new ComplexSearchCriteria() { Prefix = Prefixes.And }; cmpSC3.Criterias = new SearchCriteriaCollection(); cmpSC3.Criterias.Add(sSC3); ComplexSearchCriteria cmpSC4 = new ComplexSearchCriteria() { Prefix = Prefixes.And }; cmpSC4.Criterias = new SearchCriteriaCollection(); cmpSC4.Criterias.Add(sSC4); SearchCriteriaCollection srchCrit = new SearchCriteriaCollection(); srchCrit.Add(cmpSC); srchCrit.Add(cmpSC2); srchCrit.Add(cmpSC3); srchCrit.Add(cmpSC4); requestInteractionListGet.SearchCriteria = new SearchCriteriaCollection(); requestInteractionListGet.SearchCriteria = srchCrit; StringList stringList = new StringList(); if (attributesNames.Count > 0) { foreach (string attribute in attributesNames) { stringList.Add(attribute); } } //stringList.Add("StartDate"); //stringList.Add("Subject"); requestInteractionListGet.AttributeList = stringList; requestInteractionListGet.TenantId = tenantId; if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened) { IMessage response = Settings.UCSProtocol.Request(requestInteractionListGet); if (response != null && response.Id == EventInteractionListGet.MessageId) { //EventInteractionListGet eventInteractionListGet = (EventInteractionListGet)response; //if (eventInteractionListGet != null && eventInteractionListGet.InteractionData != null) //{ // interactionDataList = eventInteractionListGet.InteractionData; // logger.Info("------------RequestGetRecentInteractionList-------------"); // logger.Info("Media Type :" + mediaType); // logger.Info("Contact ID :" + contactID); // logger.Info("----------------------------------------------"); // logger.Trace(eventInteractionListGet.ToString()); // output.MessageCode = "200"; // output.Message = "Received Recent Interaction List Successfully"; // output.GetInteractionDataList = interactionDataList; //} output.MessageCode = "200"; output.Message = "Get Recent Interaction List Successful"; output.IContactMessage = response; } else { output.MessageCode = "2001"; output.Message = "Get Recent Interaction List Failed"; output.IContactMessage = response; } } else { logger.Warn("GetRecentInteractionList() : Contact Server protocol is Null.."); } } catch (Exception generalException) { logger.Error("Error occurred while Request Get Recent Interaction List " + generalException.ToString()); output.MessageCode = "2001"; output.Message = generalException.Message; output.IContactMessage = null; } return(output); }
public static OutputValues GetInteractionList(int tenantId, int pagemaxSize, EntityTypes entitypes, SearchCriteriaCollection searchCriteriaCollection, List <string> attributesNames) { Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); OutputValues output = new OutputValues(); try { RequestInteractionListGet requestGetInteractionList = RequestInteractionListGet.Create(); requestGetInteractionList.DataSource = new NullableDataSourceType(DataSourceType.Main); requestGetInteractionList.TenantId = new Genesyslab.Platform.Commons.Collections.NullableInt(tenantId); requestGetInteractionList.PageMaxSize = new Genesyslab.Platform.Commons.Collections.NullableInt(pagemaxSize); requestGetInteractionList.SearchCriteria = searchCriteriaCollection; StringList stringList = new StringList(); if (attributesNames.Count > 0) { foreach (string attribute in attributesNames) { stringList.Add(attribute); } } requestGetInteractionList.AttributeList = stringList; requestGetInteractionList.EntityTypeId = new NullableEntityTypes(entitypes); if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened) { logger.Info("------------RequestGetInteractionList-------------"); logger.Info("TenantId :" + tenantId); logger.Info("--------------------------------------------------"); IMessage message = Settings.UCSProtocol.Request(requestGetInteractionList); if (message != null) { logger.Trace(message.ToString()); output.IContactMessage = message; output.MessageCode = "200"; output.Message = "Getting Interactions For Agent Successful"; } else { output.IContactMessage = null; output.MessageCode = "2001"; output.Message = "Getting Interactions For Agent UnSuccessful"; } } else { output.IContactMessage = null; output.MessageCode = "2001"; output.Message = "Universal Contact Server protocol is Null or Closed"; logger.Warn("GetInteractionList() : Universal Contact Server protocol is Null.."); } } catch (Exception generalException) { logger.Error("Error Occurred while Get Interaction for Agent request" + generalException.ToString()); output.IContactMessage = null; output.MessageCode = "2001"; output.Message = generalException.Message; } return(output); }
public static OutputValues GetInteractionList(string ownerID, int tenantId, List <string> attributesNames) { Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); OutputValues output = new OutputValues(); try { RequestInteractionListGet requestGetInteractionList = RequestInteractionListGet.Create(); //Inputs //DataSource requestGetInteractionList.DataSource = new NullableDataSourceType(DataSourceType.Main); requestGetInteractionList.SortCriteria = new SortCriteriaCollection(); SortCriteriaCollection sortCC = new SortCriteriaCollection(); SortCriteria sortc = new SortCriteria() { AttrName = InteractionSearchCriteriaConstants.StartDate, SortOperator = new NullableSortMode(SortMode.Descending), SortIndex = 0 }; sortCC.Add(sortc); requestGetInteractionList.SortCriteria = sortCC; SimpleSearchCriteria sSC3 = new SimpleSearchCriteria() { AttrName = InteractionSearchCriteriaConstants.OwnerId, AttrValue = ownerID, Operator = new NullableOperators(Operators.Equal) }; //SimpleSearchCriteria sSC4 = new SimpleSearchCriteria() { AttrName = InteractionSearchCriteriaConstants.MediaTypeId, AttrValue = "voice", Operator = new NullableOperators(Operators.Equal) }; SearchCriteriaCollection srchCrit = new SearchCriteriaCollection(); srchCrit.Add(sSC3); requestGetInteractionList.SearchCriteria = srchCrit; StringList stringList = new StringList(); if (attributesNames.Count > 0) { foreach (string attribute in attributesNames) { stringList.Add(attribute); } } stringList.Add(InteractionSearchCriteriaConstants.MediaTypeId); stringList.Add(InteractionSearchCriteriaConstants.Id); stringList.Add(InteractionSearchCriteriaConstants.SubtypeId); requestGetInteractionList.AttributeList = stringList; requestGetInteractionList.TenantId = tenantId; if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened) { logger.Info("------------RequestGetInteractionList-------------"); logger.Info("OwnerID :" + ownerID); logger.Info("TenantId :" + tenantId); logger.Info("--------------------------------------------------"); IMessage message = Settings.UCSProtocol.Request(requestGetInteractionList); if (message != null) { logger.Trace(message.ToString()); output.IContactMessage = message; output.MessageCode = "200"; output.Message = "Getting Interactions For Agent Successful"; } else { output.IContactMessage = null; output.MessageCode = "2001"; output.Message = "Getting Interactions For Agent UnSuccessful"; } } else { output.IContactMessage = null; output.MessageCode = "2001"; output.Message = "Universal Contact Server protocol is Null or Closed"; logger.Warn("GetInteractionList() : Universal Contact Server protocol is Null.."); } } catch (Exception generalException) { logger.Error("Error Occurred while Get Interaction for Agent request" + generalException.ToString()); output.IContactMessage = null; output.MessageCode = "2001"; output.Message = generalException.Message; } return(output); }