private void ExecuteEscalateToExpert(object param) { try { List <agentSkillType> agentSkills = new List <agentSkillType>(); foreach (SkillViewModel svm in _skills) { if (svm.HasSelectedTopic) { agentSkillType agentSkill = new agentSkillType(); agentSkill.name = svm.Category; agentSkill.Value = svm.SelectedTopic.DisplayName; agentSkills.Add(agentSkill); } } if (agentSkills.Count > 0) { Model.BeginEscalate(agentSkills, ar => { try { Model.EndEscalate(ar); } catch (Exception) { } }, null); } } catch (Exception) { } }
/// <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); }