コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtMotivo.Text.Trim()) && txtMotivo.Text.Trim().Length < 255)
            {
                MessageBox.Show("Por favor, indique el motivo de la cancelacion");
                return;
            }
            switch (this.dataGridView1.SelectedRows.Count)
            {
            case 0:
                MessageBox.Show("Seleccione un turno a cancelar");
                break;

            case 1:
                if (cancelarTurnoDelDiaCorriente(Convert.ToDateTime(dataGridView1.CurrentRow.Cells[4].Value)))
                {
                    MessageBox.Show("Error, no puede cancelar un turno de hoy");
                    return;
                }
                else
                {
                    try
                    {
                        CancelacionManager.cancelarTurno(Convert.ToInt32(dataGridView1.CurrentRow.Cells[3].Value),
                                                         Convert.ToInt32(dataGridView1.CurrentRow.Cells[1].Value), Convert.ToString(dataGridView1.CurrentRow.Cells[2].Value),
                                                         Convert.ToString(dataGridView1.CurrentRow.Cells[4].Value), txtMotivo.Text.Trim());
                    }
                    catch (Exception a)
                    {
                        MessageBox.Show("La cancelacion no pudo realizarse");
                        return;
                    }

                    MessageBox.Show("El turno fue cancelado");
                    this.dataGridView1.DataSource = CancelacionManager.mostrarTurnosAfiliado(Convert.ToInt32(dataGridView1.CurrentRow.Cells[3].Value));
                }
                break;

            default:
                MessageBox.Show("Seleccione de a un turno");
                break;
            }
        }
コード例 #2
0
 public CancelacionAfiliado(int id)
 {
     InitializeComponent();
     this.dataGridView1.DataSource = CancelacionManager.mostrarTurnosAfiliado(id);
 }