protected void btnBuscarZona_Click(object sender, EventArgs e) { Zonas zona = null; string dep = ddlDepa.SelectedValue; if (String.IsNullOrWhiteSpace(txtLoca.Text)) { mostrarMensajeError("Debe indcar la localidad."); return; } string loc = txtLoca.Text; InterfaceLogicaZona inter = FabricaLogica.GetLogicaZona(); zona = inter.Buscar(dep, loc); if (zona == null) { lblZona.Text = "No se encontro la Zona"; return; } else { lblZona.Text = zona.Nombre; } }
protected Apartamento CargarApartamento() { int padron; string direccion = txtDireccion.Text; string accion = ddlAccion.SelectedValue; int precio; double tamaño; int habitacion; int baños; int piso; bool ascensor = false; Empleado empleado = null; Zonas zona = null; if (String.IsNullOrWhiteSpace(txtLoca.Text)) { throw new ExcepcionPersonalizada("Debe indcar la localidad."); } string dep = ddlDepa.SelectedValue; string loc = txtLoca.Text; try { empleado = (Empleado)Session["USER"]; } catch (ExcepcionPersonalizada ex) { throw ex; } catch { throw new ExcepcionPersonalizada("Ocurrio un problema al buscar al empleado"); } try { InterfaceLogicaZona inter = FabricaLogica.GetLogicaZona(); zona = inter.Buscar(dep, loc); if (zona == null) { throw new ExcepcionPersonalizada("Debe ingresar una zona valida."); } } catch (ExcepcionPersonalizada ex) { throw ex; } catch { throw new ExcepcionPersonalizada("Ocurrio un problema al buscar la zona"); } try { padron = Convert.ToInt32(txtPadron.Text); } catch (FormatException) { throw new ExcepcionPersonalizada("El Padron debe ser un numero entero."); } try { precio = Convert.ToInt32(txtPrecio.Text); } catch (FormatException) { throw new ExcepcionPersonalizada("El Precio debe ser un numero entero."); } try { tamaño = Convert.ToDouble(txtTamaño.Text); } catch (FormatException) { throw new ExcepcionPersonalizada("El Tamaño debe ser un numero decimal."); } try { habitacion = Convert.ToInt32(txtHabitacion.Text); } catch (FormatException) { throw new ExcepcionPersonalizada("El numero de habitaciones debe ser un numero entero."); } try { baños = Convert.ToInt32(txtBaño.Text); } catch (FormatException) { throw new ExcepcionPersonalizada("El numero de baños debe ser un numero entero."); } try { piso = Convert.ToInt32(txtPiso.Text); } catch (FormatException) { throw new ExcepcionPersonalizada("El Piso debe ser un numero entero."); } if (rbtnSi.Checked) { ascensor = true; } Apartamento apartamento = new Apartamento(padron, direccion, precio, accion, baños, habitacion, tamaño, piso, ascensor, empleado, zona); return(apartamento); }