Exemplo n.º 1
0
 private void BtnAceptarPieza_Click(object sender, EventArgs e)
 {
     if (piezasTbxEncargar.Text == "")
     {
         MessageBox.Show("PIEZA NO ENCARGADA POR CAMPOS VACIOS.", "PIEZA NO ENCARGADA", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         DBConnectio.Connection conexion = new DBConnectio.Connection();
         conexion.AbrirConexion();
         DateTime fecha_pedida             = DateTime.Now;
         DateTime fecha_llegada_aproximada = SdtCalendarFechaLlegada.Value;
         int      IdPieza = conexion.generarId("SELECT MAX(Id) FROM Pieza");
         bool     si      = conexion.AddElements("INSERT INTO Pieza VALUES(" + IdPieza + ",'" + piezasTbxEncargar.Text + "','Ordenada','" + fecha_pedida + "','" + fecha_llegada_aproximada + "')", "pieza");
         conexion.CerrarConexion();
         if (si)
         {
             MessageBox.Show("SE AH ENCARGADO LA PIEZA CORRECTAMENTE.", "PIEZA ENCARGADA", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.Hide();
         }
         else
         {
             MessageBox.Show("PIEZA NO ENCARGADA POR PROBLEMAS DE CONECTIVIDAD.", "PIEZA NO ENCARGADA", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemplo n.º 2
0
 private void SbtnAceptarNuevoServicio_Click(object sender, System.EventArgs e)
 {
     if ((StxtNombreNuevoServicio.Text == "") || (StxtPrecioNuevoServicio.Text == ""))
     {
         MessageBox.Show("NO SE PUEDE AGREGAR NUEVO SERVICIO POR LA EXITENCIA DE CAMPOS VACIOS", "CAMPOS INVALIDOS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         DBConnectio.Connection connection = new DBConnectio.Connection();
         connection.AbrirConexion();
         int    idServicio = connection.generarId("SELECT MAX(Id) FROM Servicio");
         String query      = "INSERT INTO Servicio (Id,Nombre,Precio,Actividad) VALUES (" + idServicio + ",'" + StxtNombreNuevoServicio.Text + "'," + StxtPrecioNuevoServicio.Text + ",'" + StxtActividadNuevoServicio.Text + "')";
         connection.AddElements(query, "servicio");
         DialogResult result = MessageBox.Show("DESEA AGREGAR UN NUEVO SERVICIO?", "SERVICIOS", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             StxtNombreNuevoServicio.Text    = "";
             StxtPrecioNuevoServicio.Text    = "";
             StxtActividadNuevoServicio.Text = "";
         }
         else if (result == DialogResult.No)
         {
             this.Hide();
         }
         connection.CerrarConexion();
     }
 }