private void button1_Click(object sender, RoutedEventArgs e) { try { if (TBFName.Text == "") { lbDisplay.Content = "First name box is eympty please enter correct info"; } else if (TBLName.Text == "") { lbDisplay.Content = "Last name box is eympty please enter correct info"; } else if (TBMID.Text == "") { lbDisplay.Content = "Major ID box is eympty please enter correct info"; } else if (TBEmail.Text == "") { lbDisplay.Content = "E-mail box is eympty please enter correct info"; } else if (TBAddress.Text == "") { lbDisplay.Content = "Address box is eympty please enter correct info"; } else if (TBPhone.Text == "") { lbDisplay.Content = "Phone number box is eympty please enter correct info"; } else { lbDisplay.Content = ""; MessageBox.Show("E-Mail has been sent to the board to be checked over."); TBFName.Clear(); TBLName.Clear(); TBMID.Clear(); TBEmail.Clear(); TBAddress.Clear(); TBPhone.Clear(); } } catch { } }
private void TBPhone_Click(object sender, EventArgs e) { TBPhone.Clear(); }
private void BTRegister_Click(object sender, EventArgs e) { SQLiteConnection con = new SQLiteConnection(@"data source = C:\Users\Kutay\Desktop\RepairShop.db"); string query = @"insert into Employee (Name,Surname,Email,Password,Phone) values(@Name,@Surname,@Email,@Password,@Phone)"; SQLiteCommand cmd = new SQLiteCommand(query, con); if ((TBName.Text.Trim() != "" && TBName.Text.Trim() != "Ad") && (TBSurname.Text.Trim() != "" && TBSurname.Text.Trim() != "Soyad") && (TBMail.Text.Trim() != "" && TBMail.Text.Trim() != "Mail") && (TBPassword.Text.Trim() != "" && TBPassword.Text.Trim() != "Password") && (TBPhone.Text.Trim() != "" && TBPhone.Text.Trim() != "Telefon") && (TBConfirm.Text.Trim() != "" && TBConfirm.Text.Trim() != "Confirmation Code")) { SQLiteCommand cm = new SQLiteCommand("Select Conf from Confirmation", con); con.Open(); SQLiteDataReader dr = cm.ExecuteReader(); int i = 0; while (dr.Read()) { a = dr.GetString(0); ConfCode.Add(a); } dr.Close(); con.Close(); if (!ConfCode.ToArray().Contains <string>(TBConfirm.Text.Trim())) { lblMsg.ForeColor = Color.DarkRed; lblMsg.Text = "Wrong Conf. Code"; } else { cmd.Parameters.Add(new SQLiteParameter("@Name", TBName.Text.Trim())); cmd.Parameters.Add(new SQLiteParameter("@Surname", TBSurname.Text.Trim())); cmd.Parameters.Add(new SQLiteParameter("@Email", TBMail.Text.Trim())); cmd.Parameters.Add(new SQLiteParameter("@Password", TBPassword.Text.Trim())); cmd.Parameters.Add(new SQLiteParameter("@Phone", TBPhone.Text.Trim())); con.Open(); cmd.ExecuteNonQuery(); TBName.Clear(); TBSurname.Clear(); TBMail.Clear(); TBPassword.Clear(); TBPhone.Clear(); lblMsg.ForeColor = Color.DarkGreen; lblMsg.Text = "Succesfull Registration"; } } else { lblMsg.ForeColor = Color.DarkRed; lblMsg.Text = "Please fill all areas."; } }