/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void AddSynonym(object sender, AddTermSynonymEventArgs <string> e) { var objTerm = Terms.CreateAndReturnTerm(e.TermName, VocabularyId); var portalSynonyms = Controller.GetTermSynonyms(ModuleContext.PortalId); var colMaster = (from t in portalSynonyms where t.MasterTermId == objTerm.TermId select t).ToList(); var colRelated = (from t in portalSynonyms where t.RelatedTermId == objTerm.TermId select t).ToList(); View.Model.ErrorMessage = ""; if (colMaster.Count > 0) { View.Model.ErrorMessage = "AlreadyMaster"; return; } if (colRelated.Count > 0) { var colSameTerm = (from t in portalSynonyms where ((t.MasterTermId == View.Model.SelectedTerm.TermId) && (t.RelatedTermId == objTerm.TermId)) select t).ToList(); View.Model.ErrorMessage = colSameTerm.Count > 0 ? "SameRelationSuggested" : "AlreadyRelated"; return; } var objSynonym = new TermSynonymInfo { MasterTermId = View.Model.SelectedTerm.TermId, RelatedTermId = objTerm.TermId, PortalId = ModuleContext.PortalId, CreatedByUserId = ModuleContext.PortalSettings.UserId, CreatedOnDate = DateTime.Now }; Controller.AddTermSynonym(objSynonym); var updatedPortalSynonyms = Controller.GetTermSynonyms(ModuleContext.PortalId); var objTermApprove = ThresholdCollection.Single(s => s.Key == Constants.OpThresholds.TermSynonymApproveCount.ToString()); var objTermReject = ThresholdCollection.Single(s => s.Key == Constants.OpThresholds.TermSynonymRejectCount.ToString()); View.Model.SuggestedTermSynonyms = (from t in updatedPortalSynonyms where ((t.MasterTermId == View.Model.SelectedTerm.TermId) && ((t.Score < objTermApprove.Value) && (t.Score > -objTermReject.Value))) select t).ToList(); View.ShowSuggestedSynonyms(true); View.ShowActiveSynonyms(View.Model.ActiveTermSynonyms.Count > 0); View.ShowAddSynonym(true); }
public TermSynonymInfo AddTermSynonym(TermSynonymInfo objSynonym) { //DotNetNuke.Common.Requires.PropertyNotNegative("MasterTermId", "", MasterTermId); //DotNetNuke.Common.Requires.PropertyNotNegative("RelatedTermId", "", RelatedTermId); //DotNetNuke.Common.Requires.PropertyNotNegative("portalId", "", portalId); //DotNetNuke.Common.Requires.PropertyNotNegative("CreatedByUserId", "", CreatedByUserId); objSynonym.TermSynonymId = _dataProvider.AddTermSynonym(objSynonym.MasterTermId, objSynonym.RelatedTermId, objSynonym.PortalId, objSynonym.CreatedByUserId, objSynonym.CreatedOnDate); objSynonym.Score = 0; objSynonym.ChangedCount = 0; DataCache.RemoveCache(Constants.ModuleCacheKey + Constants.TermSynonymsCacheKey + objSynonym.PortalId); return(objSynonym); }
public void AddTermSynonym(TermSynonymInfo objSynonym) { throw new NotImplementedException(); }