/// <summary> /// Parse the result from the answer of question answer activity. /// </summary> /// <returns></returns> public void ParseResult_Execute(object sender, EventArgs e) { AgentSkill agentSkill = null; if (!_currentSkill.IsValidValue(this.Result)) { int index = int.Parse(Result) - 1; //the recognition match must be an index rather than the value itself. agentSkill = new AgentSkill(_currentSkill, _currentSkill.Values[index]); RequiredSkills.Add(agentSkill); } else if (this._currentSkill.IsValidValue(this.Result)) { //the value itself was recognized. agentSkill = new AgentSkill(_currentSkill, this.Result); RequiredSkills.Add(agentSkill); } }
public void Remove(AgentSkill entity) { throw new NotImplementedException(); }
/// <summary> /// Gets product type from product id. /// </summary> /// <param name="productId">Product id.</param> /// <returns>productType. Can be null.</returns> private productType GetProductTypeFromProductId(string productId) { Product dbProduct = null; string connectionString = m_connectionString; List <AgentSkill> agentSkills = null; productType retVal = null; if (!String.IsNullOrEmpty(productId) && !String.IsNullOrEmpty(connectionString)) { using (ProductStore dataStore = new ProductStore(SqlHelper.Current.GetConnection(connectionString))) { try { dbProduct = dataStore.Product.SingleOrDefault(p => p.Id.ToString().Equals(productId)); if (dbProduct != null) { //If we have product info. Query for agent skills associated with this product. var allAgentSkillMappings = from a in dataStore.AgentSkillMapping where a.ProductId == dbProduct.Id select a; agentSkills = new List <AgentSkill>(); foreach (var agentSkillMapping in allAgentSkillMappings) { if (agentSkillMapping.AgentSkillId.HasValue) { AgentSkill agentSkill = dataStore.AgentSkill.SingleOrDefault(ask => ask.Id.ToString().Equals(agentSkillMapping.AgentSkillId)); if (agentSkill != null) { agentSkills.Add(agentSkill); } } } } } catch (SqlException sqlException) { Helper.Logger.Error("Sql exception occured {0}", EventLogger.ToString(sqlException)); } } // end of data store. } if (dbProduct != null) { retVal = new productType(); retVal.productGuid = dbProduct.Id.ToString(); retVal.productImage = dbProduct.Image; retVal.productPrice = dbProduct.Price.ToString(); retVal.productTitle = dbProduct.Title; if (agentSkills != null && agentSkills.Count > 0) { retVal.agentSkillsList = new agentSkillType[agentSkills.Count]; for (int i = 0; i < agentSkills.Count; i++) { agentSkillType agentSkillType = new agentSkillType(); agentSkillType.name = agentSkills[i].SkillName; agentSkillType.Value = agentSkills[i].SkillValue; retVal.agentSkillsList[i] = agentSkillType; } } } return(retVal); }