コード例 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            Bodega Regresar = new Bodega();

            Regresar.Show();
            this.Hide();
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Conexion conex = new Conexion();
            string   salida;

            if (String.IsNullOrEmpty(txtNomProducto.Text) | String.IsNullOrEmpty(txtNum.Text) | String.IsNullOrEmpty(txtCodigo.Text) | String.IsNullOrEmpty(txtDescripcion.Text) | String.IsNullOrEmpty(txtPrecio.Text) | String.IsNullOrEmpty(txtCantidad.Text))
            {
                MessageBox.Show("Falta llenar ciertos campos", "Mensaje");
            }
            else
            {
                if (comboBox1.SelectedIndex == 0 && Convert.ToInt32(txtCantidad.Text) > 1)
                {
                    MessageBox.Show("Error Solo puede ingresar una copiadora");
                    txtCantidad.Text = "";
                    txtCantidad.Focus();
                }
                else
                {
                    try
                    {
                        conex.nuevoProducto((comboBox1.SelectedIndex + 1), txtNomProducto, txtCodigo, txtDescripcion, txtPrecio, txtCantidad);
                        conex.obtenerLastID(obtenerIdProducto);
                        conex.insertarIdSerie(obtenerIdProducto, txtNum.Text);
                        //id = Convert.ToInt16(conex.retornar_id());
                        //  conex.insertar_serie();
                        salida = "Datos Insertados Correctamente";
                    }
                    catch (Exception ex)
                    {
                        salida = "Error: Datos no insertados " + ex.ToString();
                    }

                    MessageBox.Show(salida);
                    Bodega Regresar = new Bodega();

                    Regresar.Show();
                    this.Hide();
                }
            }
        }
コード例 #3
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtNomProducto.Text) | String.IsNullOrEmpty(txtNum.Text) | String.IsNullOrEmpty(txtCodigo.Text) | String.IsNullOrEmpty(txtDescripcion.Text) | String.IsNullOrEmpty(txtPrecio.Text) | String.IsNullOrEmpty(txtCantidad.Text))
            {
                MessageBox.Show("Falta llenar ciertos campos", "Mensaje");
            }

            else
            {
                if (comboBox1.SelectedIndex == 0 && Convert.ToInt32(txtCantidad.Text) > 1)
                {
                    MessageBox.Show("Error Solo puede ingresar una copiadora");
                    txtCantidad.Text = "";
                    txtCantidad.Focus();
                }
                else
                {
                    Conexion conex = new Conexion();
                    string   salida;
                    try
                    {
                        conex.COMANDOSQL = new SqlCommand("update Producto  set  [ID_Categoria] = " + Convert.ToInt16(comboBox1.SelectedIndex + 1) + ", [ID_Estado] =  " + Convert.ToInt16(comboBox2.SelectedIndex + 1) + ", [Codigo_Barra] = '" + txtCodigo.Text + "', [Nombre_Producto] = '" + txtNomProducto.Text + "', [Descripcion_Producto] = '" + txtDescripcion.Text + "' ,[Cantidad] = '" + txtCantidad.Text + "', [Precio] ='" + txtPrecio.Text + "' where[ID_Producto] = '" + textBox1.Text + "'", conex.CONECTARSQL);
                        conex.COMANDOSQL.ExecuteNonQuery();
                        conex.COMANDOSQL = new SqlCommand("update Inventario_Serie  set [Serie] = " + txtNum.Text + " where[ID_Producto] = " + textBox1.Text + "", conex.CONECTARSQL);
                        conex.COMANDOSQL.ExecuteNonQuery();
                        salida = "Datos insertados correctamente";
                    }
                    catch (Exception ex)
                    {
                        salida = "Error: Datos no insertados " + ex.ToString();
                    }

                    MessageBox.Show(salida);

                    Bodega Regresar = new Bodega();

                    Regresar.Show();
                    this.Hide();
                }
            }
        }
コード例 #4
0
 private void btnIngresar_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(TxtUsuario.Text) | String.IsNullOrEmpty(TxtContraseña.Text))
     {
         MessageBox.Show("USUARIO O CONTRASEÑA ESTAN VACIOS", "Mensaje");
         TxtUsuario.Clear();
         TxtContraseña.Clear();
     }
     else
     {
         if (conexion.obtenerUsuarioExiste(TxtUsuario.Text) == false)
         {
             MessageBox.Show("EL USUARIO NO EXISTE ,INGRESE UNO CORRECTO", "Msj");
             TxtUsuario.Clear();
             TxtContraseña.Clear();
         }
         else
         {
             conexion.obtenerIntentosErroneos(txtIntentosErrores, TxtUsuario);
             int contadorErroresIngresar = Convert.ToInt32(txtIntentosErrores.Text);
             if (contadorErroresIngresar == 3)
             {
                 conexion.actualizarUsuarioBloqueado(TxtUsuario.Text);
                 MessageBox.Show("ESTE USUARIO ESTA BLOQUEADO POR SOBREPASAR EL LIMITE DE INTENTOS PARA INGRESAR", "Msj");
                 TxtUsuario.Clear();
                 TxtContraseña.Clear();
             }
             else
             {
                 if (conexion.Autentificar(TxtUsuario.Text) > 0)
                 {
                     conexion.LlenarContraUsuario(TxtIdRol, TxtUsuario, txtIdEstado);
                     if (conexion.Autentificar(TxtUsuario.Text, TxtContraseña.Text) > 0)
                     {
                         if (Convert.ToInt32(txtIdEstado.Text) == 3)
                         {
                             MessageBox.Show("DEBES CAMBIAR LA CONTRASEÑA", "Msj");
                             NuevaContraseñaUsuarios contraUsuarios = new NuevaContraseñaUsuarios();
                             String user = TxtUsuario.Text;
                             contraUsuarios.txtUsuarioRecuContraseña.Text = user;
                             contraUsuarios.Show();
                             this.Hide();
                         }
                         else
                         {
                             MessageBox.Show("BIENVENIDO", "Mensaje");
                             if (Convert.ToInt32(TxtIdRol.Text) == 1)
                             {
                                 FormGerente gere = new FormGerente();
                                 gere.Show();
                                 this.Hide();
                             }
                             /////////////////////Cajero2  cajero
                             else if (Convert.ToInt32(TxtIdRol.Text) == 2)
                             {
                                 Cajero ser = new Cajero();
                                 ser.Show();
                                 this.Hide();
                             }
                             //////////////////////
                             else if (Convert.ToInt32(TxtIdRol.Text) == 3)
                             {
                                 Servicio_Tecnico ser = new Servicio_Tecnico();
                                 ser.Show();
                                 this.Hide();
                             }
                             else if (Convert.ToInt32(TxtIdRol.Text) == 4)
                             {
                                 Bodega bdg = new Bodega();
                                 bdg.Show();
                                 this.Hide();
                             }
                         }
                     }
                     else
                     {
                         if (TxtIdRol.Text != "1")
                         {
                             MessageBox.Show("NO SE PUEDE INGRESAR", "mensaje");
                             contadorErroresIngresar++;
                             txtIntentosErrores.Text = Convert.ToString(contadorErroresIngresar);
                             conexion.actualizarErrores(txtIntentosErrores, TxtUsuario);
                             TxtUsuario.Clear();
                             TxtContraseña.Clear();
                         }
                         else
                         {
                             MessageBox.Show("NO SE PUEDE INGRESAR", "mensaje");
                             TxtUsuario.Clear();
                             TxtContraseña.Clear();
                         }
                     }
                 }
             }
         }
     }
 }