Exemplo n.º 1
0
 private void Register_Click(object sender, EventArgs e)
 {
     try
     {
         if (!(Email.Text.Contains("@") && Email.Text.Contains(".com")))
         {
             lblUyarı.Text      = "Please, enter a correct email!";
             lblUyarı.ForeColor = Color.Red;
         }
         else
         {
             if ((SName.Text == "" || SName.Text == "Name") || (Surname.Text == "" || Surname.Text == "Surname") || (Email.Text == "" || Email.Text == "Email") || (Password.Text == "" || Password.Text == "Password") || (Photo.Text == "" || Photo.Text == "Upload a file"))
             {
                 lblUyarı.Text = "All fields mark with (*) are mandatory !";
             }
             else
             {
                 lblUyarı.Text = "";
                 if (sellerService == null)
                 {
                     if (customerService.CheckEmail(new Contracts.Request.Customer.CustomerCheckEmailRequest(Email.Text)))
                     {
                         customerService.Register(new Contracts.Request.Customer.CustomerRegisterRequest(SName.Text.ToUpper(), Surname.Text.ToUpper(), Email.Text, Password.Text, CityList.Text, Photo.Text));
                         ShowAutoClosingMessageBox("Login on the homepage with your email and password", "Registration Successfull !");
                     }
                     else
                     {
                         lblUyarı.Text = "Sorry,this email adress is already used !";
                     }
                 }
                 else
                 {
                     if (sellerService.CheckEmail(new Contracts.Request.Seller.SellerCheckEmailRequest(Email.Text)))
                     {
                         sellerService.Register(new Contracts.Request.Seller.SellerRegisterRequest(SName.Text.ToUpper(), Surname.Text.ToUpper(), Email.Text, Password.Text, CityList.Text, Photo.Text));
                         ShowAutoClosingMessageBox("Login on the homepage with your email and password", "Registration Successfull !");
                     }
                     else
                     {
                         lblUyarı.Text = "Sorry,this email adress is already used !";
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
 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);
     }
 }