________________________________________________________________________________________________________________________________
Welcome Screen
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 Programming2_Finals
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btn_form1_register_Click(object sender, EventArgs e)
{
RegWindow registerwindow = new RegWindow();
registerwindow.Show();
this.Hide();
}
private void btn_form1_login_Click(object sender, EventArgs e)
{
LogWindow loginwindow = new LogWindow();
loginwindow.Show();
this.Hide();
}
}
}
________________________________________________________________________________________________________________________________
Register Form
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 Programming2_Finals
{
public partial class RegWindow : Form
{
Boolean regwindow_regbutton = false;
public RegWindow()
{
InitializeComponent();
}
private void btn_regwindow_login_Click(object sender, EventArgs e)
{
LogWindow loginwindow = new LogWindow();
loginwindow.Show();
this.Hide();
}
private void btn_regwindow_register_Click(object sender, EventArgs e)
{
regwindow_regbutton = true;
string firstname = "";
string lastname = "";
string username = "";
string password1 = "";
string password2 = "";
if (tbox_regwindow_username.Text != "" && tbox_regwindow_firstname.Text != "" && tbox_regwindow_lastname.Text != "" && tbox_regwindow_password1.Text != "" && tbox_regwindow_password2.Text != "")
{
if (regwindow_regbutton == true)
{
firstname = tbox_regwindow_firstname.Text;
lastname = tbox_regwindow_lastname.Text;
username = tbox_regwindow_username.Text;
password1 = tbox_regwindow_password1.Text;
password2 = tbox_regwindow_password2.Text;
if (password1 == password2)
{
string[] usersdata = { "First Name:" + firstname, "Last Name:" + lastname, "Username:" + username, "Password:" + password1, "Password:" + password2 };
System.IO.File.WriteAllLines(@"C:\Users\emata\Desktop\Prog2Finals\Data\" + firstname + ".txt", usersdata);
MessageBox.Show("Hello " + firstname + ", you may now Login with your Username and Password", "REGISTERED");
string usersusername = tbox_regwindow_username.Text;
string userspassword = tbox_regwindow_password1.Text;
System.IO.File.WriteAllText(@"C:\Users\emata\Desktop\Prog2Finals\Users\Username\Username.txt", usersusername);
System.IO.File.WriteAllText(@"C:\Users\emata\Desktop\Prog2Finals\Users\Password\Password.txt", userspassword);
}
else
{
MessageBox.Show("Password does not match!", "PASSWORD ERROR");
}
}
else
{
MessageBox.Show("Please fill up all forms", "ERROR");
}
}
}
private void tbox_regwindow_firstname_TextChanged(object sender, EventArgs e)
{
}
private void RegWindow_Load(object sender, EventArgs e)
{
}
}
}
________________________________________________________________________________________________________________________________
Login Screen
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 Programming2_Finals
{
public partial class LogWindow : Form
{
public LogWindow()
{
InitializeComponent();
}
private void btn_logwindow_login_Click(object sender, EventArgs e)
{
string username = System.IO.File.ReadAllText(@"C:\Users\emata\Desktop\Prog2Finals\Users\Username\Username.txt");
string password = System.IO.File.ReadAllText(@"C:\Users\emata\Desktop\Prog2Finals\Users\Password\Password.txt");
if (tbox_logwindow_username.Text == username && tbox_logwindow_password.Text == password)
{
ItemWindow itemswindow = new ItemWindow();
itemswindow.Show();
this.Hide();
}
else
{
if (tbox_logwindow_username.Text != username && tbox_logwindow_password.Text != password)
{
MessageBox.Show("Username and Password does not exist!", "LOGIN ERROR");
}
else if (tbox_logwindow_password.Text != password)
{
MessageBox.Show("Invalid Password!", "LOGIN ERROR");
}
else if(tbox_logwindow_username.Text != username)
{
MessageBox.Show("Invalid Username", "LOGIN ERROR");
}
}
}
private void btn_logwindow_register_Click(object sender, EventArgs e)
{
RegWindow regwindow = new RegWindow();
regwindow.Show();
this.Hide();
}
private void LogWindow_Load(object sender, EventArgs e)
{
}
}
}
________________________________________________________________________________________________________________________________
Order
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 Programming2_Finals
{
public partial class ItemWindow : Form
{
Boolean chickenmeals = false;
Boolean drinks = false;
Boolean burgers = false;
Boolean addons = false;
Boolean pasta = false;
Boolean condiments = false;
int next = 1;
string quantityfood = "";
string typefood = "";
string choicefood = "";
public ItemWindow()
{
InitializeComponent();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (cbo_foods.Text == "Chicken Meals")
{
chickenmeals = true;
drinks = false;
burgers = false;
addons = false;
pasta = false;
condiments = false;
next = 1;
cbo_type.Items.Add("Regular");
cbo_type.Items.Add("Spicy");
}
else if (cbo_foods.Text == "Drinks")
{
chickenmeals = false;
drinks = true;
burgers = false;
addons = false;
pasta = false;
condiments = false;
next = 1;
cbo_type.Items.Add("Regular");
cbo_type.Items.Add("1.5L");
cbo_type.Items.Add("In Can");
}
else if (cbo_foods.Text == "Burgers")
{
chickenmeals = false;
drinks = false;
burgers = true;
addons = false;
pasta = false;
condiments = false;
next = 1;
cbo_type.Items.Clear();
}
else if (cbo_foods.Text == "Add Ons")
{
chickenmeals = false;
drinks = false;
burgers = false;
addons = true;
pasta = false;
condiments = false;
next = 1;
cbo_type.Items.Clear();
}
else if (cbo_foods.Text == "Pasta")
{
chickenmeals = false;
drinks = false;
burgers = false;
addons = false;
pasta = true;
condiments = false;
next = 1;
cbo_type.Items.Clear();
}
else if (cbo_foods.Text == "Condiments")
{
chickenmeals = false;
drinks = false;
burgers = false;
addons = false;
pasta = false;
condiments = true;
next = 1;
cbo_type.Items.Clear();
}
}
private void btn_next_Click(object sender, EventArgs e)
{
if (chickenmeals == true)
{
if (next == 1)
{
picbox_pic.Image = Properties.Resources.BucketMeal;
next = 2;
}
else if (next == 2)
{
picbox_pic.Image = Properties.Resources.Chicken;
}
}
else if (drinks == true)
{
if (next == 1)
{
picbox_pic.Image = Properties.Resources._7up;
next = 2;
}
else if (next == 2)
{
picbox_pic.Image = Properties.Resources.Coke;
next = 3;
}
else if (next == 3)
{
picbox_pic.Image = Properties.Resources.Pepsi;
next = 4;
}
else if (next == 4)
{
picbox_pic.Image = Properties.Resources.RootBeer;
next = 5;
}
else if (next == 5)
{
picbox_pic.Image = Properties.Resources.Sprite;
}
}
else if (burgers == true)
{
if (next == 1)
{
picbox_pic.Image = Programming2_Finals.Properties.Resources.Burger;
}
}
else if (addons == true)
{
if (next == 1)
{
picbox_pic.Image = Properties.Resources.GarlicBread;
next = 2;
}
else if (next == 2)
{
picbox_pic.Image = Properties.Resources.Macaroni;
next = 3;
}
else if (next == 3)
{
picbox_pic.Image = Properties.Resources.MashedPotatoes;
next = 4;
}
else if (next == 4)
{
picbox_pic.Image = Properties.Resources.Rice;
next = 5;
}
else if (next == 5)
{
picbox_pic.Image = Properties.Resources.Hotdog;
}
else if (pasta == true)
{
if (next == 1)
{
picbox_pic.Image = Properties.Resources.Carbonara;
next = 2;
}
else if (next == 2)
{
picbox_pic.Image = Properties.Resources.Spaghetti;
}
}
else if (condiments == true)
{
if (next == 1)
{
picbox_pic.Image = Properties.Resources.Gravy;
next = 2;
}
else if (next == 2)
{
picbox_pic.Image = Properties.Resources.Catsup;
next = 3;
}
else if (next == 3)
{
picbox_pic.Image = Properties.Resources.Mayonnaise;
}
}
}
}
private void btn_previous_Click(object sender, EventArgs e)
{
if (chickenmeals == true)
{
if (next == 1)
{
picbox_pic.Image = Properties.Resources.BucketMeal;
}
else if (next == 2)
{
picbox_pic.Image = Properties.Resources.Chicken;
next = 1;
}
}
else if (drinks == true)
{
if (next == 1)
{
picbox_pic.Image = Properties.Resources._7up;
}
else if (next == 2)
{
picbox_pic.Image = Properties.Resources.Coke;
next = 1;
}
else if (next == 3)
{
picbox_pic.Image = Properties.Resources.Pepsi;
next = 2;
}
else if (next == 4)
{
picbox_pic.Image = Properties.Resources.RootBeer;
next = 3;
}
else if (next == 5)
{
picbox_pic.Image = Properties.Resources.Sprite;
next = 4;
}
}
else if (burgers == true)
{
if (next == 1)
{
picbox_pic.Image = Programming2_Finals.Properties.Resources.Burger;
}
}
else if (addons == true)
{
if (next == 1)
{
picbox_pic.Image = Properties.Resources.GarlicBread;
}
else if (next == 2)
{
picbox_pic.Image = Properties.Resources.Macaroni;
next = 1;
}
else if (next == 3)
{
picbox_pic.Image = Properties.Resources.MashedPotatoes;
next = 2;
}
else if (next == 4)
{
picbox_pic.Image = Properties.Resources.Rice;
next = 3;
}
else if (next == 5)
{
picbox_pic.Image = Properties.Resources.Hotdog;
next = 4;
}
}
else if (pasta == true)
{
if (next == 1)
{
picbox_pic.Image = Properties.Resources.Carbonara;
}
else if (next == 2)
{
picbox_pic.Image = Properties.Resources.Spaghetti;
next = 1;
}
}
else if (condiments == true)
{
if (next == 1)
{
picbox_pic.Image = Properties.Resources.Gravy;
}
else if (next == 2)
{
picbox_pic.Image = Properties.Resources.Catsup;
next = 1;
}
else if (next == 3)
{
picbox_pic.Image = Properties.Resources.Mayonnaise;
next = 2;
}
}
}
private void cbo_type_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void cbo_qty_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void btn_add_Click(object sender, EventArgs e)
{
/*if (pic1 == picbox_pic.Image)
{
choicefood = "Bucket Meal";
}*/
quantityfood = cbo_qty.Text;
typefood = cbo_type.Text;
DialogResult dialogResult = MessageBox.Show("Do you want to add this to your cart?", "Add Items", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
lbox_menu.Items.Add(quantityfood + typefood + choicefood);
}
else if (dialogResult == DialogResult.No)
{
}
}
private void ItemWindow_Load(object sender, EventArgs e)
{
}
}
}
________________________________________________________________________________________________________________________________
Name: Marc Angelo S. Emata
Course: BSIT - 1
Birthday: Aug 31, 1997
Favorite Programming Language: C# & Python
Hi there! My name is Marc. I know how to use Python(for personal use), C#(for school related),
JavaFX(for making games related) and C++(I know how to read them but not to code).
At the moment, I'm trying to understand how to use Java because my friend needs this in his exam.
WHAT I HATE THE MOST IS HTML! IF GIVEN A CHANCE?
I'D RATHER IGNORE THAT SUBJECT. REALLY!
WHY? WELL AT FIRST, I DON'T SEE ANY LOGIC THERE.
IN C#, I CAN PLAY AROUND BUT IN HTML? IT'S JUST THE END-USERS THAT MATTERS! OH HEY! IT'S ME :)
No comments:
Post a Comment