private void save_Click(object sender, RoutedEventArgs e) { DatosCehavi datos1 = new DatosCehavi(); datos1.Connect(); ArrayList valores = new ArrayList(); if (this.TerapiaFecha == null) { MessageBox.Show("Selecciona una fecha", "Advertencia"); return; } if (this.TerapiaFecha.Length == 0) { MessageBox.Show("Selecciona una fecha", "Advertencia"); return; } DateTime curFecha = System.Convert.ToDateTime(this.TerapiaFecha); // Int32 Dia = System.Convert.ToInt32(this.comboBoxDias.SelectedValue); // Int32 Hora = System.Convert.ToInt32(this.comboBoxHoras.SelectedValue); Int32 Duracion = System.Convert.ToInt32(this.textBox.Text); Int32 Terapeuta = System.Convert.ToInt32(this.comboBoxTerapeutas.SelectedValue); Int32 Periodo = System.Convert.ToInt32(this.Repeticion.SelectedValue); DateTime StartFecha = (DateTime)this.datePicker0.SelectedDate; DateTime EndFecha = (DateTime)this.datePicker1.SelectedDate; // Int32 Minuto = System.Convert.ToInt32(this.comboBoxMinutos.SelectedValue); int CurDia = (int)curFecha.DayOfWeek; valores.Add(new Registro("Duracion", Duracion)); valores.Add(new Registro("IdPaciente", this.curPaciente)); valores.Add(new Registro("IdTerapeuta", Terapeuta)); valores.Add(new Registro("Periodo", Periodo)); valores.Add(new Registro("Fecha", StartFecha.ToString("yyyy-MM-dd HH:mm:ss"))); valores.Add(new Registro("Fecha2", EndFecha.ToString("yyyy-MM-dd HH:mm:ss"))); valores.Add(new Registro("Dia", CurDia)); valores.Add(new Registro("Hora", curFecha.ToString("2000-01-01 HH:mm:ss"))); if (this.curTerapia != 0) { datos1.UpdateData(valores, this.curTerapia, "Id", "terapias"); datos1.executeQuery("delete from eventos where IdTipo=1 and IdEvento=" + this.curTerapia.ToString()); datos1.CreateCurrentEvents(this.curTerapia); } else { this.curTerapia = datos1.InsertData(valores, "terapias"); } //MessageBox.Show(curFecha.ToShortDateString(),"Fecha"); //MessageBox.Show(curFecha.ToShortTimeString(), "Hora"); this.Close(); }