MikesBookStore/.vs/MikesBookStore/v16/.suo
MikesBookStore/MikesBookStore.sln
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30611.23
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MikesBookStore", "MikesBookStore\MikesBookStore.csproj", "{BD1A90E8-C6B0-4987-BE8C-64599B30CA5D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BD1A90E8-C6B0-4987-BE8C-64599B30CA5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD1A90E8-C6B0-4987-BE8C-64599B30CA5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD1A90E8-C6B0-4987-BE8C-64599B30CA5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD1A90E8-C6B0-4987-BE8C-64599B30CA5D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {56E96AC5-5121-45EF-A16D-D66DB26E14D6}
EndGlobalSection
EndGlobal
MikesBookStore/MikesBookStore/App.config
MikesBookStore/MikesBookStore
in/Debug/MikesBookStore.exe
MikesBookStore/MikesBookStore
in/Debug/MikesBookStore.exe.config
MikesBookStore/MikesBookStore
in/Debug/MikesBookStore.pd
MikesBookStore/MikesBookStore/Book.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MikesBookStore
{
class Book
{
private string bookSelection;
private string bookName;
private double price;
private string comment;
public string BookSelection { get => bookSelection; set => bookSelection = value; }
public string BookName { get => bookName; set => bookName = value; }
public double Price { get => price; set => price = value; }
public string Comment { get => comment; set => comment = value; }
public string ToString()
{
return bookName + "," + price;
}
}
}
MikesBookStore/MikesBookStore/Form1.cs
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 MikesBookStore
{
public partial class Form1 : Form
{
List
bookList = new List();
List shoppingList = new List();
public Form1()
{
InitializeComponent();
label14.Text = "The time of day "+ DateTime.Now.ToString("dd/mm/yyyy hh:mm:ss tt");
loadData();
}
private void loadData()
{
Book b1 = new Book();
b1.BookSelection = "Programming";
b1.BookName = "VISUAL BASIC";
b1.Price = 55.00;
b1.Comment = "";
Book b2 = new Book();
b2.BookSelection = "Programming";
b2.BookName = "JAVA";
b2.Price = 85.00;
b2.Comment = "";
Book b3 = new Book();
b3.BookSelection = "Programming";
b3.BookName = "C#";
b3.Price = 95.00;
b3.Comment = "";
Book b4 = new Book();
b4.BookSelection = "Networking";
b4.BookName = "LAN Networks";
b4.Price = 155.00;
b4.Comment = "";
Book b5 = new Book();
b5.BookSelection = "Networking";
b5.BookName = "Windows Networking";
b5.Price = 120.00;
b5.Comment = "";
Book b6 = new Book();
b6.BookSelection = "Networking";
b6.BookName = "More about Networking";
b6.Price = 100.00;
b6.Comment = "";
Book b7 = new Book();
b7.BookSelection = "Web";
b7.BookName = "HTML";
b7.Price = 85.00;
b7.Comment = "";
Book b8 = new Book();
b8.BookSelection = "Web";
b8.BookName = "CSS";
b8.Price = 65.00;
b8.Comment = "";
Book b9 = new Book();
b9.BookSelection = "Web";
b9.BookName = "JavaScript";
b9.Price = 45.00;
b9.Comment = "";
bookList.Add(b1); bookList.Add(b2); bookList.Add(b3);
bookList.Add(b4); bookList.Add(b5); bookList.Add(b6);
bookList.Add(b7); bookList.Add(b8); bookList.Add(b9);
}
private void groupBox2_Enter(object sender, EventArgs e)
{
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
string check = comboBox1.SelectedItem.ToString();
label6.Text = "0.00";
if(check.Equals("Programming"))
{
listBox1.Items.Clear();
listBox1.Items.Add("VISUAL BASIC");
listBox1.Items.Add("JAVA");
listBox1.Items.Add("C#");
string path = @"..\\..\\images\\programming.jpg";
pictureBox1.Image = System.Drawing.Image.FromFile(path);
pictureBox2.Image = null;
picPictureBox.Image = ProjectName.Properties.Resources.FileName
}
else if(check.Equals("Networking"))
{
listBox1.Items.Clear();
listBox1.Items.Add("LAN Networks");
listBox1.Items.Add("Windows Networking");
listBox1.Items.Add("More about Networking");
string path = @"..\\..\\images\\networking.jpg";
pictureBox1.Image = System.Drawing.Image.FromFile(path);
pictureBox2.Image = null;
}
else if(check.Equals("Web"))
{
listBox1.Items.Clear();
listBox1.Items.Add("HTML");
listBox1.Items.Add("CSS");
listBox1.Items.Add("JavaScript");
string path = @"..\\..\\images\\web.jpg";
pictureBox1.Image = System.Drawing.Image.FromFile(path);
pictureBox2.Image = null;
}
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
string ch = listBox1.SelectedItem.ToString();
if (ch.Equals("VISUAL BASIC"))
{
string path = @"..\\..\\images\\visual.jpg";
pictureBox2.Image = System.Drawing.Image.FromFile(path);
label6.Text = "55.00";
}
else if (ch.Equals("JAVA"))
{
string path = @"..\\..\\images\\java.jpg";
pictureBox2.Image = System.Drawing.Image.FromFile(path);
label6.Text = "85.00";
}
else if (ch.Equals("C#"))
{
string path = @"..\\..\\images\\c#.jpg";
pictureBox2.Image = System.Drawing.Image.FromFile(path);
label6.Text = "95.00";
}
else if (ch.Equals("LAN Networks"))
{
string path = @"..\\..\\images\\lan.jpg";
pictureBox2.Image = System.Drawing.Image.FromFile(path);
label6.Text = "155.00";
}
else if (ch.Equals("Windows Networking"))
{
string path = @"..\\..\\images\\windows.jpg";
pictureBox2.Image = System.Drawing.Image.FromFile(path);
label6.Text = "120.00";
}
else if (ch.Equals("More about Networking"))
{
string path = @"..\\..\\images\\more.jpg";
pictureBox2.Image = System.Drawing.Image.FromFile(path);
label6.Text = "100.00";
}
else if (ch.Equals("HTML"))
{
string path = @"..\\..\\images\\html.jpg";
pictureBox2.Image = System.Drawing.Image.FromFile(path);
label6.Text = "85.00";
}
else if (ch.Equals("CSS"))
{
string path = @"..\\..\\images\\css.png";
pictureBox2.Image = System.Drawing.Image.FromFile(path);
label6.Text = "65.00";
}
else if (ch.Equals("JavaScript"))
{
string path = @"..\\..\\images\\javascript.jpg";
pictureBox2.Image = System.Drawing.Image.FromFile(path);
label6.Text = "45.00";
}
}
private void button3_Click(object sender, EventArgs e)
{
int index = listBox1.SelectedIndex;
if(index >= 0)
{
if(shoppingList.Count == 0)
{
Book bk = null;
foreach(Book b in bookList)
{
if(b.BookName.Equals(listBox1.SelectedItem.ToString()))
{
bk = b;
eak;
}
}
if(bk != null)
{
shoppingList.Add(bk);
comboBox2.Items.Add(bk.BookName);
double price = Double.Parse(label8.Text);
price = price + bk.Price;
label8.Text = price + "";
}
}
else
{
int ch = 0;
foreach(Book b in shoppingList)
{
if(b.BookName.Equals(listBox1.SelectedItem.ToString()))
{
ch = 1;
eak;
}
}
if (ch == 1)
{
MessageBox.Show("The discount applys to one book only","Warning");
}
else
{
Book bk = null;
foreach (Book b in bookList)
{
if (b.BookName.Equals(listBox1.SelectedItem.ToString()))
{
bk = b;
eak;
}
}
if (bk != null)
{
shoppingList.Add(bk);
comboBox2.Items.Add(bk.BookName);
double price = Double.Parse(label8.Text);
price = price + bk.Price;
label8.Text = price + "";
}
}
}
}
}
private void button4_Click(object sender, EventArgs e)
{
int index = comboBox2.SelectedIndex;
if(index >= 0)
{
string ch = comboBox2.SelectedItem.ToString();
int i = 0;
Book bk = null;
foreach (Book b in shoppingList)
{
if (b.BookName.Equals(ch))
{
i = 1;
bk = b;
eak;
}
}
if(i == 1)
{
shoppingList.Remove(bk);
comboBox2.Items.Remove(ch);
comboBox2.Text = "Thanks for Shopping";
double price = Double.Parse(label8.Text);
price = price - bk.Price;
label8.Text = price + "";
}
}
else
{
MessageBox.Show("Nothing to remove", "Warning");
}
}
private void button5_Click(object sender, EventArgs e)
{
shoppingList.Clear();
comboBox2.Items.Clear();
label8.Text = "0.0";
}
private void button6_Click(object sender, EventArgs e)
{
DialogResult dialogResult = MessageBox.Show("If you continue, the sales will be final", "Warning", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
if(shoppingList.Count == 0)
{
MessageBox.Show("Nothing in your basket");
}
else
{
listView1.Columns.Add("Book Name", 300, HorizontalAlignment.Left);
listView1.Columns.Add("Book Price", 70, HorizontalAlignment.Left);
double price = 0.0;
foreach (Book bk in shoppingList)
{
listView1.Items.Add(bk.ToString());
price = price + bk.Price;
}
label13.Text = "$" + price;
}
}
else if (dialogResult == DialogResult.No)
{
}
}
private void button9_Click(object sender, EventArgs e)
{
string name = textBox2.Text;
string title = textBox3.Text;
string desc = richTextBox1.Text;
if(name.Length == 0 || title.Length == 0 || desc.Length == 0)
{
MessageBox.Show("Fill all fields");
}
else
{
MessageBox.Show("Comments added");
}
}
private void button10_Click(object sender, EventArgs e)
{
textBox2.Text = "";
textBox3.Text = "";
richTextBox1.Text = "";
}
private void button7_Click(object sender, EventArgs e)
{
pictureBox1.Image = null;
pictureBox2.Image = null;
shoppingList.Clear();
comboBox2.Items.Clear();
label8.Text = "0.0";
label6.Text = "0.0";
listBox1.Items.Clear();
label13.Text = "0.00";
}
private void button8_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = "";
maskedTextBox1.Text = "";
}
private void button1_Click(object sender, EventArgs e)
{
string name = textBox1.Text;
string phone = maskedTextBox1.Text;
if(name.Length == 0 || phone.Length == 0)
{
MessageBox.Show("Fill all fields");
}
else
{
MessageBox.Show("Login Successfully");
}
}
}
}
MikesBookStore/MikesBookStore/Form1.Designer.cs
namespace MikesBookStore
{
partial class Form1
{
Required designer variable.
summary
private System.ComponentModel.IContainer components = null;
Clean up any resources being used.
summary
true if managed resources should be disposed; otherwise, false.
param
protected ove
ide void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
Required method for Designer support - do not modify
the contents of this method with the code editor.
summary
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.maskedTextBox1 = new System.Windows.Forms.MaskedTextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.listBox1 = new System.Windows.Forms.ListBox();
this.label4 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.button5 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.button8 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.listView1 = new System.Windows.Forms.ListView();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.button10 = new...