// check Availability of items public string Available(KITBOX_project.Item item, string table) { connection.Open(); int stock; string code_item = item.Code(); command.CommandText = "SELECT * FROM " + table + " WHERE code = " + code_item; command.CommandType = CommandType.Text; OleDbDataReader reader = command.ExecuteReader(); while (reader.Read()) { stock = Convert.ToInt32(reader["Enstock"].ToString()); if (stock > 0) { available = "Yes"; } else { available = "No"; } } connection.Close(); return(available); }
//price of items public string printPrice(KITBOX_project.Item item, string table) { connection.Open(); string code_item = item.Code(); command.CommandText = "SELECT * FROM " + table + " WHERE code = " + code_item; command.CommandType = CommandType.Text; OleDbDataReader reader = command.ExecuteReader(); while (reader.Read()) { prix_unitaire = reader["PrixClient"].ToString(); } connection.Close(); return(prix_unitaire); }