Skip to content

Commit

Permalink
Merge pull request #12 from DiracSpace/v0.3.2
Browse files Browse the repository at this point in the history
Updated to dotnet 5.0
  • Loading branch information
DiracSpace authored Jun 8, 2021
2 parents 7623111 + 530b398 commit 1cf7305
Show file tree
Hide file tree
Showing 48 changed files with 225 additions and 347 deletions.
Binary file removed .vs/NutriAdvice/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file modified .vs/NutriAdvice/v16/.suo
Binary file not shown.
20 changes: 7 additions & 13 deletions Classes/Ingredient.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NutriAdvice.Classes
namespace NutriAdvice.Classes
{
public class Ingredient
{
Expand All @@ -26,32 +20,32 @@ public Ingredient(string name, string quantity, string amount)
this.amount = amount;
}

public string getName()
public string GetName()
{
return name;
}

public void setName(string name)
public void SetName(string name)
{
this.name = name;
}

public string getQuantity()
public string GetQuantity()
{
return quantity;
}

public void setQuantity(string quantity)
public void SetQuantity(string quantity)
{
this.quantity = quantity;
}

public string getAmount()
public string GetAmount()
{
return amount;
}

public void setAmount(string amount)
public void SetAmount(string amount)
{
this.amount = amount;
}
Expand Down
28 changes: 12 additions & 16 deletions Classes/Recipe.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace NutriAdvice.Classes
{
Expand All @@ -11,7 +7,7 @@ public class Recipe
private string name;
private string link;
private string calories;
private List<Ingredient> ingredientsList = new List<Ingredient>();
private readonly List<Ingredient> ingredientsList = new();

public Recipe()
{
Expand All @@ -29,52 +25,52 @@ public Recipe(string name, string link, string calories)
ingredientsList.Clear();
}

public string getName()
public string GetName()
{
return name;
}

public void setName(string name)
public void SetName(string name)
{
this.name = name;
}

public string getLink()
public string GetLink()
{
return link;
}

public void setLink(string link)
public void SetLink(string link)
{
this.link = link;
}

public string getCalories()
public string GetCalories()
{
return calories;
}

public void setCalories(string calories)
public void SetCalories(string calories)
{
this.calories = calories;
}

public Ingredient getIngredient(int indice)
public Ingredient GetIngredient(int indice)
{
return ingredientsList[indice];
}

public void addIngredient(string name, string quantity, string amount)
public void AddIngredient(string name, string quantity, string amount)
{
ingredientsList.Add(new Ingredient(name,quantity,amount));
}

public List<Ingredient> getIngredientList()
public List<Ingredient> GetIngredientList()
{
return ingredientsList;
}

public void cleanIngredientList()
public void CleanIngredientList()
{
ingredientsList.Clear();
}
Expand Down
11 changes: 1 addition & 10 deletions Forms/Form1.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
using NutriAdvice.Classes;
using NutriAdvice.Forms;
using System.Windows.Forms;
using NutriAdvice.Modules;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace NutriAdvice
{
Expand Down
12 changes: 6 additions & 6 deletions Forms/Form2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public Form2(List<Recipe> RecipeList, int index)

public void GetRecipeIngredientData()
{
DisplayRecipeLink.Text = LocalRecipeList[location].getName().ToString();
for (int j = 0; j < LocalRecipeList[location].getIngredientList().Count; j++)
DisplayRecipeLink.Text = LocalRecipeList[location].GetName().ToString();
for (int j = 0; j < LocalRecipeList[location].GetIngredientList().Count; j++)
{
dgvDisplayRecipeIngredients.Rows.Add(
LocalRecipeList[location].getIngredientList()[j].getName(),
LocalRecipeList[location].getIngredientList()[j].getAmount(),
LocalRecipeList[location].getIngredientList()[j].getQuantity()
LocalRecipeList[location].GetIngredientList()[j].GetName(),
LocalRecipeList[location].GetIngredientList()[j].GetAmount(),
LocalRecipeList[location].GetIngredientList()[j].GetQuantity()
);
RecipeWebsiteLink = LocalRecipeList[location].getLink();
RecipeWebsiteLink = LocalRecipeList[location].GetLink();
}
}

Expand Down
2 changes: 1 addition & 1 deletion Modules/ConsultPrologAndDisplayResultModule.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 19 additions & 21 deletions Modules/ConsultPrologAndDisplayResultModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ namespace NutriAdvice.Modules
{
public partial class ConsultPrologAndDisplayResultModule : UserControl
{
public List<Recipe> RecipeList = new List<Recipe>();
public Recipe receta = new Recipe();
public List<Recipe> RecipeList = new();
public Recipe receta = new();

private string userDietAction;
public string UserDietAction
Expand Down Expand Up @@ -54,13 +54,13 @@ public void ConsultProlog()
if (!File.Exists(filename))
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\NutriAdvice-Expert-System\Prolog\";
System.IO.FileInfo file = new System.IO.FileInfo(path);
FileInfo file = new(path);
file.Directory.Create();
MessageBox.Show("No se encontró archivo, descargando .. ");
using (WebClient wc = new WebClient())
using (WebClient wc = new())
{
wc.DownloadFileAsync(
new System.Uri("https://raw.githubusercontent.com/DiracSpace/NutriAdvice-Expert-System/main/Prolog/Recipes_List.pl"),
new Uri("https://raw.githubusercontent.com/DiracSpace/NutriAdvice-Expert-System/main/Prolog/Recipes_List.pl"),
filename
);
}
Expand All @@ -80,37 +80,37 @@ public void ConsultProlog()
{
nombreReceta = solutions[i][0].Value;

receta.setName(solutions[i][0].Value);
receta.setCalories(solutions[i][1].Value);
receta.setLink(solutions[i][2].Value);
receta.SetName(solutions[i][0].Value);
receta.SetCalories(solutions[i][1].Value);
receta.SetLink(solutions[i][2].Value);

receta.addIngredient(solutions[i][3].Value, solutions[i][4].Value, solutions[i][5].Value);
receta.AddIngredient(solutions[i][3].Value, solutions[i][4].Value, solutions[i][5].Value);
}
else
{
if(nombreReceta.Equals(solutions[i][0].Value))
{
receta.addIngredient(solutions[i][3].Value, solutions[i][4].Value, solutions[i][5].Value);
receta.AddIngredient(solutions[i][3].Value, solutions[i][4].Value, solutions[i][5].Value);
}
else
{
RecipeList.Add(receta);
receta = new Recipe();
nombreReceta = solutions[i][0].Value;
receta.setName(solutions[i][0].Value);
receta.setCalories(solutions[i][1].Value);
receta.setLink(solutions[i][2].Value);
receta.SetName(solutions[i][0].Value);
receta.SetCalories(solutions[i][1].Value);
receta.SetLink(solutions[i][2].Value);

receta.addIngredient(solutions[i][3].Value, solutions[i][4].Value, solutions[i][5].Value);
receta.AddIngredient(solutions[i][3].Value, solutions[i][4].Value, solutions[i][5].Value);
}
}
}

for (int i = 0; i < RecipeList.Count; i++)
{
if (RecipeList[i].getName() != "" && RecipeList[i].getCalories() != "")
if (RecipeList[i].GetName() != "" && RecipeList[i].GetCalories() != "")
{
dgvDisplayRecipes.Rows.Add(RecipeList[i].getName(), RecipeList[i].getCalories());
dgvDisplayRecipes.Rows.Add(RecipeList[i].GetName(), RecipeList[i].GetCalories());
}
}
}
Expand All @@ -120,11 +120,9 @@ public ConsultPrologAndDisplayResultModule()
InitializeComponent();
}

private void dgvDisplayRecipes_CellClick(object sender, EventArgs e)
{
//MessageBox.Show(dgvDisplayRecipes.CurrentCell.RowIndex.ToString());

Form2 showData = new Form2(RecipeList, dgvDisplayRecipes.CurrentCell.RowIndex);
private void DgvDisplayRecipes_CellClick(object sender, EventArgs e)
{
Form2 showData = new(RecipeList, dgvDisplayRecipes.CurrentCell.RowIndex);
showData.GetRecipeIngredientData();
showData.Show();
}
Expand Down
4 changes: 3 additions & 1 deletion NutriAdvice.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
</PropertyGroup>

<ItemGroup>
<Folder Include="Evidence\" />
<Compile Remove="Evidence\**" />
<EmbeddedResource Remove="Evidence\**" />
<None Remove="Evidence\**" />
</ItemGroup>

<ItemGroup>
Expand Down
Binary file modified bin/Debug/net5.0-windows/NutriAdvice.dll
Binary file not shown.
Binary file modified bin/Debug/net5.0-windows/NutriAdvice.exe
Binary file not shown.
Binary file modified bin/Debug/net5.0-windows/NutriAdvice.pdb
Binary file not shown.
4 changes: 2 additions & 2 deletions bin/Debug/net5.0-windows/NutriAdvice.runtimeconfig.dev.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\Marco\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\Marco\\.nuget\\packages"
"C:\\Users\\jsonr\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\jsonr\\.nuget\\packages"
]
}
}
Binary file modified bin/Debug/net5.0-windows/ref/NutriAdvice.dll
Binary file not shown.
10 changes: 5 additions & 5 deletions obj/Debug/net5.0-windows/NutriAdvice.AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Este código fue generado por una herramienta.
// Versión de runtime:4.0.30319.42000
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
// se vuelve a generar el código.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

Expand All @@ -21,5 +21,5 @@
[assembly: System.Runtime.Versioning.TargetPlatformAttribute("Windows7.0")]
[assembly: System.Runtime.Versioning.SupportedOSPlatformAttribute("Windows7.0")]

// Generado por la clase WriteCodeFragment de MSBuild.
// Generated by the MSBuild WriteCodeFragment class.

Binary file modified obj/Debug/net5.0-windows/NutriAdvice.assets.cache
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8ce9551170b1e702608bd4cc140a5922d54aec25
8b35b192f874d2ced7474d8ea31817d91d98d652
Loading

0 comments on commit 1cf7305

Please sign in to comment.