private void sendEmail_Click(object sender, EventArgs e) { try { if (Email.Text == "" || Email.Text == "Email") { label1.Text = "Please, enter an email !"; } else { if (!(Email.Text.Contains("@") && Email.Text.Contains(".com"))) { label1.Text = "Please, enter a correct email!"; label1.ForeColor = Color.Red; } else { if (sellerService == null) { if (customerService.CheckEmail(new Contracts.Request.Customer.CustomerCheckEmailRequest(Email.Text))) { label1.Text = "We did not find any registered users with this email"; } else { if (customerService.ForgotPassword(new Contracts.Request.Customer.ForgotPasswordRequest(Email.Text))) { ShowAutoClosingMessageBoxInfo("We send your password to " + Email.Text, "Successfull"); } else { ShowAutoClosingMessageBoxError("Error", "Error"); } } } else { if (sellerService.CheckEmail(new Contracts.Request.Seller.SellerCheckEmailRequest(Email.Text))) { label1.Text = "We did not find any registered users with this email"; } else { if (sellerService.ForgotPassword(new Contracts.Request.Seller.ForgotPasswordRequest(Email.Text))) { ShowAutoClosingMessageBoxInfo("We send your password to " + Email.Text, "Successfull"); } else { ShowAutoClosingMessageBoxError("Error", "Error"); } } } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }