Пример #1
0
        private void btnRegister_Click(object sender, RoutedEventArgs e)
        {
            string name  = TxtName.Text;
            string email = TxtEmail.Text;
            var    data  = myContext.User.Where(d => d.Email == email).SingleOrDefault();

            if (data != null)
            {
                MessageBox.Show("You have been Register");
            }
            else
            {
                string pass   = Guid.NewGuid().ToString();
                var    insert = new Model.User(name, email, pass);
                myContext.User.Add(insert);
                myContext.SaveChanges();
                MessageBox.Show("Register Successful");
                try
                {
                    Microsoft.Office.Interop.Outlook._Application _app = new Outlook.Application();
                    Outlook.MailItem mail = (Outlook.MailItem)_app.CreateItem(Outlook.OlItemType.olMailItem);
                    mail.To         = TxtEmail.Text;
                    mail.Subject    = "Successful Register";
                    mail.Body       = "Hi " + TxtName.Text + ", this is your password : "******"";
                    TxtEmail.Text = "";
                    MessageBox.Show("Your Message has been successfully sent.", "Message", MessageBoxButton.OKCancel);
                    Login log = new Login();
                    log.Show();
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK);
                }

                Login l = new Login();
                l.Show();
                this.Close();
            }
        }
Пример #2
0
        private void log_button(object sender, System.Windows.RoutedEventArgs e)
        {
        	Login lg = new Login();
			lg.Show();
			this.Close();
        }
Пример #3
0
        public static void ShowLogin()
        {
            Login objetologin = new Login();

            objetologin.Show();
        }