Exemplo n.º 1
0
    private string SearchRecordingActPartiesCommandHandler() {
      int recordingActId = int.Parse(GetCommandParameter("recordingActId", true));
      int partyTypeId = int.Parse(GetCommandParameter("partyTypeId", false, "0"));
      string partyFilter = GetCommandParameter("filterType", true);
      string keywords = GetCommandParameter("keywords", false, String.Empty);


      RecordingAct recordingAct = RecordingAct.Parse(recordingActId);
      PartyFilterType partyFilterType = (PartyFilterType) System.Enum.Parse(typeof(PartyFilterType), partyFilter);

      ObjectTypeInfo partyTypeInfo = null;
      if (partyTypeId != 0) {
        partyTypeInfo = ObjectTypeInfo.Parse(partyTypeId);
      }
      ObjectList<Party> list = Party.GetList(partyFilterType, partyTypeInfo, recordingAct, keywords);

      string html = String.Empty;

      if (partyTypeInfo != null) {
        html = HtmlSelectContent.GetComboAjaxHtmlItem(String.Empty, HtmlSelectContent.GetSearchResultHeaderText(partyTypeInfo, list.Count));
      } else {
        html = HtmlSelectContent.GetComboAjaxHtmlItem(String.Empty, "( " + list.Count.ToString("N0") + " personas u organizaciones encontradas )");
      }
      if (list.Count == 0) {
        if (partyTypeInfo != null && !partyTypeInfo.IsAbstract) {
          html += "|" + HtmlSelectContent.GetComboAjaxHtmlItem("appendParty", "( Agregar " + (partyTypeInfo.FemaleGenre ? "una nueva " : "un nuevo ") +
                                                                                       partyTypeInfo.DisplayName + " )");
        }
      } else {
        if (partyTypeInfo != null && !partyTypeInfo.IsAbstract) {
          html += "|" + HtmlSelectContent.GetComboAjaxHtmlItem("appendParty", "( Agregar " + (partyTypeInfo.FemaleGenre ? "una nueva " : "un nuevo ") +
                                                                                          partyTypeInfo.DisplayName + " )");
        }
        html += "|" + HtmlSelectContent.GetComboAjaxHtml(list, 0, "Id", "ExtendedName", String.Empty);
      }
      return html;
    }