private string GetStreetRoadsStringArrayCommandHandler() { int municipalityId = int.Parse(GetCommandParameter("municipalityId", false, "0")); int settlementId = int.Parse(GetCommandParameter("settlementId", false, "-1")); int streetRoadTypeId = int.Parse(GetCommandParameter("pathTypeId", false, "305")); if (municipalityId == 0) { return HtmlSelectContent.GetComboAjaxHtmlItem(String.Empty, "( Primero seleccionar un municipio )"); } if (settlementId <= 0) { return HtmlSelectContent.GetComboAjaxHtmlItem("-2", GeographicPathItem.Unknown.Name); } GeographicRegionItem municipality = GeographicRegionItem.Parse(municipalityId); GeographicRegionItem settlement = GeographicRegionItem.Parse(settlementId); GeographicItemType pathType = GeographicItemType.Parse(streetRoadTypeId); ObjectList<GeographicPathItem> list = null; if (settlement.IsEmptyInstance) { list = municipality.GetPaths("Municipality_Paths", pathType); } else { list = settlement.GetPaths("Settlement_Paths", pathType); } if (list.Count != 0) { string header = "( Seleccionar" + (pathType.FemaleGenre ? " una " : " un ") + pathType.DisplayName.ToLowerInvariant() + " )"; Func<GeographicPathItem, string> textFunction = (x) => x.Name + " (" + x.ObjectTypeInfo.DisplayName + ")"; return HtmlSelectContent.GetComboAjaxHtml(list, "Id", textFunction, header, String.Empty, GeographicPathItem.Unknown.Name); } else { string header = "( No hay " + pathType.DisplayPluralName.ToLowerInvariant() + (pathType.FemaleGenre ? " definidas )" : " definidos )"); return HtmlSelectContent.GetComboAjaxHtml(header, String.Empty, GeographicPathItem.Unknown.Name); } }
private void AppendSettlement() { GeographicRegionItem municipality = GeographicRegionItem.Parse(int.Parse(Request.Form[cboMunicipality.ClientID])); GeographicItemType settlementType = GeographicItemType.Parse(int.Parse(cboSettlementType.Value)); GeographicRegionItem settlement = (GeographicRegionItem) settlementType.CreateInstance(); settlement.Name = txtSearchText.Value; settlement.Save(); municipality.AddMember("Municipality_Settlements", settlement); FillPropertyData(); property.Settlement = settlement; property.Save(); }
private string GetSettlementIdCommandHandler() { int settlementTypeId = int.Parse(GetCommandParameter("settlementTypeId", true)); int municipalityId = int.Parse(GetCommandParameter("municipalityId", true)); string name = GetCommandParameter("name", true); GeographicItemType settlementType = GeographicItemType.Parse(settlementTypeId); GeographicRegionItem municipality = GeographicRegionItem.Parse(municipalityId); GeographicRegionItem result = GeographicItemValidator.SearchSettlement(settlementType, municipality, name); if (result.Id != GeographicRegionItem.Empty.Id) { return result.Id.ToString(); } return String.Empty; }
private void AppendStreetRoad() { GeographicRegionItem settlement = GeographicRegionItem.Parse(int.Parse(Request.Form[cboSettlement.ClientID])); GeographicItemType streetRoadType = GeographicItemType.Parse(int.Parse(cboStreetRoadType.Value)); GeographicPathItem street = (GeographicPathItem) streetRoadType.CreateInstance(); street.Name = txtSearchText.Value; street.Save(); settlement.AddMember("Settlement_Paths", street); GeographicRegionItem municipality = GeographicRegionItem.Parse(int.Parse(Request.Form[cboMunicipality.ClientID])); municipality.AddMember("Municipality_Paths", street); FillPropertyData(); property.Street = street; property.Save(); }
private void AppendPostalCode() { GeographicItemType postalCodeType = GeographicItemType.Parse(309); GeographicRegionItem postalCode = (GeographicRegionItem) postalCodeType.CreateInstance(); postalCode.Name = txtSearchText.Value; postalCode.Save(); if (Request.Form[cboSettlement.ClientID].Length != 0 && int.Parse(Request.Form[cboSettlement.ClientID]) > 0) { GeographicRegionItem settlement = GeographicRegionItem.Parse(int.Parse(Request.Form[cboSettlement.ClientID])); settlement.AddMember("Settlement_PostalCodes", postalCode); } GeographicRegionItem municipality = GeographicRegionItem.Parse(int.Parse(Request.Form[cboMunicipality.ClientID])); municipality.AddMember("Municipality_PostalCodes", postalCode); FillPropertyData(); property.PostalCode = postalCode; property.Save(); }