private void resgiterButton_Click(object sender, EventArgs e) { string name = nameTextBox.Text; string email = emailTextBox.Text; string password = passwordTextBox.Text; string phone = phoneTextBox.Text; if (name != "" && email != "" && password != "" && phone != "") { server.usersParent user = new server.usersParent(); user = myserver.getUserBYEmail(email); if (user == null) { myserver.addUser(name, email, password, phone); Main homeControl = new Main(); // ADD HO GYA KA SUCCESS MESSAGE SHOW KARE OnregisteredSuccess(); } else { errorAlreadyExists.Show(); // PEHLE SE USER MOJOOD HAI KA ERROR SHOW KARE } } else { // ERROR SHOW KARWAE KE BHAE JAN FIELDS TO PEHLE SARI FIL KARO errorRequiredFields.Show(); } }
private void loginButton_Click(object sender, EventArgs e) { server.Service1 myServer = new server.Service1(); server.usersParent user = new server.usersParent(); string email = emailTxtBox.Text; user = myServer.getUserBYEmail(email); if (user != null) { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress("*****@*****.**"); mail.To.Add(email); mail.Subject = "Forgotten Password (Foodies)"; mail.Body = "Hello, " + user.Name + " You Have Requested For a Forgotten Password. Your Password is " + user.Password; SmtpServer.Port = 587; SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "downloadism.com"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); MessageBox.Show("Password Mailed To Your Inbox"); } else { MessageBox.Show("User Don't Exists In Our System"); } }
private void loginButton_Click(object sender, EventArgs e) { string email = emailTxtBox.Text; string password = passTxtBox.Text; if (email != "" && password != "") { server.Service1 myServer = new server.Service1(); server.usersParent user = new server.usersParent(); user = myServer.getUserBYEmail(email); myUtil.loggedIN = user; if (user != null) { if (user.Password == password) { // SUCCESS MESSAGE --> LOGIN SUCCESSFULY if (user.UserRole == "Admin") { OnAdminLogin(); } else if (user.UserRole == "User") { OnUserLogin(); } } else { // ERROR MESSAGE --> LOGIN UNSUCCESSFULL errorInccorectDetails.Show(); } } else { // ERROR MESSAGE --> USER NOT EXISTS errorInccorectDetails.Show(); } } else { // FILL IN ALL THE REQUIRED FIELDS errorRequiredFields.Show(); } }