Exemple #1
0
 private void fichasTécnicasToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     Forms.Fichas.CadastroFichas f = new Forms.Fichas.CadastroFichas(Convert.ToInt32(txtId.Text), "", false);
     this.Hide();
     f.ShowDialog();
     f.Dispose();
     this.Show();
 }
        private void dgvFichas_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            Augoritmos au = new Augoritmos();

            if (e.ColumnIndex == 12)
            {
                if (e.RowIndex >= 0)
                {
                    if (permissao >= 3)
                    {
                        DialogResult d = MessageBox.Show("Deseja realmente excluir a ficha técnica de " + dgvFichas.Rows[e.RowIndex].Cells[1].Value.ToString() + "?", "ATENÇÃO!", MessageBoxButtons.YesNo);
                        if (d.ToString() == "Yes")
                        {
                            au.ExcluirPrato(dgvFichas.Rows[e.RowIndex].Cells[0].Value.ToString());
                            CarregaDgv();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Você não tem permissões necessárias para deletar esta ficha técnica.");
                    }
                }
            }


            if (e.ColumnIndex == 11)
            {
                if (e.RowIndex >= 0)
                {
                    if (herdada)
                    {
                        this.fichaSelecionada = dgvFichas.Rows[e.RowIndex].Cells[0].Value.ToString();
                        this.Close();
                    }
                    else
                    {
                        if (permissao >= 3)
                        {
                            CadastroFichas cf = new CadastroFichas(idUsuario, dgvFichas.Rows[e.RowIndex].Cells[0].Value.ToString(), true);
                            cf.ShowDialog();
                            cf.Dispose();
                            CarregaDgv();
                        }
                        else
                        {
                            MessageBox.Show("Você não tem permissões necessárias para editar esta ficha técnica.");
                        }
                    }
                }
            }

            if (e.ColumnIndex == 10)
            {
                if (e.RowIndex >= 0)
                {
                    VisualizaFichaTecnica vf = new VisualizaFichaTecnica(Convert.ToInt32(cbUnidade.SelectedValue), idUsuario, dgvFichas.Rows[e.RowIndex].Cells[0].Value.ToString());
                    vf.ShowDialog();
                    vf.Dispose();
                }
            }
        }