/// <summary> /// 估计这就是传说中的推荐系统的click事件,并将结果记录到UserEvaluation文件里 /// CompletelyRandom = 0,//完全随机推荐 0 ///BehaviorScores,//行为得分推荐 1 ///BehaviorChange//行为变化推荐 2 /// </summary> /// <param name="category"></param>//category分为 CompleteRandom、BehaviorScores和BehaviorChange /// <param name="iSugg"></param> iSugg是建议的id /// <param name="iScore"></param>iScore是用户选中的那一个 public void clicked(RecommendedCategory category, int iSugg, int iScore) { this.Hide(); if (this.Parent != null) { this.Parent.m_emotionTracking.Show(); } SaveUserEvaluationHistory(category, iSugg, iScore); }
/// <summary> /// 估计这就是传说中的推荐系统的click事件,并将结果记录到UserEvaluation文件里 /// CompletelyRandom = 0,//完全随机推荐 0 ///BehaviorScores,//行为得分推荐 1 ///BehaviorChange//行为变化推荐 2 /// </summary> /// <param name="category"></param>//category分为 CompleteRandom、BehaviorScores和BehaviorChange /// <param name="iSugg"></param> iSugg是建议的id /// <param name="iScore"></param>iScore是用户选中的那一个 public void clicked(RecommendedCategory category, int iSugg, int iScore) { this.Hide(); if (this.Parent != null) { this.Parent.m_emotionTracking.Show(); } SaveUserEvaluationHistory(category,iSugg, iScore); }
private string GetEmotionSuggestionByID(RecommendedCategory category, int iID) { string strSuggestion = string.Empty; XmlDocument xmlDoc = new XmlDocument(); string strFileName = "SuggestionsRandom.xml"; xmlDoc.Load(strFileName); XmlElement root = xmlDoc.DocumentElement; // XmlNodeList nlist = root.SelectNodes("Record"); //获取根节点的所有子节点 foreach (XmlNode node in nlist) { if (int.Parse(node.Attributes["ID"].InnerText.ToString()) == iID) { strSuggestion = node.InnerText.ToString(); } } this.iSuggestionID = iID; // this.enumCategory = category; // return(strSuggestion); }
private void SaveUserEvaluationHistory(RecommendedCategory category, int iSuggestion, int iScore) { string strFilePath = "UserEvaluation"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(strFilePath); XmlNode root = xmlDoc.SelectSingleNode("Evaluations"); XmlNode node = xmlDoc.CreateElement("Record"); XmlAttribute timeNode = xmlDoc.CreateAttribute("Time"); timeNode.Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); node.Attributes.Append(timeNode); XmlNode categoryNode = xmlDoc.CreateElement("Category"); categoryNode.AppendChild(xmlDoc.CreateTextNode(((int)category).ToString())); XmlNode suggestion = xmlDoc.CreateElement("Suggestion"); suggestion.AppendChild(xmlDoc.CreateTextNode(iSuggestion.ToString())); XmlNode score = xmlDoc.CreateElement("Scoring"); score.AppendChild(xmlDoc.CreateTextNode(iScore.ToString())); node.AppendChild(categoryNode); node.AppendChild(suggestion); node.AppendChild(score); //root.AppendChild(node); //我想后进来的在上面显示 XmlNode firstNode = root.FirstChild; root.InsertBefore(node, firstNode); xmlDoc.Save(strFilePath); }
private void SaveUserEvaluationHistory(RecommendedCategory category, int iSuggestion, int iScore) { string strFilePath = "UserEvaluation"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(strFilePath); XmlNode root = xmlDoc.SelectSingleNode("Evaluations"); XmlNode node = xmlDoc.CreateElement("Record"); XmlAttribute timeNode = xmlDoc.CreateAttribute("Time"); timeNode.Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); node.Attributes.Append(timeNode); XmlNode categoryNode = xmlDoc.CreateElement("Category"); categoryNode.AppendChild(xmlDoc.CreateTextNode(((int)category).ToString())); XmlNode suggestion = xmlDoc.CreateElement("Suggestion"); suggestion.AppendChild(xmlDoc.CreateTextNode(iSuggestion.ToString())); XmlNode score = xmlDoc.CreateElement("Scoring"); score.AppendChild(xmlDoc.CreateTextNode(iScore.ToString())); node.AppendChild(categoryNode); node.AppendChild(suggestion); node.AppendChild(score); //root.AppendChild(node); //我想后进来的在上面显示 XmlNode firstNode=root.FirstChild; root.InsertBefore(node, firstNode); xmlDoc.Save(strFilePath); }
private string GetEmotionSuggestionByID(RecommendedCategory category, int iID) { string strSuggestion = string.Empty; XmlDocument xmlDoc = new XmlDocument(); string strFileName = "SuggestionsRandom.xml"; xmlDoc.Load(strFileName); XmlElement root = xmlDoc.DocumentElement;// XmlNodeList nlist = root.SelectNodes("Record");//获取根节点的所有子节点 foreach (XmlNode node in nlist) { if (int.Parse(node.Attributes["ID"].InnerText.ToString()) == iID) { strSuggestion = node.InnerText.ToString(); } } this.iSuggestionID = iID;// this.enumCategory = category;// return strSuggestion; }