-
Notifications
You must be signed in to change notification settings - Fork 1
/
newlaundry.cs
60 lines (54 loc) · 2.12 KB
/
newlaundry.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace quicklaundry
{
public partial class newlaundry : Form
{
public newlaundry()
{
InitializeComponent();
}
private void newlaundry__Click(object sender, EventArgs e)
{
decimal total = (250*jeans_.Value)+(150*wool_.Value)+(70*nass_.Value)+(300*towel_.Value)+(250*bedsheet_.Value)+(50*small_.Value)+(150*native_.Value)+(100*cotton_.Value);
MessageBox.Show("Successfully added! Total amount is "+total,"Add New Laundry",MessageBoxButtons.OKCancel);
string conn = "datasource=127.0.0.1;port=3306;username=root;password=lizzy2000;database=quicklaundry";
string query = "INSERT INTO newlaundry VALUES('"+login.user+"',"+jeans_.Value+","+wool_.Value+","+cotton_.Value+","+native_.Value+","+towel_.Value+","+bedsheet_.Value+","+nass_.Value+","+small_.Value+",'"+time_.Value +"','"+address_.Text+"',"+total+"); INSERT INTO laundry (username,bill) VALUES('"+login.user+"',"+total+");" ;
MySqlConnection connect = new MySqlConnection(conn);
MySqlCommand go = new MySqlCommand(query, connect);
go.CommandTimeout = 60;
MySqlDataReader reader;
try
{
connect.Open();
reader = go.ExecuteReader();
connect.Close();
foreach (Form oForm in Application.OpenForms)
{
if (oForm is profile)
{
oForm.Hide();
break;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message,"Error");
}
profile newuserlog = new profile();
newuserlog.Show();
this.Close();
}
private void newlaundry_Load(object sender, EventArgs e)
{
}
}
}