private void setDistribucion() { Ent_Distribucion ent = new Ent_Distribucion(); ent.fecha = dtFecha.Value.ToShortDateString(); ent.hora = dtHora.Value.ToShortTimeString(); ent.destino = txtDestino.Text; ent.encargado = txtEncargado.Text; ent.detalle = txtDetalle.Text; string result = BL_Programacion.setDistribucion(ent); if (result == "1") { MessageBox.Show("¡Distribución programada exitosamente!", "Programar Distribución", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("¡Ocurrió un error al programar distribución!\n" + result, "Programar Distribución", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static string setDistribucion(Ent_Distribucion distribucion) { con = Conexion.getConnection(); MySqlCommand cmd = new MySqlCommand(); con.Open(); cmd.Connection = con; cmd.CommandText = "SP_SYS_SET_DISTRIBUCION"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@RETVAL", MySqlDbType.VarChar); cmd.Parameters["@RETVAL"].Direction = ParameterDirection.Output; cmd.Parameters.AddWithValue("@FECHA", distribucion.fecha); cmd.Parameters["@FECHA"].Direction = ParameterDirection.Input; cmd.Parameters.AddWithValue("@HORA", distribucion.hora); cmd.Parameters["@HORA"].Direction = ParameterDirection.Input; cmd.Parameters.AddWithValue("@DESTINO", distribucion.destino); cmd.Parameters["@DESTINO"].Direction = ParameterDirection.Input; cmd.Parameters.AddWithValue("@ENCARGADO", distribucion.encargado); cmd.Parameters["@ENCARGADO"].Direction = ParameterDirection.Input; cmd.Parameters.AddWithValue("@DETALLE", distribucion.detalle); cmd.Parameters["@DETALLE"].Direction = ParameterDirection.Input; cmd.ExecuteNonQuery(); string retval = cmd.Parameters["@RETVAL"].Value.ToString(); con.Close(); return(retval); }
/* * public static string setMantenimiento(Ent_Mantenimiento mantenimiento) * { * return DAO_Mantenimiento.setMantenimiento(mantenimiento); * } */ public static string setDistribucion(Ent_Distribucion distribucion) { return(DAO_Distribucion.setDistribucion(distribucion)); }