コード例 #1
0
        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);
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        //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();
        }
コード例 #4
0
 //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();
 }
コード例 #5
0
 public bool ProductExists(SingleUseProduct product)
 {
     return(ProductExists(product.Name));
 }
コード例 #6
0
 private void GetSingleUseProduct(SingleUseProduct product)
 {
     SingleUseProducts.Add(product);
     OnPropertyChanged(nameof(SingleUseProducts));
     ChangeView?.Invoke("ViewServiceDone", false);
 }
コード例 #7
0
 //Komunikacja podformularzy z tym formularzem (przekaz danych)
 private void GetProduct(SingleUseProduct product)
 {
     Products.Add(product as Product);
     OnPropertyChanged(nameof(Products));
     ChangeView?.Invoke("ViewDeliveryAdd", false);
 }