Ejemplo n.º 1
0
    public string PrintNotifieds(Connection conn, List <TLinkWind> pLinks, string sidesep, string invlsep, char nbsp)
    {
        List <TLinkWind> links = new List <TLinkWind>(pLinks);
        StringBuilder    sb    = new StringBuilder();

        if (links.Count == 0)
        {
            links.Add(this);
        }

        for (;;)
        {
            List <TLinkWind> tLinks   = new List <TLinkWind>();
            TLinkWind        linkWind = links[0];

            tLinks.Add(linkWind);
            links.RemoveAt(0);

            int index = 0;

            while (index < links.Count)
            {
                TLinkWind tLinkWind = links[index];

                if (tLinkWind.SameLinkage(linkWind))
                {
                    tLinks.Add(tLinkWind);
                    links.RemoveAt(index);
                }
                else
                {
                    index++;
                }
            }

            sb.Append("До ");
            sb.Append(linkWind.PrintSideLinks(conn, false, true, tLinks, nbsp));

            if (linkWind.Proxied() && linkWind.proxyKind == TProxyKind.AsWithInvolvement)
            {
                sb.Append("");  // involvements already shown, skip lead involvement
            }
            else
            {
                sb.AppendFormat("{0}като {1}", invlsep, TInvolvement.Seek(linkWind.involvement).name);
            }

            if (links.Count > 0)
            {
                sb.Append(sidesep);
            }
            else
            {
                break;
            }
        }

        return(sb.ToString());
    }
Ejemplo n.º 2
0
    public string PrintSideLinks(Connection conn, bool newLines, bool ordinaryName, List <TLinkWind> linkWinds, char nbsp)
    {
        TLinkWind        linkWind = this;
        StringBuilder    sb       = new StringBuilder();
        List <TLinkWind> tLinkWinds;

        if (linkWinds == null)
        {
            tLinkWinds = new List <TLinkWind>();
            tLinkWinds.Add(linkWind);
            linkWinds = tLinkWinds;
        }

        if (ordinaryName)
        {
            bool first = true;

            foreach (TLinkWind tLinkWind in linkWinds)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    sb.Append(", ");
                }

                sb.Append(tLinkWind.PrintNames(conn));
            }
        }

        if (linkWind.Proxied())
        {
            TSideWind proxy    = new TSideWind();
            TSideWind redirect = new TSideWind();
            string    proxyNames;
            string    proxyInvolvement;
            bool      redirectSeparator = false;

            linkWind.GetProxy(proxy);
            proxyNames       = proxy.PrintNames(conn);
            proxyInvolvement = TInvolvement.Seek(linkWind.proxyInvolvement).name;

            if (TInvolvement.LegalSpeakers.IndexOf(proxy.involvement) != -1 ||
                linkWind.proxyKind == TProxyKind.AsWithInvolvement)
            {
                switch (linkWind.proxyKind)
                {
                case TProxyKind.IndirectAsAny1:
                {
                    if (!newLines)
                    {
                        sb.Append(",");
                    }

                    sb.AppendFormat("\nпредставляван{0} от {1}\n{2}", linkWinds.Count == 1 ? "(а)" : "и",
                                    proxyInvolvement, proxyNames);
                    break;
                }

                case TProxyKind.IndirectAsAny2:
                {
                    sb.AppendFormat("\nчрез {0}\n{1}", proxyInvolvement, proxyNames);
                    break;
                }

                case TProxyKind.IndirectAsAny3:
                {
                    sb.AppendFormat("\nсъс съгласието на {0}\n{1}", proxyInvolvement, proxyNames);
                    break;
                }

                case TProxyKind.ConsentOfIndirect:
                {
                    sb.AppendFormat("{0}\nсъс съгласието на\n{1} като {2}", nbsp, proxyNames, proxyInvolvement);
                    redirectSeparator = true;
                    break;
                }

                default:
                {
                    string prefix = String.Format("{0}\nкато {1} на{2}\n", proxyNames, proxyInvolvement, nbsp);

                    sb.Insert(0, prefix, 1);
                    redirectSeparator = true;
                    break;
                }
                }
            }
            else if (proxy.involvement == TInvolvement.Parent)  // can't happen, Parent is LegalSpeaker
            {
                sb.AppendFormat("\nсъс съгласието на {0}{1}\n{2}", proxyInvolvement, nbsp, proxyNames);
                redirectSeparator = true;
            }
            else
            {
                sb.AppendFormat("{0}\nчрез {1}\n{2}", nbsp, proxyInvolvement, proxyNames);
                redirectSeparator = true;
            }

            if (linkWind.Redirected())
            {
                if (redirectSeparator)
                {
                    sb.Append(nbsp);
                }
                linkWind.GetRedirect(redirect);
                sb.AppendFormat("\nчрез {0} ", TInvolvement.Seek(redirect.involvement).name);
                sb.Append(redirect.PrintNames(conn));
            }
        }

        if (newLines)
        {
            sb.Append("\n");
        }
        else
        {
            sb.Replace('\n', ' ');
        }

        string result = sb.ToString();

        if (!ordinaryName && result[0] == nbsp)
        {
            result = result.Substring(1).TrimStart();
        }

        return(result);
    }