private string GetSettlementsStringArrayCommandHandler() { int municipalityId = int.Parse(GetCommandParameter("municipalityId", false, "0")); int settlementTypeId = int.Parse(GetCommandParameter("settlementTypeId", false, "310")); if (municipalityId == 0) { return HtmlSelectContent.GetComboAjaxHtmlItem(String.Empty, "( Primero seleccionar un municipio )"); } if (municipalityId < 0) { return HtmlSelectContent.GetComboAjaxHtmlItem("-2", GeographicPathItem.Unknown.Name); } GeographicRegionItem municipality = GeographicRegionItem.Parse(municipalityId); GeographicItemType settlementType = GeographicItemType.Parse(settlementTypeId); ObjectList<GeographicRegionItem> list = new ObjectList<GeographicRegionItem>(); list = municipality.GetRegions("Municipality_Settlements", settlementType); if (list.Count != 0) { string header = "( Seleccionar" + (settlementType.FemaleGenre ? " una " : " un ") + settlementType.DisplayName.ToLowerInvariant() + " )"; Func<GeographicRegionItem, string> textFunction = (x) => x.Name + " (" + x.ObjectTypeInfo.DisplayName + ")"; return HtmlSelectContent.GetComboAjaxHtml(list, "Id", textFunction, header, String.Empty, GeographicRegionItem.Unknown.Name); } else { string header = "( No hay " + settlementType.DisplayPluralName.ToLowerInvariant() + (settlementType.FemaleGenre ? " definidas )" : " definidos )"); return HtmlSelectContent.GetComboAjaxHtml(header, String.Empty, GeographicRegionItem.Unknown.Name); } }
private string GetPostalCodesStringArrayCommandHandler() { int municipalityId = int.Parse(GetCommandParameter("municipalityId", false, "0")); int settlementId = int.Parse(GetCommandParameter("settlementId", false, "-1")); string items = String.Empty; if (municipalityId == 0) { return HtmlSelectContent.GetComboAjaxHtmlItem(String.Empty, "Municipio?"); } if (settlementId <= 0) { return HtmlSelectContent.GetComboAjaxHtmlItem("-2", GeographicRegionItem.Unknown.Name); } GeographicRegionItem municipality = GeographicRegionItem.Parse(municipalityId); GeographicRegionItem settlement = GeographicRegionItem.Parse(settlementId); ObjectList<GeographicRegionItem> list = null; if (settlement.IsEmptyInstance) { list = municipality.GetRegions("Municipality_PostalCodes"); } else { list = settlement.GetRegions("Settlement_PostalCodes"); } if (list.Count != 0) { return HtmlSelectContent.GetComboAjaxHtml(list, 0, "Id", "Name", "( ? )", String.Empty, GeographicRegionItem.Unknown.Name); } else { return HtmlSelectContent.GetComboAjaxHtml("( No def ) ", String.Empty, GeographicRegionItem.Unknown.Name); } }