예제 #1
0
        public void mostrarDetalhe(VerImoveis verImoveis, DetalheImovel detalheImovel)
        {
            CrudLocador crudLocador = new CrudLocador(inicio);

            DataGridViewRow selectedRow = verImoveis.dgvImovel.Rows[verImoveis.linha];

            int id_Imovel = Convert.ToInt16(selectedRow.Cells[0].Value);



            detalheImovel.btnSalvar.Visible = false;

            detalheImovel.pbImovel.ImageLocation = getImovelByPathName(verImoveis.dgvImovel, verImoveis.linha);
            detalheImovel.rtxtDescricao.Text     = selectedRow.Cells[2].Value.ToString();
            detalheImovel.txtRuaAvenida.Text     = selectedRow.Cells[3].Value.ToString();
            detalheImovel.txtComplemento.Text    = selectedRow.Cells[4].Value.ToString();


            detalheImovel.cboUf.SelectedItem     = selectedRow.Cells[5].Value.ToString();
            detalheImovel.txtNumero.Text         = selectedRow.Cells[6].Value.ToString();
            detalheImovel.txtBairro.Text         = selectedRow.Cells[7].Value.ToString();
            detalheImovel.txtCidade.Text         = selectedRow.Cells[8].Value.ToString();
            detalheImovel.txtValorAluguel.Text   = selectedRow.Cells[9].Value.ToString();
            detalheImovel.cboStatus.SelectedItem = selectedRow.Cells[10].Value.ToString();

            detalheImovel.txtLocador.Text = crudLocador.getNameById(Convert.ToInt16(selectedRow.Cells[1].Value));

            detalheImovel.Visible = true;
        }
예제 #2
0
        private void btnDetalhe_Click(object sender, EventArgs e)
        {
            ValidacaoGeral validacaoGeral = new ValidacaoGeral();
            bool           checar         = validacaoGeral.validaDatagrid(this);

            if (checar)
            {
                CrudImovel crudImovel = new CrudImovel(inicio);

                detalheImovel = new DetalheImovel(inicio);
                detalheImovel.btnMudar.Visible = false;
                crudImovel.mostrarDetalhe(this, detalheImovel);
            }
        }
예제 #3
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            ValidacaoGeral validacaoGeral = new ValidacaoGeral();
            bool           checar         = validacaoGeral.validaDatagrid(this);

            if (checar)
            {
                CrudImovel      crudImovel  = new CrudImovel(this, inicio);
                DataGridViewRow selectedRow = dgvImovel.Rows[linha];
                int             id_Imovel   = Convert.ToInt16(Convert.ToInt16(selectedRow.Cells[0].Value));
                detalheImovelEditar = new DetalheImovel(id_Imovel, usuario, inicio);
                crudImovel.mostrarEditar(this, detalheImovelEditar);
            }
        }
예제 #4
0
        public void salvarEditar(DetalheImovel detalheImovel)
        {
            CrudLocador crudLocador = new CrudLocador(inicio);

            int id_Imovel = detalheImovel.id_imovel;

            int id_User = detalheImovel.usuario;

            comando = new SqlCommand();

            try
            {
                stringConexao.conn.Open();
            }
            catch (SqlException ex)
            {
                MessageBox.Show("Não conectou", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            comando.Connection = stringConexao.conn;

            comando.CommandText = "update Imovel set fileNameImg = '" + detalheImovel.picpath + "', descricao = '" + detalheImovel.rtxtDescricao.Text + "'," +
                                  "rua_avenida = '" + detalheImovel.txtRuaAvenida.Text + "', complemento = '" + detalheImovel.txtComplemento.Text + "'," +
                                  " uf = '" + detalheImovel.cboUf.SelectedItem + "', numero = '" + Convert.ToInt32(detalheImovel.txtNumero.Text) + "'," +
                                  " bairro = '" + detalheImovel.txtBairro.Text + "', cidade = '" + detalheImovel.txtCidade.Text + "', " +
                                  "valor_Aluguel = '" + Convert.ToDecimal(detalheImovel.txtValorAluguel.Text) + "', status_Imovel = '" + detalheImovel.cboStatus.SelectedItem + "'," +
                                  "id_User =  '******' where id = '" + id_Imovel + "'";

            try
            {
                comando.ExecuteNonQuery();
                MessageBox.Show("Imóvel Editado!", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }catch (SqlException ex)
            {
                MessageBox.Show(ex.ToString());
            }

            stringConexao.conn.Close();
        }