Example #1
0
        protected void Fnt_GuardarDetalleVenta()
        {
            CLConexion conn = new CLConexion();
            SqlCommand com  = new SqlCommand("SP_DetalleVenta", conn.connection);

            com.CommandType = CommandType.StoredProcedure;
            conn.connection.Open();
            try
            {
                foreach (DataGridViewRow row in DTtabla.Rows)
                {
                    com.Parameters.Clear();
                    com.Parameters.AddWithValue("@codigoCompra", codigoCompra);
                    com.Parameters.AddWithValue("@producto", Convert.ToString(row.Cells["Codigo"].Value));
                    com.Parameters.AddWithValue("@precio", float.Parse(Convert.ToString(row.Cells["Precio"].Value)));
                    com.Parameters.AddWithValue("@cantidad", Convert.ToString(row.Cells["Cantidad"].Value));
                    com.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex);
            }
            finally {
                conn.connection.Close();
            }
        }
Example #2
0
        protected void Fnt_buscarProducto()
        {
            CLConexion conn = new CLConexion();
            SqlCommand com  = new SqlCommand("SP_BuscarXcodigo", conn.connection);

            com.CommandType = CommandType.StoredProcedure;
            com.Parameters.AddWithValue("@code", code);
            conn.connection.Open();
            SqlDataReader lector = com.ExecuteReader();
            int           conta  = 0;

            if (lector.Read() == true)
            {
                sw = 1;
                while (conta < tabla.Length)
                {
                    tabla[conta] = Convert.ToString(lector[conta]);
                    conta++;
                }
            }
            else
            {
                sw = 0;
            }
            conn.connection.Close();
        }
        protected void Fnt_buscarProducto()
        {
            CLConexion conn = new CLConexion();
            SqlCommand com  = new SqlCommand("SP_BuscarProductoxNombre", conn.connection);

            com.CommandType = CommandType.StoredProcedure;
            com.Parameters.AddWithValue("@nombre", nombre);
            conn.connection.Open();
            SqlDataAdapter data = new SqlDataAdapter(com);

            data.Fill(tabla);
            conn.connection.Close();
        }
Example #4
0
        protected void Fnt_GuardarCompra()
        {
            CLConexion conn = new CLConexion();
            SqlCommand com  = new SqlCommand("SP_NuevaCompra", conn.connection);

            com.CommandType = CommandType.StoredProcedure;
            com.Parameters.AddWithValue("@Cliente", cliente);
            com.Parameters.AddWithValue("@valor", valor);
            com.Parameters.AddWithValue("@usuario", "jean123");
            conn.connection.Open();
            SqlDataReader lector = com.ExecuteReader();

            if (lector.Read() == true)
            {
                codigoCompra = Convert.ToString(lector[0]);
            }
            conn.connection.Close();
            Fnt_GuardarDetalleVenta();
        }
Example #5
0
        protected void Fnt_CargarClienteData()
        {
            CLConexion conn = new CLConexion();
            SqlCommand com  = new SqlCommand("SP_CargarClientes", conn.connection);

            com.CommandType = CommandType.StoredProcedure;
            com.Parameters.AddWithValue("@documento", cliente);
            conn.connection.Open();
            SqlDataReader lector = com.ExecuteReader();

            if (lector.Read() == true)
            {
                sw     = 1;
                nombre = Convert.ToString(lector[0]);
            }
            else
            {
                sw = 0;
            }
            conn.connection.Close();
        }