Пример #1
0
    public void DeleteRelation(int relationID)
    {
        BLORelation r;

        r = BLORelation.Edit(relationID);
        r.Delete();
    }
Пример #2
0
    public void EditRelation(int relationID, string relationName)
    {
        BLORelation r;

        r      = BLORelation.Edit(relationID);
        r.Name = relationName;
        r.Submit();
    }
Пример #3
0
    public string GetRelationWords(int relationID)
    {
        StringBuilder sb;
        BLORelation   r;

        sb = new StringBuilder();
        r  = BLORelation.Edit(relationID);
        sb.Append("<RelationWords>\r\n");
        foreach (BLORelation.WordsPair wordsPair in r.WordsPairs)
        {
            sb.Append(" <WordsPair>\r\n");
            sb.AppendFormat("  <Word1>{0}</Word1>\r\n", wordsPair.Word1);
            sb.AppendFormat("  <Word2>{0}</Word2>\r\n", wordsPair.Word2);
            sb.Append(" </WordsPair>\r\n");
        }
        sb.Append("</RelationWords>");
        return(sb.ToString());
    }
Пример #4
0
    public void SetRelationWords(int relationID, string value)
    {
        StringBuilder sb;
        BLORelation   r;

        string[] parts;

        sb = new StringBuilder();
        r  = BLORelation.Edit(relationID);
        r.WordsPairs.Clear();
        foreach (string s in value.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
        {
            parts = s.Split(new string[] { "+" }, StringSplitOptions.RemoveEmptyEntries);
            if (parts.Length == 2)
            {
                r.WordsPairs.Add(new BLORelation.WordsPair(parts[0], parts[1]));
            }
        }
        r.Submit();
    }
Пример #5
0
    public string GetRelationPairedWords(int relationID, string word)
    {
        StringBuilder sb;
        BLORelation   r;

        sb = new StringBuilder();
        r  = BLORelation.Edit(relationID);
        sb.Append("<PairedWords>\r\n");
        foreach (BLORelation.WordsPair wordsPair in r.WordsPairs)
        {
            if (wordsPair.Word1 == word)
            {
                sb.AppendFormat(" <Word>{0}</Word>\r\n", wordsPair.Word2);
            }
            if (wordsPair.Word2 == word)
            {
                sb.AppendFormat(" <Word>{0}</Word>\r\n", wordsPair.Word1);
            }
        }
        sb.Append("</PairedWords>");
        return(sb.ToString());
    }