コード例 #1
0
        private void save_Click(object sender, RoutedEventArgs e)
        {
            DatosCehavi datos1 = new DatosCehavi();

            datos1.Connect();

            ArrayList valores = new ArrayList();

            if (this.CitaFecha == null)
            {
                MessageBox.Show("Selecciona una fecha", "Advertencia");
                return;
            }


            if (this.CitaFecha.Length == 0)
            {
                MessageBox.Show("Selecciona una fecha", "Advertencia");
                return;
            }

            DateTime curFecha = System.Convert.ToDateTime(this.CitaFecha);

            Int32 Duracion  = System.Convert.ToInt32(this.textBox.Text);
            Int32 Terapeuta = System.Convert.ToInt32(this.comboBoxTerapeutas.SelectedValue);



            //  Int32 Minuto = System.Convert.ToInt32(this.comboBoxMinutos.SelectedValue);



            valores.Add(new Registro("Duracion", Duracion));
            valores.Add(new Registro("IdPaciente", this.curPaciente));
            valores.Add(new Registro("IdTerapeuta", Terapeuta));
            valores.Add(new Registro("comentarios", this.comentarios.Text));
            valores.Add(new Registro("Fecha", curFecha.ToString("yyyy-MM-dd HH:mm:ss")));



            if (this.curCita != 0)
            {
                datos1.UpdateData(valores, this.curCita, "Id", "Citas");
            }
            else
            {
                this.curCita = datos1.InsertData(valores, "Citas");
            }


            if (this.curCita != 0)
            {
                datos1.executeQuery("delete from eventos where IdTipo=2 and IdEvento=" + this.curCita.ToString());
                datos1.CreateCitaEvent(this.CurCita);
            }

            else
            {
                this.curCita = datos1.InsertData(valores, "Citas");
            }



            this.Close();
        }