public static void ShowAll(string nameOfTable)
    {
        Medicine.Open();
        var sqlReader = GetAll(nameOfTable).ExecuteReader();

        if (sqlReader.HasRows)
        {
            while (sqlReader.HasRows && sqlReader.Read())
            {
                ConsoleEx.Write($" ID: {sqlReader["ID"]}. ", ConsoleColor.Magenta);
                Console.WriteLine(
                    $"{sqlReader["Name"].ToString().PadRight(15)} " +
                    $"|{sqlReader["Manufacturer"].ToString().PadRight(20)} " +
                    $"| Price: {sqlReader["Price"].ToString().PadRight(6)} " +
                    $"| Amount: {sqlReader["Amount"].ToString().PadRight(6)} " +
                    $"| Needs Prescription: {sqlReader["WithPrescription"]}");
            }
        }
        else
        {
            ConsoleEx.WriteLine("There are no entries", ConsoleColor.Red);
        }
        Medicine.Close();
        Console.ReadLine();
    }
    public void Save(Medicine med)
    {
        Medicine.Open();

        try
        {
            var sqlCommand = new SqlCommand();
            sqlCommand.Connection  = connection;
            sqlCommand.CommandText =
                @"INSERT INTO Medicines (Name, Manufacturer, Price, Amount, WithPrescription)
			                             VALUES (@Name, @Manufacturer, @Price, @Amount, @WithPrescription);"            ;

            var sqlNameParam = new SqlParameter();
            sqlNameParam.DbType        = System.Data.DbType.AnsiString;
            sqlNameParam.Value         = med.Name;
            sqlNameParam.ParameterName = "@Name";
            sqlCommand.Parameters.Add(sqlNameParam);

            var sqlManufacturerParam = new SqlParameter();
            sqlManufacturerParam.DbType        = System.Data.DbType.AnsiString;
            sqlManufacturerParam.Value         = med.Manufacturer;
            sqlManufacturerParam.ParameterName = "@Manufacturer";
            sqlCommand.Parameters.Add(sqlManufacturerParam);

            var sqlPriceParam = new SqlParameter();
            sqlPriceParam.DbType        = System.Data.DbType.Decimal;
            sqlPriceParam.Value         = med.Price;
            sqlPriceParam.ParameterName = "@Price";
            sqlCommand.Parameters.Add(sqlPriceParam);

            var sqlAmountParam = new SqlParameter();
            sqlAmountParam.DbType        = System.Data.DbType.Int32;
            sqlAmountParam.Value         = med.Amount;
            sqlAmountParam.ParameterName = "@Amount";
            sqlCommand.Parameters.Add(sqlAmountParam);

            var sqlWithPrescriptionParam = new SqlParameter();
            sqlWithPrescriptionParam.DbType        = System.Data.DbType.Boolean;
            sqlWithPrescriptionParam.Value         = med.WithPrescription;
            sqlWithPrescriptionParam.ParameterName = "@WithPrescription";
            sqlCommand.Parameters.Add(sqlWithPrescriptionParam);

            sqlCommand.ExecuteNonQuery();
            Console.WriteLine();
            ConsoleEx.WriteLine("Medicine added succesfully!", ConsoleColor.Green);
            Console.ReadLine();
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
            Console.ReadLine();
            throw;
        }
        Medicine.Close();
    }
 public static void RemoveMedicine()
 {
     Medicine.ShowAll("Medicines");
     try
     {
         Console.WriteLine("Choose ID of the entry you want to remove:");
         string id = Console.ReadLine();
         DoesEntryExists(id, "Medicines", "");
         Medicine.Open();
         Medicine.Remove(id, "Medicines", "ID");
         ConsoleEx.WriteLine("Successfully removed", ConsoleColor.Green);
         Console.ReadLine();
     }
     catch (Exception e)
     {
         ConsoleEx.WriteLine("The remove action wasn't succesful.", ConsoleColor.Red);
         Console.WriteLine(e);
         Console.ReadLine();
     }
     Medicine.Close();
     Medicine.Options();
 }