示例#1
0
        private void button_save_Click(object sender, EventArgs e)
        {
            if (this.comboBox_hora.Text.Equals(""))
            {
                this.box_medico.Text = "";
                return;
            }

            DateTime Fecha;
            DateTime Hora;

            //Fecha = this.Combo_fecha.Value;
            Fecha = Convert.ToDateTime(this.Combo_fecha.Value.ToShortDateString());

            Hora = Convert.ToDateTime(this.comboBox_hora.Text);
            TimeSpan Hour       = new TimeSpan(Hora.Hour, Hora.Minute, 0);
            DateTime FechaTurno = Fecha.Add(Hour);

            if (Cod_Afiliado == -1)
            {
                Cod_Afiliado = elAfiliado.Cod_Afiliado;
            }

            if (SQL_Methods.Turno_Registrar(Matricula, Cod_Especialidad, Cod_Afiliado, FechaTurno) == -1)
            {
                MessageBox.Show("No se pudo agregar el turno.");
                return;
            }

            menu.Visible = true;
            this.Dispose();
            return;
        }