Example #1
0
 private void btn_del_Click(object sender, EventArgs e)
 {
     if (action == 2 && id>0)
     {
         DialogResult r = MessageBox.Show("Al eliminar un paciente se elimina tambien su historial de citas.", "Estas seguro?", MessageBoxButtons.YesNo);
         if (r == DialogResult.Yes)
         {
             Connection c = new Connection();
             c.execute("delete from reservation where pacient_id=" + id);
             c.execute("delete from pacient where id=" + id);
             MessageBox.Show("Eliminado exitosamente!");
             Dispose();
         }
     }
 }
 private void btn_del_Click(object sender, EventArgs e)
 {
     if (action == 2 && id > 0)
     {
         DialogResult r = MessageBox.Show("Al eliminar un paciente se elimina tambien su historial de citas.", "Estas seguro?", MessageBoxButtons.YesNo);
         if (r == DialogResult.Yes)
         {
             Connection c = new Connection();
             c.execute("delete from reservation where pacient_id=" + id);
             c.execute("delete from pacient where id=" + id);
             MessageBox.Show("Eliminado exitosamente!");
             Dispose();
         }
     }
 }
Example #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (name.Text != "" && lastname.Text != "")
     {
         Connection c = new Connection();
         if (action == 1)
         {
             c.execute("insert into pacient (name,lastname,address,email,phone) value (\"" + name.Text + "\",\"" + lastname.Text + "\",\"" + address.Text + "\",\"" + email.Text + "\",\"" + phone.Text + "\")");
             name.Text = lastname.Text = address.Text = email.Text = phone.Text = "";
             MessageBox.Show("Agregado exitosamente!");
         }
         else if (action == 2 && id>0) {
             c.execute("update pacient set name=\"" + name.Text + "\",lastname=\"" + lastname.Text + "\",address=\"" + address.Text + "\",email=\"" + email.Text + "\",phone=\"" + phone.Text + "\" where id=" + id);
             MessageBox.Show("Actualizado exitosamente!");
         }
     }
     else
     {
         MessageBox.Show("Campos Obligatorios: Nombre, Apellidos");
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     if (name.Text != "" && lastname.Text != "")
     {
         Connection c = new Connection();
         if (action == 1)
         {
             c.execute("insert into pacient (name,lastname,address,email,phone) value (\"" + name.Text + "\",\"" + lastname.Text + "\",\"" + address.Text + "\",\"" + email.Text + "\",\"" + phone.Text + "\")");
             name.Text = lastname.Text = address.Text = email.Text = phone.Text = "";
             MessageBox.Show("Agregado exitosamente!");
         }
         else if (action == 2 && id > 0)
         {
             c.execute("update pacient set name=\"" + name.Text + "\",lastname=\"" + lastname.Text + "\",address=\"" + address.Text + "\",email=\"" + email.Text + "\",phone=\"" + phone.Text + "\" where id=" + id);
             MessageBox.Show("Actualizado exitosamente!");
         }
     }
     else
     {
         MessageBox.Show("Campos Obligatorios: Nombre, Apellidos");
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     if (title.Text != "" && pacient.SelectedIndex != -1 && medic.SelectedIndex != -1 && date_at.Text != "" && time_at.Text != "")
     {
         Connection c = new Connection();
         if (action == 1)
         {
             c.execute("insert into reservation (title,pacient_id,medic_id,date_at,time_at,note,created_at) value (\"" + title.Text + "\",\"" + pas[pacient.SelectedIndex].id + "\",\"" + mes[medic.SelectedIndex].id + "\",\"" + date_at.Text + "\",\"" + time_at.Text + "\",\"" + note.Text + "\",NOW())");
             title.Text            = note.Text = date_at.Text = time_at.Text = "";
             pacient.SelectedIndex = medic.SelectedIndex = -1;
             MessageBox.Show("Cita Agregada Exitosamente!");
         }
         else if (action == 2 && id > 0)
         {
             c.execute("update reservation set title=\"" + title.Text + "\",pacient_id=\"" + pas[pacient.SelectedIndex].id + "\",medic_id=\"" + mes[medic.SelectedIndex].id + "\",date_at=\"" + date_at.Text + "\",time_at=\"" + time_at.Text + "\",note=\"" + note.Text + "\" where id=" + id);
             MessageBox.Show("Cita Actualizaa Exitosamente!");
         }
     }
     else
     {
         MessageBox.Show("Campos Obligatorios: Asunto, Paciente, Medico, Fecha y Hora");
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     if (title.Text != "" && pacient.SelectedIndex != -1 && medic.SelectedIndex != -1 && date_at.Text != "" && time_at.Text != "")
     {
         Connection c = new Connection();
         if (action == 1)
         {
             c.execute("insert into reservation (title,pacient_id,medic_id,date_at,time_at,note,created_at) value (\"" + title.Text + "\",\"" + pas[pacient.SelectedIndex].id + "\",\"" + mes[medic.SelectedIndex].id + "\",\"" + date_at.Text + "\",\"" + time_at.Text + "\",\"" + note.Text + "\",NOW())");
             title.Text = note.Text = date_at.Text = time_at.Text = "";
             pacient.SelectedIndex = medic.SelectedIndex = -1;
             MessageBox.Show("Cita Agregada Exitosamente!");
         }
         else if (action == 2 && id > 0) {
             c.execute("update reservation set title=\"" + title.Text + "\",pacient_id=\"" + pas[pacient.SelectedIndex].id + "\",medic_id=\"" + mes[medic.SelectedIndex].id + "\",date_at=\"" + date_at.Text + "\",time_at=\"" + time_at.Text + "\",note=\"" + note.Text + "\" where id=" + id);
             MessageBox.Show("Cita Actualizaa Exitosamente!");
         }
     }
     else { MessageBox.Show("Campos Obligatorios: Asunto, Paciente, Medico, Fecha y Hora"); }
 }