-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Evan Langlais
authored and
Evan Langlais
committed
Mar 30, 2017
1 parent
1791d37
commit a47c482
Showing
6 changed files
with
251 additions
and
279 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using MySql.Data.MySqlClient; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace EnigmaX.Classes | ||
{ | ||
|
||
public enum MenuItemType { appitizer, entre, dessert, drink, other }; | ||
public enum PrintingStationType { hot, cold }; | ||
|
||
public class EnigmaMenuItem | ||
{ | ||
|
||
private int _id = 0; | ||
private string _title = ""; | ||
private string _description = ""; | ||
private float _price; | ||
private MenuItemType _itemType; | ||
private PrintingStationType _printingType; | ||
|
||
public EnigmaMenuItem(int id, string title, string description, float price, MenuItemType itemType, PrintingStationType printingType) { | ||
_id = id; | ||
_title = title; | ||
_description = description; | ||
_price = price; | ||
_itemType = itemType; | ||
_printingType = printingType; | ||
} | ||
|
||
public string Title { | ||
get { | ||
return _title; | ||
} | ||
set { | ||
_title = value; | ||
} | ||
} | ||
|
||
public static EnigmaMenuItem idToMenuItem(int id) | ||
{ | ||
DBConnect db = new DBConnect(); | ||
MySqlCommand conn = new MySqlCommand("SELECT * FROM MenuItems WHERE id = @id LIMIT 1"); | ||
conn.Parameters.AddWithValue("@id", id.ToString()); | ||
List<Dictionary<string, string>> result = db.ReadCommand(conn, "title", "title", "description", "price", "category", "printingStation"); | ||
if (result.Count > 0) | ||
{ | ||
return new EnigmaMenuItem(id, result[0]["title"], result[0]["description"], float.Parse(result[0]["price"]), (MenuItemType)Enum.Parse(typeof(MenuItemType), result[0]["category"]), (PrintingStationType)Enum.Parse(typeof(PrintingStationType), result[0]["printingStation"])); | ||
} | ||
else | ||
{ | ||
return null; | ||
} | ||
} | ||
|
||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters