public virtual void ThesaurusRelationDelete(ThesaurusRelation entity) { TraceCallEnterEvent.Raise(); try { m_DataContext.BeginNestedTran(); try { m_DataContext.ndihdThesaurusRelationDelete(entity.ID); m_DataContext.CommitNested(); } catch { m_DataContext.RollbackNested(); throw; } TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public virtual void ThesaurusRelationUpdate(ThesaurusRelation entity) { TraceCallEnterEvent.Raise(); try { m_DataContext.BeginNestedTran(); try { int count; m_DataContext.ndihdThesaurusRelationUpdate(entity.ID, entity.KeywordRef, entity.RelationType, entity.RelatedWord, out count); if (count == 0) throw new ServiceUpdateException(); m_DataContext.CommitNested(); } catch { m_DataContext.RollbackNested(); throw; } TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public virtual ThesaurusRelation ThesaurusRelationSelect(DBGuid IDVal) { TraceCallEnterEvent.Raise(); try { ThesaurusRelation result = null; DataSet entitySet = m_DataContext.ndihdThesaurusRelationSelect(IDVal); if (entitySet.Tables[0].Rows.Count != 0) { result = new ThesaurusRelation(entitySet); } TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
// ------------------------------------------------------------------------------------- /// <summary> /// Copy constructor. /// </summary> /// <param name="origInstance">Original document data to copy.</param> // ------------------------------------------------------------------------------------- public ThesaurusRelation(ThesaurusRelation origInstance) : base(origInstance) { }
// ------------------------------------------------------------------------------------- /// <summary> /// Copy constructor. /// </summary> /// <param name="IDVal">Value of 'uID' field</param> /// <param name="origInstance">Original document data to copy.</param> // ------------------------------------------------------------------------------------- public ThesaurusRelation(DBGuid IDVal, ThesaurusRelation origInstance) : base(IDVal, origInstance) { }
/// <summary> /// Add a ThesasurusRelation to the list. /// </summary> private void AddRelation() { // Validate controls if (cmbRelationType.SelectedIndex < 1) { MessageBox.Show("A kapcsolat típusa nincs megadva. Válassza ki a kapcsolat típusát!", "NDI HelpDesk Adminisztrátor", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbRelationType.Select(); return; } if (txtRelatedWord.Text.Length == 0) { MessageBox.Show("A kapcsolódó szó nincs megadva. Adja meg a kapcsolódó szót a beviteli mezõben!", "NDI HelpDesk Adminisztrátor", MessageBoxButtons.OK, MessageBoxIcon.Information); txtRelatedWord.Select(); return; } try { // Logical checks string RelationType = cmbRelationType.SelectedValue.ToString(); string RelatedWord = txtRelatedWord.Text; if (RelationType == ThesaurusRelationType.Synonym) { // Több db szó lehet, nem lehet létezõ vezérszó IThesaurusService thesSrv = ServiceFactory.GetThesaurusService(); Thesaurus thes = thesSrv.ThesaurusSelect(RelatedWord); if (thes != null) { MessageBox.Show("A szinonima már létezõ vezérszó. Adjon meg másik szinonimát a beviteli mezõben!", "NDI HelpDesk Adminisztrátor", MessageBoxButtons.OK, MessageBoxIcon.Information); txtRelatedWord.Select(); return; } } else if ((RelationType == ThesaurusRelationType.Parent) || (RelationType == ThesaurusRelationType.See)) { // 1 db már létezõ vezérszó lehet // Check relation type existance in container bool bExist = false; for (int i = 0; i < m_data.Current.Count; i++) { DBString CurrentRelationType = ((ThesaurusRelation) m_data.Current.Items[i]).RelationType; if (CurrentRelationType.CompareTo(RelationType) == 0) { bExist = true; break; } } if (bExist) { MessageBox.Show("Már létezik a megadott típussal kapcsolódó szó. Csak egy adható meg.", "NDI HelpDesk Adminisztrátor", MessageBoxButtons.OK, MessageBoxIcon.Information); txtRelatedWord.Select(); return; } // Check existance between keywors IThesaurusService thesSrv = ServiceFactory.GetThesaurusService(); Thesaurus thes = thesSrv.ThesaurusSelect(RelatedWord); if (thes == null) { MessageBox.Show("A kapcsolódó szó nem vezérszó. Adjon meg már létezõ vezérszót a beviteli mezõben!", "NDI HelpDesk Adminisztrátor", MessageBoxButtons.OK, MessageBoxIcon.Information); txtRelatedWord.Select(); return; } } else if (RelationType == ThesaurusRelationType.Also) { // Több db már létezõ vezérszó lehet IThesaurusService thesSrv = ServiceFactory.GetThesaurusService(); Thesaurus thes = thesSrv.ThesaurusSelect(RelatedWord); if (thes == null) { MessageBox.Show("A kapcsolódó szó nem vezérszó. Adjon meg már létezõ vezérszót a beviteli mezõben!", "NDI HelpDesk Adminisztrátor", MessageBoxButtons.OK, MessageBoxIcon.Information); txtRelatedWord.Select(); return; } } // Add to container ThesaurusRelation item = new ThesaurusRelation(new DBGuid(Guid.NewGuid())); item.RelationType = RelationType; item.RelationTypeName = ThesaurusRelationType.GetNameById(RelationType); item.RelatedWord = RelatedWord; item.KeywordRef = txtKeyword.Text; m_data.Add(item); // Refresh grid FillDatagrid(txtKeyword.Text); cmbRelationType.SelectedIndex = -1; txtRelatedWord.Text = ""; } catch (Exception ex) { // --- Log exception ExceptionManager.Publish(ex); // --- Display Exception ErrorHandler.DisplayError("Nem várt hiba lépett fel a kapcsolódó szó hozzáadása során.", ex); } }