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 LoadPostalCodesCombo() { cboPostalCode.Items.Clear(); ObjectList<GeographicRegionItem> list = new ObjectList<GeographicRegionItem>(); GeographicItemType postalCodeType = property.PostalCode.GeographicItemType; if (property.Settlement.Id > 0) { list = property.Settlement.GetRegions("Settlement_PostalCodes", postalCodeType); } else if (property.Municipality.Id > 0) { list = property.Municipality.GetRegions("Municipality_PostalCodes"); } else if (property.Municipality.Equals(GeographicRegionItem.Unknown)) { // no-op } else { cboPostalCode.Items.Add(new ListItem("Municipio?", String.Empty)); return; } HtmlSelectContent.LoadCombo(cboPostalCode, list, "Id", "Name", list.Count != 0 ? "( ? )" : "( No def )", String.Empty, GeographicRegionItem.Unknown.Name); }
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(); }
private void LoadSettlementsCombo() { cboSettlement.Items.Clear(); ObjectList<GeographicRegionItem> list = new ObjectList<GeographicRegionItem>(); GeographicItemType settlementType = property.Settlement.GeographicItemType; if (property.Settlement.Id >= 0) { list = property.Municipality.GetRegions("Municipality_Settlements", settlementType); } else if (property.Municipality.Id > 0) { list = property.Municipality.GetRegions("Municipality_Settlements"); } else if (property.Municipality.Equals(GeographicRegionItem.Unknown)) { // no-op } else { cboSettlement.Items.Add(new ListItem("( Primero seleccionar un municipio )", String.Empty)); return; } string headerItem = String.Empty; if (list.Count != 0) { headerItem = "( Seleccionar" + (settlementType.FemaleGenre ? " una " : " un ") + settlementType.DisplayName.ToLowerInvariant() + " )"; } else { headerItem = "( No hay " + settlementType.DisplayPluralName.ToLowerInvariant() + (settlementType.FemaleGenre ? " definidas )" : " definidos )"); } HtmlSelectContent.LoadCombo(cboSettlement, list, "Id", "Name", headerItem, String.Empty, GeographicRegionItem.Unknown.Name); }