Esempio n. 1
0
        public objplantacao ProcuraPlantacao(int codPlant)
        {
            Conexao       conn  = new Conexao();
            NpgsqlCommand query = new NpgsqlCommand("Select codigo,funcionario,area,distinciaentreplantas,datadeplantio,valordevenda,statusdaplantacao,previsaodecolheita,prevdatacolheita,quantidadecolhida,sementeusada from farmsystem.plantacao where codigo = @cod");

            query.Connection = conn.entrar();
            query.Parameters.Add("@cod", NpgsqlDbType.Integer).Value = codPlant;
            using (NpgsqlDataReader dr = query.ExecuteReader())
            {
                if (dr.HasRows)
                {
                    objplantacao p = null;
                    if (dr.Read())
                    {
                        p                       = new objplantacao();
                        p.codigo                = dr.GetInt32(0);
                        p.funcionario           = dr.GetInt32(1);
                        p.area                  = dr.GetDouble(2);
                        p.distinciaentreplantas = dr.GetDouble(3);
                        p.datadeplantio         = dr.GetDateTime(4);
                        p.valordevenda          = dr.GetString(5);
                        p.statusdaplantacao     = dr.GetString(6);
                        p.previsaodecolheita    = dr.GetInt32(7);
                        p.prevdatacolheita      = dr.GetDateTime(8);
                        p.quantidadecolhida     = dr.GetInt32(9);
                        p.sementeusada          = dr.GetString(10);
                    }
                    conn.sair();
                    return(p);
                }
            }
            conn.sair();
            return(null);
        }
Esempio n. 2
0
        private void btnListaPlant_Click(object sender, EventArgs e)
        {
            frmListaPlantacoes lp = new frmListaPlantacoes();

            lp.ShowDialog();
            if (lp.DialogResult == DialogResult.OK)
            {
                objplantacao op = lp.GetPlantacao();
                txtplantacao.Text = op.codigo.ToString();
                txtsemente.Text   = op.sementeusada.ToString();
            }
        }
Esempio n. 3
0
        public objplantacao GetPlantacao()
        {
            objplantacao p = new objplantacao();

            p.codigo                = Convert.ToInt32(dgvPlantacoes.CurrentRow.Cells[0].Value);
            p.funcionario           = Convert.ToInt32(dgvPlantacoes.CurrentRow.Cells[1].Value);
            p.area                  = Convert.ToDouble(dgvPlantacoes.CurrentRow.Cells[2].Value.ToString());
            p.distinciaentreplantas = Convert.ToDouble(dgvPlantacoes.CurrentRow.Cells[3].Value.ToString());
            p.datadeplantio         = Convert.ToDateTime(dgvPlantacoes.CurrentRow.Cells[4].Value.ToString());
            p.valordevenda          = dgvPlantacoes.CurrentRow.Cells[5].Value.ToString();
            p.statusdaplantacao     = dgvPlantacoes.CurrentRow.Cells[6].Value.ToString();
            p.previsaodecolheita    = Convert.ToInt32(dgvPlantacoes.CurrentRow.Cells[7].Value);
            p.prevdatacolheita      = Convert.ToDateTime(dgvPlantacoes.CurrentRow.Cells[8].Value.ToString());
            p.quantidadecolhida     = Convert.ToInt32(dgvPlantacoes.CurrentRow.Cells[9].Value);
            p.sementeusada          = dgvPlantacoes.CurrentRow.Cells[10].Value.ToString();
            return(p);
        }