public static int EliminarAgenda(agendar pagendar) { int retorno = 0; MySqlCommand comando = new MySqlCommand(string.Format("delete from agenda_mantenimiento where idagenda_mantenimiento = {0}", pagendar.id_agenda), conexion.obtenerconexion()); retorno = comando.ExecuteNonQuery(); return(retorno); }
public static int ActulizarAgenda(agendar pagendar) { int retorno = 0; MySqlCommand comando = new MySqlCommand(string.Format("update agenda_mantenimiento set id_estado_ejecucion = {0}, detalle = '{1}' where idagenda_mantenimiento = {2}", pagendar.id_estado, pagendar.detalle, pagendar.id_agenda), conexion.obtenerconexion()); retorno = comando.ExecuteNonQuery(); return(retorno); }
public static int AgregarAgenda(agendar pagendar) { int retorno = 0; MySqlCommand comando = new MySqlCommand(string.Format("insert into agenda_mantenimiento (id_trabajo, detalle, id_servicio, id_usuario_agenda, id_departamento, id_zona, id_grupo_afectado, id_estado_ejecucion) values ('{0}', '{1}', '{2}',(select idusuario_agenda from usuario_agenda order by idusuario_agenda desc limit 1),'{3}','{4}','{5}','{6}')", pagendar.id_trabajo, pagendar.detalle, pagendar.id_servicio, pagendar.id_departamento, pagendar.id_zona, pagendar.id_grupo, pagendar.id_estado), conexion.obtenerconexion()); retorno = comando.ExecuteNonQuery(); return(retorno); }
private void button1_Click(object sender, EventArgs e) { agendar a = new agendar(); a.id_agenda = Convert.ToInt32(txtid.Text); int respuesta = ventana.EliminarAgenda(a); if (respuesta > 0) { MessageBox.Show("Eliminado con Exito!!"); } else { MessageBox.Show("Ha ocurrido un error!"); } }
private void button3_Click(object sender, EventArgs e) { agendar a = new agendar(); a.detalle = txtdetalle.Text; a.id_grupo = Convert.ToInt32(comboestados.SelectedValue); a.id_agenda = Convert.ToInt32(txtid.Text); int respuesta = ventana.ActulizarAgenda(a); if (respuesta > 0) { MessageBox.Show("Actualizado con Exito!!"); } else { MessageBox.Show("Ha ocurrido un error!"); } }
private void buttoningresar_Click(object sender, EventArgs e) { usuario_agenda u = new usuario_agenda(); u.idusuario_creador = Convert.ToInt32(txtusuarioagenda.Text); u.idusuario_ejecutor = Convert.ToInt32(comboejecutor.SelectedValue); u.idusuario_responsable = Convert.ToInt32(comboresponsable.SelectedValue); u.fecha_inicio = label5.Text; u.fecha_fin = label6.Text; int respuesta = ventana.Agregar(u); if (respuesta > 0) { agendar a = new agendar(); a.id_trabajo = Convert.ToInt32(combotrabajo.SelectedValue); a.detalle = textdetalle.Text; a.id_servicio = Convert.ToInt32(comboservicio.SelectedValue); a.id_departamento = Convert.ToInt32(combodepartamento.SelectedValue); a.id_zona = Convert.ToInt32(combozona.SelectedValue); a.id_grupo = Convert.ToInt32(combogrupo.SelectedValue); a.id_estado = Convert.ToInt32(comboestado.SelectedValue); int resultado = ventana.AgregarAgenda(a); if (resultado > 0) { MessageBox.Show("Ingresado con exito"); } else { MessageBox.Show("Error al Agendar Ventana"); } } else { MessageBox.Show("Error Al Elegir Usuarios Involucrados"); } }