コード例 #1
0
        private void button12_Click(object sender, RoutedEventArgs e)
        {
            DataGridCellInfo curcell = dataGrid.CurrentCell;

            object item = dataGrid.SelectedItem;

            if (item == null)
            {
                return;
            }
            string ID = (dataGrid.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text;
            //MessageBox.Show(ID);



            MessageBoxResult result = MessageBox.Show("Esta seguro que desea elimiar esta Cita", "Advertencia", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation);

            if (result == MessageBoxResult.OK)
            {
                object curType = ((DataRowView)dataGrid.SelectedItem).Row[0];
                // string curObject = curType.GetType().ToString();

                Int32 curId = (Int32)((DataRowView)dataGrid.SelectedItem).Row["IdCita"];

                DatosCehavi datos1 = new DatosCehavi();
                datos1.Connect();

                datos1.executeQuery("delete from Citas where Id=" + curId.ToString());
                datos1.executeQuery("delete from eventos where IdTipo=2 and IdEvento=" + curId.ToString());

                MessageBox.Show("Se elimino el registro", "Información");

                CargaCitas();
            }
        }
コード例 #2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            DatosCehavi datos1 = new DatosCehavi();

            datos1.Connect();

            string CurEstado = this.comboBox_Estado.SelectedValue.ToString();

            datos1.executeQuery("update Eventos set status1=" + CurEstado + " where Id=" + this.curEvento.ToString());

            this.estado_cambio = true;
            this.Close();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        private void otraOpcion(object sender, RoutedEventArgs e)
        {
            // return;

            /*
             *
             *
             *       ArrayList valores = new ArrayList();
             *
             *     string[] estados =
             *     {"Aguascalientes",
             * "Baja California",
             * "Baja California Sur",
             * "Campeche",
             * "Coahuila",
             * "Colima",
             * "Chiapas",
             * "Chihuahua",
             * "Distrito Federal",
             * "Durango",
             * "Guanajuato",
             * "Guerrero",
             * "Hidalgo",
             * "Jalisco",
             * "México",
             * "Michoacán",
             * "Morelos",
             * "Nayarit",
             * "Nuevo León",
             * "Oaxaca",
             * "Puebla",
             * "Querétaro",
             * "Quintana Roo",
             * "San Luis Potosí",
             * "Sinaloa",
             * "Sonora",
             * "Tabasco",
             * "Tamaulipas",
             * "Tlaxcala",
             * "Veracruz",
             * "Yucatán",
             * "Zacatecas"};
             *
             *     DatosCehavi datos1 = new DatosCehavi();
             *     datos1.Connect();
             *
             *     for(int i=0;i<estados.Length;i++)
             *     {
             *         valores.Add(new Registro("Id", i+1));
             *         valores.Add(new Registro("Nombre", estados[i]));
             *         datos1.InsertData(valores, "Estados");
             *         valores.Clear();
             *
             *     }
             *
             */
            DatosCehavi datos1 = new DatosCehavi();

            datos1.Connect();


            datos1.executeQuery("update Eventos set estatus1=1");

            //datos1.executeQuery("ALTER TABLE terapeutas ALTER COLUMN Id COUNTER(1,1)");
            //datos1.executeQuery("delete from Citas");

            return;
        }
コード例 #5
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();
        }