private void btnAlterar_Click(object sender, EventArgs e)
        {
            if (metroGrid1.RowCount > 0)
            {
                if (metroGrid1.CurrentRow.Cells[6].Value.ToString() != null)
                {
                    if (metroGrid1.CurrentRow.Cells[6].Value.ToString() == "Não")
                    {
                        if (metroGrid1.CurrentRow.Cells[0].Value.ToString() != null)
                        {
                            oEntity = EntityState.Alterar;
                            frmCompraGado frmcompragado = new frmCompraGado(oEntity, metroGrid1.CurrentRow.Cells[0].Value.ToString(), Convert.ToDateTime(metroGrid1.CurrentRow.Cells[3].Value.ToString()), metroGrid1.CurrentRow.Cells[2].Value.ToString());
                            frmcompragado.ShowDialog();

                            Pesquisar();
                        }
                    }
                    else
                    {
                        MetroFramework.MetroMessageBox.Show(this, "Não é permitido a alteração de compra já impresso.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }
        }
        private void btnNovo_Click(object sender, EventArgs e)
        {
            oEntity = EntityState.Inserir;
            frmCompraGado frmcompragado = new frmCompraGado(oEntity, "", null, "");

            frmcompragado.ShowDialog();

            Pesquisar();
        }