Exemplo n.º 1
0
 // Accion del boton de Aceptar, guarda la informacion en la BD y muestra el ticket
 protected void Unnamed2_Click(object sender, EventArgs e)
 {
     // Checa si el Total de venta es mayor a "0"
     if (Convert.ToInt32(txtTaP.Text) > 0)
     {
         ConexionMySQL conexion = new ConexionMySQL(data);
         try
         {
             string          Query   = "INSERT INTO lavanderia.ventas(cantidadCargaLigera, totalCargaLigera,cantidadCargaPesada, totalCargaPesada,cantidadPlanchado, totalPlanchado,totalVenta) VALUES(" + Convert.ToInt32(txtCCL.Text) + "," + Convert.ToDouble(txtTCL.Text) + "," + Convert.ToInt32(txtCCP.Text) + "," + Convert.ToDouble(txtTCP.Text) + "," + Convert.ToInt32(txtCP.Text) + "," + Convert.ToDouble(txtTP.Text) + "," + Convert.ToDouble(txtTaP.Text) + ");";
             MySqlDataReader adapter = conexion.conexionSendData(Query);
             while (adapter.Read())
             {
             }
             conexion.conexionClose();
             // Guarda las cantidades y totales de: Carga Ligera, Carga Pesada y Planchado, para enviarlas al ticket.
             Session["CCL"] = txtCCL.Text;
             Session["TCL"] = txtTCL.Text;
             Session["CCP"] = txtCCP.Text;
             Session["TCP"] = txtTCP.Text;
             Session["CP"]  = txtCP.Text;
             Session["TP"]  = txtTP.Text;
             Session["TaP"] = txtTaP.Text;
             // Redireccion al ticket, hasta este momento el ticket es solo informativo ya que se realizo la venta
             // y se guardo en la BD de forma correcta
             Response.Redirect("Ticket.aspx");
         }
         catch (Exception ex)
         {
         }
     }
     else
     {
     }
 }
Exemplo n.º 2
0
        // Carga de los combobox, se llenan con las prendas.
        private void cargarPrendas()
        {
            ConexionMySQL conexion = new ConexionMySQL(data);

            try
            {
                string           Query   = "SELECT * FROM lavanderia.prendas;";
                MySqlDataAdapter adapter = conexion.conexionGetData(Query);
                DataTable        datos   = new DataTable();
                adapter.Fill(datos);
                conexion.conexionClose();

                cmbPrendas1.Items.Clear();
                cmbPrendas2.Items.Clear();
                cmbPrendas3.Items.Clear();

                foreach (DataRow row in datos.Rows)
                {
                    cmbPrendas1.Items.Add(row["nombrePrenda"].ToString());
                    cmbPrendas2.Items.Add(row["nombrePrenda"].ToString());
                    cmbPrendas3.Items.Add(row["nombrePrenda"].ToString());
                }

                cmbPrendas1.SelectedIndex = 0;
                cmbPrendas2.SelectedIndex = 0;
                cmbPrendas3.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 3
0
        private bool checarConexion()
        {
            ConexionMySQL conexion = new ConexionMySQL(data);
            DataTable     datosRow = new DataTable();

            try
            {
                string           Query   = "SELECT COUNT(*) FROM lavanderia.servicios;";
                MySqlDataAdapter adapter = conexion.conexionGetData(Query);
                adapter.Fill(datosRow);
                if (datosRow.Rows.Count >= 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                conexion.conexionClose();
            }
        }