-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.cs
111 lines (84 loc) · 3.03 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
using static System.Net.Mime.MediaTypeNames;
namespace BillingDasboard
{
public partial class Form1 : Form
{
int teaCount=0;
int teasum = 0;
int elaichiCount = 0;
int elaichisum = 0;
int maggieCount = 0;
int maggiesum = 0;
int coffeeCount = 0;
int coffeesum = 0;
string sum="";
int totalsum=0;
public Form1()
{
InitializeComponent();
}
public void button1_Click(object sender, EventArgs e)
{
teaCount++;
teasum = teaCount * 10;
string[] row = { tea.Text, teaCount.ToString(), teasum.ToString()};
var listViewItem = new ListViewItem(row);
listItem.Items.Add(listViewItem);
}
private void listItem_SelectedIndexChanged(object sender, EventArgs e)
{
listItem.View = View.Details;
listItem.GridLines = true;
listItem.FullRowSelect = true;
}
public void elaichi_Click(object sender, EventArgs e)
{
elaichiCount++;
elaichisum = elaichiCount * 15;
string[] row = { elaichi.Text, elaichiCount.ToString(), elaichisum.ToString() };
var listViewItem = new ListViewItem(row);
if (!listItem.Items.Contains(listViewItem))
{
listItem.Items.Clear();
listItem.Items.Add(listViewItem);
}
}
public void maggie_Click(object sender, EventArgs e)
{
maggieCount++;
maggiesum = maggieCount * 20;
listItem.Items.Clear();
string[] row = { maggie.Text, maggieCount.ToString(), maggiesum.ToString() };
var listViewItem = new ListViewItem(row);
listItem.Items.Add(listViewItem);
}
public void coffee_Click(object sender, EventArgs e)
{
int ccount=coffeeCount++;
coffeesum = coffeeCount * 12;
listItem.Items.Clear();
string[] row = { coffee.Text, coffeeCount.ToString(), coffeesum.ToString() };
var listViewItem = new ListViewItem(row);
listItem.Items.Add(listViewItem);
// listItem.Items[coffee.Text].Remove();
// listItem.Items.Remove(listViewItem);
}
private void totalAmount_TextChanged(object sender, EventArgs e)
{
int totalsum = this.coffeesum + this.teasum + this.maggiesum + this.elaichisum;
sum=totalsum.ToString();
totalAmount.Text=sum;
}
private void print_Click(object sender, EventArgs e)
{
MessageBox.Show("Total Bill= Rs."+this.sum+"\nYour Bill Is Printed Successfully!");
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void reset_Click(object sender, EventArgs e)
{
listItem.Clear();
}
}
}