public bool updateBuyed(BuyedProductsModel product)
        {
            string        query = "UPDATE buyedProducts SET idProduct = @idProduct, priceBuy = @priceBuy, quantity = @quantity WHERE id = @id";
            SqlConnection conn  = new SqlConnection(cadena);
            SqlCommand    cmd   = new SqlCommand(query, conn);

            try
            {
                conn.Open();
                cmd.Parameters.Add("@id", System.Data.SqlDbType.Int).Value         = product.id;
                cmd.Parameters.Add("@idProduct", System.Data.SqlDbType.Int).Value  = product.idProduct;
                cmd.Parameters.Add("@priceBuy", System.Data.SqlDbType.Money).Value = product.priceBuy;
                cmd.Parameters.Add("@quantity", System.Data.SqlDbType.Int).Value   = product.quantity;

                int register = cmd.ExecuteNonQuery();

                return(register == 1);
            }
            catch (Exception)
            {
                return(false);
            }
            finally
            {
                conn.Close();
            }
        }
        public BuyedProductsModel returnBuyed(int id)
        {
            string             query   = "SELECT idProduct, priceBuy, quantity FROM buyedProducts WHERE id = @id";
            SqlConnection      conn    = new SqlConnection(cadena);
            SqlCommand         cmd     = new SqlCommand(query, conn);
            BuyedProductsModel product = new BuyedProductsModel();


            try
            {
                conn.Open();
                cmd.Parameters.Add("@id", System.Data.SqlDbType.Int).Value = id;
                SqlDataReader dr = cmd.ExecuteReader();


                if (dr.Read())
                {
                    product.idProduct = dr.GetInt32(0);
                    product.priceBuy  = dr.GetDecimal(1);
                    product.quantity  = dr.GetInt32(2);
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                conn.Close();
            }
            return(product);
        }
        public bool createBuyed(BuyedProductsModel product)
        {
            string        query = "INSERT INTO buyedProducts VALUES (@idProduct,@priceBuy,@quantity,GETDATE())";
            SqlConnection conn  = new SqlConnection(cadena);
            SqlCommand    cmd   = new SqlCommand(query, conn);

            try
            {
                conn.Open();
                cmd.Parameters.Add("@idProduct", System.Data.SqlDbType.Int).Value  = product.idProduct;
                cmd.Parameters.Add("@priceBuy", System.Data.SqlDbType.Money).Value = product.priceBuy;
                cmd.Parameters.Add("@quantity", System.Data.SqlDbType.Int).Value   = product.quantity;

                int register = cmd.ExecuteNonQuery();
                return(register == 1);
            }
            catch (Exception)
            {
                return(false);
            }
            finally
            {
                conn.Close();
            }
        }