public List <SingleUseProduct> SearchAvailableSingleUseProducts(string name)
        {
            List <SingleUseProduct> products = new List <SingleUseProduct>();

            try
            {
                con.Open();
            }
            catch { }
            string command = "SELECT * FROM disposable_products WHERE quantity<>0 " +
                             "AND name like\"%" + name + "%\"";
            MySqlCommand    cmd = new MySqlCommand(command, con);
            MySqlDataReader rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                SingleUseProduct product = new SingleUseProduct(rdr.GetInt32(0), rdr.GetString(1), rdr.GetInt32(2), rdr.GetInt32(3));
                products.Add(product);
            }

            rdr.Close();
            con.Close();

            return(products);
        }
        public void AddSingleUseProductToVisit(SingleUseProduct product, int?id_v)
        {
            try
            {
                con.Open();
            }
            catch { }
            string command = "INSERT dproductvisit " +
                             "(id_v,id_dp,quantity)  " +
                             "VALUES " +
                             "(" + id_v + "," + product.ID + "," + product.SuggestedConsumption + ")";
            MySqlCommand cmd = new MySqlCommand(command, con);

            cmd.ExecuteReader();
            con.Close();
        }
        //Funckje dodające nowy produkt do inwentarza
        public void AddSingleUseProduct(SingleUseProduct product)
        {
            string name  = product.Name;
            int    count = product.Count;
            double price = product.Price;

            try
            {
                con.Open();
            }
            catch { }
            string          command = "INSERT INTO disposable_products(name, quantity, price) VALUES('" + name + "','" + count + "','" + price.ToString(CultureInfo.InvariantCulture) + "')";
            MySqlCommand    cmd     = new MySqlCommand(command, con);
            MySqlDataReader rdr     = cmd.ExecuteReader();

            con.Close();
        }
 //Funkcja auktualniająca ilość produktu w bazie danych
 public void UpdateProductCount(SingleUseProduct product, int newCount)
 {
     try
     {
         con.Open();
     }
     catch { }
     if (product is Product)
     {
         string          command = "UPDATE products set quantity_item=" + newCount.ToString() + " Where id_p=" + product.ID.ToString();
         MySqlCommand    cmd     = new MySqlCommand(command, con);
         MySqlDataReader rdr     = cmd.ExecuteReader();
         rdr.Close();
     }
     else if (product is SingleUseProduct)
     {
         string          command = "UPDATE disposable_products set quantity=" + newCount.ToString() + " Where id_dp=" + product.ID.ToString();
         MySqlCommand    cmd     = new MySqlCommand(command, con);
         MySqlDataReader rdr     = cmd.ExecuteReader();
         rdr.Close();
     }
     con.Close();
 }
 public bool ProductExists(SingleUseProduct product)
 {
     return(ProductExists(product.Name));
 }
 private void GetSingleUseProduct(SingleUseProduct product)
 {
     SingleUseProducts.Add(product);
     OnPropertyChanged(nameof(SingleUseProducts));
     ChangeView?.Invoke("ViewServiceDone", false);
 }
 //Komunikacja podformularzy z tym formularzem (przekaz danych)
 private void GetProduct(SingleUseProduct product)
 {
     Products.Add(product as Product);
     OnPropertyChanged(nameof(Products));
     ChangeView?.Invoke("ViewDeliveryAdd", false);
 }