Пример #1
0
        private void btnAceptarDos_Click(object sender, EventArgs e)
        {
            PropiedadNegocio negocio = new PropiedadNegocio();
            Propiedad        nuevo   = new Propiedad();

            try
            {
                nuevo.DescripcionGeneral = txtDescripcion.Text;
                if (txtSuperficieCubierta.Text.Trim() == "" || txtSuperficieDescubierta.Text.Trim() == "")
                {
                    MessageBox.Show("Las superficies son obligatorias");
                    return;
                }
                nuevo.SuperficieCubierta    = int.Parse(txtSuperficieCubierta.Text);
                nuevo.SuperficieDescubierta = int.Parse(txtSuperficieDescubierta.Text);

                negocio.altaDos(nuevo);

                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            PropiedadNegocio neg = new PropiedadNegocio();

            try
            {
                dgvPropiedades.DataSource = neg.listar();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Пример #3
0
        private void btnEliminarLogico_Click(object sender, EventArgs e)
        {
            PropiedadNegocio negocio = new PropiedadNegocio();

            try
            {
                negocio.eliminarLogico((int)dgvPropiedades.CurrentRow.Cells[0].Value);
                cargar();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Пример #4
0
        private void btnEliminarFisico_Click(object sender, EventArgs e)
        {
            Propiedad        eliminar;
            PropiedadNegocio negocio = new PropiedadNegocio();

            try
            {
                eliminar = (Propiedad)dgvPropiedades.CurrentRow.DataBoundItem;
                negocio.eliminarFisico(eliminar.Id);
                cargar();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Пример #5
0
        private void cargar()
        {
            PropiedadNegocio neg = new PropiedadNegocio();

            try
            {
                listaPropiedades                            = (List <Propiedad>)neg.listar();
                dgvPropiedades.DataSource                   = listaPropiedades;
                dgvPropiedades.Columns[0].Visible           = false;
                dgvPropiedades.Columns[1].AutoSizeMode      = DataGridViewAutoSizeColumnMode.Fill;
                dgvPropiedades.Columns["FechaAlta"].Visible = false;
                //dgvPropiedades.Columns["Direccion"].Visible = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Пример #6
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            PropiedadNegocio propiedadNegocio = new PropiedadNegocio();
            DireccionNegocio direccionNegocio = new DireccionNegocio();

            try
            {
                if (propiedad == null)
                {
                    propiedad = new Propiedad();
                }

                propiedad.DescripcionGeneral = txtDescripcion.Text;
                if (txtSuperficieCubierta.Text.Trim() == "" || txtSuperficieDescubierta.Text.Trim() == "")
                {
                    MessageBox.Show("Las superficies son obligatorias");
                    return;
                }
                propiedad.SuperficieCubierta    = int.Parse(txtSuperficieCubierta.Text);
                propiedad.SuperficieDescubierta = int.Parse(txtSuperficieDescubierta.Text);

                if (propiedad.Id != 0)
                {
                    propiedadNegocio.modificar(propiedad);
                    MessageBox.Show("Modificado Correctamente.");
                }
                else
                {
                    propiedad.Direccion.Id = direccionNegocio.agregar(propiedad.Direccion);
                    propiedadNegocio.alta(propiedad);
                    MessageBox.Show("Agregado Correctamente.");
                }
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }