private void button1_Click(object sender, EventArgs e) { if (data.users[textBox1.Text].password == textBox2.Text) { StreamWriter sw = new StreamWriter("users.txt"); foreach (KeyValuePair <string, User> entry in data.users) { sw.WriteLine(entry.Value.name + ',' + entry.Value.password + ',' + entry.Value.address + ',' + entry.Value.email); } sw.Close(); data.user = textBox1.Text; this.Hide(); mainmenu m = new mainmenu(); m.Show(); } else { MessageBox.Show("Username or Password is wrong"); } }
private void cartt_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); dt.Columns.Add("name"); dt.Columns.Add("price"); dt.Columns.Add("color"); dt.Columns.Add("brand"); int price = 0; foreach (var i in data.cart) { dt.Rows.Add(data.b.item[i].name, data.b.item[i].price, data.b.item[i].color, data.b.item[i].brand); price += data.b.item[i].price; data.b.item[i].numOforders++; data.b.item[i].quantity--; } dataGridView1.DataSource = dt; label1.Text = price+""; //MessageBox.Show("Thank You, Confirmed!"); mainmenu m = new mainmenu(); m.Show(); this.Hide(); }