public static void StoreRelevantWord(RelevantWordDTO relevantWord) { using (SqlConnection cnn = WordDAC.NewConnection) using (SqlCommand cmd = cnn.CreateCommand()) { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[word_pkg.store_relevant_word]"; SqlParameter idParam = cmd.Parameters.Add("id", SqlDbType.Int); idParam.Value = (relevantWord.ID.HasValue) ? (object)relevantWord.ID.Value : DBNull.Value; idParam.Direction = ParameterDirection.InputOutput; cmd.Parameters.AddWithValue("word", relevantWord.Word.Trim()); cmd.Parameters.AddWithValue("weight", relevantWord.Weight); cmd.Parameters.AddWithValue("information_type_id", relevantWord.InformationTypeID); cmd.Parameters.AddWithValue("creation_type", relevantWord.CreationType.ToString()); cnn.Open(); cmd.ExecuteNonQuery(); } }
public ActionResult BlockWord(Int32 id) { Nullable <Int32> informationTypeID = InformationTypeDAC.GetInformationTypeIDByWordID(id); RelevantWordDTO relevantWord = WordDAC.GetRelevantWord(id); if (relevantWord != null) { relevantWord.Weight = 0; relevantWord.CreationType = RelevantWordDTO.CreationTypeEnum.MANUAL; WordDAC.StoreRelevantWord(relevantWord); } if (informationTypeID.HasValue) { return(Details(informationTypeID.Value)); } else { return(View("Index")); } }
public ActionResult IgnoreWord(Int32 id) { Nullable <Int32> informationTypeID = InformationTypeDAC.GetInformationTypeIDByWordID(id); RelevantWordDTO relevantWord = WordDAC.GetRelevantWord(id); if (relevantWord != null) { WordDAC.StoreIrrelevantWord(relevantWord.Word, ContextManager.Current.SelectedAreaID.Value); } WordDAC.DeleteRelevantWord(id); if (informationTypeID.HasValue) { return(Details(informationTypeID.Value)); } else { return(View("Index")); } }
public ActionResult Details(Int32 id) { List <RelevantWordDTO> relevantWords = WordDAC.GetRelevantWords(id); RelevantWordDTO relevantWordDTO = new RelevantWordDTO(); relevantWordDTO.InformationTypeID = id; relevantWordDTO.Weight = 1; relevantWordDTO.Word = ""; relevantWords.Add(relevantWordDTO); List <RelevantWordDTO> automaticallyWeightedWords = relevantWords.FindAll(rw => rw.CreationType == RelevantWordDTO.CreationTypeEnum.AUTOMATIC).FindAll(rw => rw.Weight > 0); List <RelevantWordDTO> manuallyWeightedWords = relevantWords.FindAll(rw => rw.CreationType == RelevantWordDTO.CreationTypeEnum.MANUAL).FindAll(rw => rw.Weight > 0); List <RelevantWordDTO> blockedWords = relevantWords.FindAll(rw => rw.Weight == 0); return(View("Details", new MessageDetailsModel { InformationType = InformationTypeDAC.GetInformationType(id, ContextManager.Current.SelectedAreaID.Value), AutomaticallyWeightedWords = automaticallyWeightedWords, ManuallyWeightedWords = manuallyWeightedWords, BlockedWords = blockedWords })); }