public override bool Equals(object obj) { AgentSkill agentSkill = obj as AgentSkill; if (agentSkill == null) { return(false); } return(this.Skill.Equals(agentSkill.Skill) && string.Equals(this.Value, agentSkill.Value, StringComparison.OrdinalIgnoreCase)); }
private IEnumerable <AgentSkill> ProcessMimeParts(IEnumerable <MimePartContentDescription> contextualData, out productType productInformation) { List <AgentSkill> listOfRequestedSkills = new List <AgentSkill>(); List <MimePartContentDescription> listOfMimeParts = new List <MimePartContentDescription>(contextualData); productType product = null; _logger.Log(String.Format("Processing MIME parts {0}", listOfMimeParts.Count)); bool success = true; listOfMimeParts.ForEach(mp => { if (mp.ContentType.Equals(new ContentType("application/octet-stream"))) { try { //Now deserialize and make sure we have right data. XmlSerializer serializer = new XmlSerializer(typeof(productType)); product = SerializerHelper.DeserializeObjectFragment(mp.GetBody(), serializer) as productType; if (product != null && product.agentSkillsList != null && product.agentSkillsList.Length > 0) { List <agentSkillType> list = new List <agentSkillType>(product.agentSkillsList); list.ForEach(sk => { _logger.Log(String.Format("Finding skill name {0}", sk.name)); Skill skillFound = Skill.FindSkill(sk.name, _matchMaker.Configuration.Skills); if (null != skillFound) { if (!String.IsNullOrEmpty(sk.Value)) { try { AgentSkill agentSkill = new AgentSkill(skillFound, sk.Value); listOfRequestedSkills.Add(agentSkill); _logger.Log(String.Format("Adding agent skill {0} value = {1}", skillFound, sk.Value)); } catch (ArgumentException aex) { _logger.Log(String.Format("AcdPortal detected a skill value that is not provisioned {0}", sk.Value), aex); } } } else { _logger.Log(String.Format("Skill name {0}. Not found", sk.name)); } }); } else { _logger.Log("Product is null or agentSkillsList is empty"); } } catch (XmlException xex) { _logger.Log("AcdPortal detected a derialization isssue", xex); success = false; } } else { _logger.Log("Invalid content type"); } }); productInformation = product; if (success) { return(listOfRequestedSkills); } else { return(new List <AgentSkill>()); } }
/// <summary> /// Determines if an agent has a particular skill. /// </summary> /// <param name="skill">The skill in question.</param> /// <returns>True if the agent has the skilil.</returns> internal bool HasSkill(AgentSkill skill) { return(this.Skills.Contains(skill)); }