Пример #1
0
        private void tb_click(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dg = sender as DataGridView;

            try
            {
                if (e.ColumnIndex == 1 && e.RowIndex != -1)
                {
                    var id = dg.Rows[e.RowIndex].Cells[0].Value;

                    Paciente obj = service.Buscar(Convert.ToInt32(id));

                    var form = new frmEditarPaciente(obj);
                    form.ShowDialog();

                    if (form.status == "apagado")
                    {
                        this.Close();
                        frmConPaciente frm = new frmConPaciente();
                        frm.ShowDialog();
                    }
                    if (form.status == "editado")
                    {
                        dg.Rows.RemoveAt(e.RowIndex);
                        GerarLinha(dg, obj);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao selecionar o dentista " + ex.Message);
            }
        }
Пример #2
0
        private void Tabela_Clicada(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dgv        = sender as DataGridView;
            var          idConsulta = dgv.Rows[e.RowIndex].Cells[0].Value;
            Consulta     c          = service.Buscar(Convert.ToInt32(idConsulta));

            try
            {
                if (e.ColumnIndex == 2 && e.RowIndex != -1)
                {
                    Paciente          p   = serviceP.Buscar(c.IdPaciente);
                    frmEditarPaciente frm = new frmEditarPaciente(p);
                    frm.ShowDialog();
                    AtualizarLinhas();
                }
                if (e.ColumnIndex == 4 && e.RowIndex != -1)
                {
                    var Form = new frmEditarConsulta(c);
                    Form.ShowDialog();
                    AtualizarLinhas();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ocorreu um erro, favor entrar em contato com o adminstrador do sistema", "Ops!");
            }
        }
Пример #3
0
        private void dg_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 2 && e.RowIndex != -1)
            {
                DataGridView      dg  = sender as DataGridView;
                int               id  = Convert.ToInt32(dg.Rows[e.RowIndex].Cells[4].Value);
                Paciente          p   = serviceP.Buscar(id);
                frmEditarPaciente frm = new frmEditarPaciente(p);
                frm.Show();
            }

            if (e.ColumnIndex == 3 && e.RowIndex != -1)//Feedback No GridsView
            {
                int      id = Convert.ToInt32(dg.Rows[e.RowIndex].Cells[0].Value);
                Consulta c  = service.Buscar(id);
                string   s  = c.Status;

                switch (s)
                {
                case "Confirmado":
                    c.Status = "Desmarcado";
                    break;

                case "Desmarcado":
                    c.Status = "Ja chegou";
                    break;

                case "Ja chegou":
                    c.Status = "Em atendimento";
                    break;

                case "Em atendimento":
                    c.Status = "Nao confirmado";
                    break;

                case "Nao confirmado":
                    c.Status = "Confirmado";
                    break;

                default:
                    c.Status = "Nao confirmado";
                    break;
                }

                service.Editar(c);
                atualizarAgenda(Convert.ToInt32(cbDentista.SelectedValue));
            }
        }