Exemple #1
0
        private void button_save_Click(object sender, EventArgs e)
        {
            TimeSpan Hour       = new TimeSpan(23, 59, 59);
            TimeSpan diffResult = box_fechaDesde.Value.Subtract(@Clinica_Frba.Properties.Settings.Default.Fecha);

            DateTime FechaDesde;
            DateTime FechaHasta;

            FechaDesde = Convert.ToDateTime(this.box_fechaDesde.Value.ToShortDateString());

            if (diffResult.Days <= 1)
            {
                MessageBox.Show("No se pueden cancelar turnos con anticipación menor a 24 horas");
                return;
            }

            if (box_fecha.Text.Equals("Fecha en Particular"))
            {
                this.Box_FechaHasta.Value = FechaDesde;
            }
            else
            {
                this.Box_FechaHasta.Value = Convert.ToDateTime(this.Box_FechaHasta.Value.ToShortDateString());
            }

            FechaHasta = this.Box_FechaHasta.Value.Add(Hour);

            if (!SQL_Methods.Profesional_CancelarTurno(Matricula,
                                                       FechaDesde,
                                                       FechaHasta,
                                                       this.box_tipoCancelacion.Text.Trim(),
                                                       this.box_descripcion.Text.Trim()))
            {
                MessageBox.Show("No se pudieron Cancelar los Turnos en Cuestion.");
                return;
            }
            menu.Visible = true;
            this.Dispose();
            return;
        }