-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddQuote.cs
106 lines (84 loc) · 2.51 KB
/
AddQuote.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
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 Megadesk_1._0
{
public partial class AddQuote : Form
{
public AddQuote()
{
InitializeComponent();
}
private void MainMenu_Click(object sender, EventArgs e)
{
MainMenu main = new MainMenu();
this.Close();
main.Show();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void NameInput_TextChanged(object sender, EventArgs e)
{
}
private void label4_Click(object sender, EventArgs e)
{
}
private void label4_Click_1(object sender, EventArgs e)
{
}
private void DepthInput_ValueChanged(object sender, EventArgs e)
{
}
private void WidthInput_Validating(object sender, CancelEventArgs e)
{
int input = Convert.ToInt32(WidthInput.Text);
if (input <= 12 || input >= 48) // When the inputted value is out of range. . .
{
WidthInput.ForeColor = Color.Red;
WidthInput.Focus();
}
else
{
WidthInput.ForeColor = Color.Black;
}
}
private void DepthInput_Validation(object sender, KeyPressEventArgs e)
{
{
char input = e.KeyChar;
if (Char.IsControl(input) == true || Char.IsDigit(input) == false)
{
DepthInput.ForeColor = Color.Red;
}
else
{
DepthInput.ForeColor = Color.Black;
}
}
}
private void SubmitQuoteButton_Click(object sender, EventArgs e)
{
this.Hide();
int price = 200;
price += Convert.ToInt32(50 * NumberOfDrawersInput.Value);
//Create new desk with all data gotten so far
int area = Convert.ToInt32(DepthInput.Text) * Convert.ToInt32(WidthInput.Text);
if(area > 1000)
{
price += (area - 1000);
}
DisplayQuote displayQuote = new DisplayQuote(price);
displayQuote.Show();
}
}
}