Exemple #1
0
        bool SignUp()
        {
            System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

            Models.Login        l         = new Models.Login();
            List <Models.Login> LoginData = WPE.Login.ToList();

            if (f.IsName(TB_user, TB_user.Text, rm) && f.IsPassword(T_passwd, T_passwd.Password, rm) && f.IsPasswordAreEqual(T_passwd, T_passwdAgain, T_passwd.Password, T_passwdAgain.Password, rm) && f.IsValidEmail(TB_email, TB_email.Text.Trim(), rm))
            {
                if (LoginData.FirstOrDefault(x => x.User.Trim().Equals(TB_user.Text)) == null)
                {
                    l.User         = TB_user.Text.Trim();
                    l.Password     = f.Encrypt(T_passwd.Password.Trim());
                    l.EmailAddress = TB_email.Text.Trim();
                    WPE.Login.Add(l);
                    WPE.SaveChanges();
                    System.Windows.Input.Mouse.OverrideCursor = null;
                    return(true);
                }
                else
                {
                    ViewModel.WinMessageBoxItem wmsb = new ViewModel.WinMessageBoxItem(rm.GetString("LB_Title_reg"), rm.GetString("Message_Reg"), MaterialDesignThemes.Wpf.PackIconKind.InformationCircleOutline);
                    Windows.WinMessageBox       msb  = new Windows.WinMessageBox(wmsb, (rm as ResourceManager), ResourceNames, false);
                    msb.Show();
                    System.Windows.Input.Mouse.OverrideCursor = null;
                    return(false);
                }
            }
            else
            {
                System.Windows.Input.Mouse.OverrideCursor = null;
                return(false);
            }
        }
Exemple #2
0
        void BT_Exit_Click(object sender, RoutedEventArgs e)
        {
            ViewModel.WinMessageBoxItem wmsb = new ViewModel.WinMessageBoxItem(rm.GetString("ExitWarning"), rm.GetString("Exit"), MaterialDesignThemes.Wpf.PackIconKind.QuestionMarkRhombus);
            Windows.WinMessageBox       msb  = new Windows.WinMessageBox(wmsb, (rm as ResourceManager), ResourceNames, true);

            if (msb.ShowDialog() == true)
            {
                System.Windows.Application.Current.Shutdown();
            }
        }
Exemple #3
0
        void ReNewPassword()
        {
            if (f.IsName(TB_user, TB_user.Text.Trim(), rm))
            {
                ViewModel.WinMessageBoxItem wmsb = new ViewModel.WinMessageBoxItem(rm.GetString("Message_RenewPasswordTitle"), rm.GetString("Message_RenewPassword"), MaterialDesignThemes.Wpf.PackIconKind.WarningCircle);
                Windows.WinMessageBox       msb  = new Windows.WinMessageBox(wmsb, (rm as ResourceManager), ResourceNames, true);

                if (msb.ShowDialog() == true)
                {
                    System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
                    string GeneratedPassword = GeneratePassword();
                    if (PasswordModification(TB_user.Text.Trim(), GeneratedPassword))
                    {
                        string       Useremail    = WPE.Login.FirstOrDefault(x => x.User.Equals(TB_user.Text)).EmailAddress.Trim();
                        var          fromAddress  = new System.Net.Mail.MailAddress(rm.GetString("Send_EmailFrom").Trim(), "Wedding Planner");
                        var          toAddress    = new System.Net.Mail.MailAddress(Useremail.Trim(), "To Name");
                        const string fromPassword = "******";
                        string       subject      = rm.GetString("Send_EmailSubject").Trim();
                        string       body         = rm.GetString("Send_EmailBody1") + TB_user.Text.Trim() + "!\n" + rm.GetString("Send_EmailBody2") + "\n\n" + GeneratedPassword + "\n\n" + rm.GetString("Send_EmailBody3");

                        var smtp = new System.Net.Mail.SmtpClient
                        {
                            Host                  = rm.GetString("Send_EmailHost").Trim(),
                            Port                  = 587,
                            EnableSsl             = true,
                            DeliveryMethod        = System.Net.Mail.SmtpDeliveryMethod.Network,
                            UseDefaultCredentials = false,
                            Credentials           = new System.Net.NetworkCredential(fromAddress.Address, fromPassword),
                            Timeout               = 20000
                        };
                        using (var message = new System.Net.Mail.MailMessage(fromAddress, toAddress)
                        {
                            Subject = subject,
                            Body = body
                        })
                        {
                            smtp.Send(message);
                        }
                    }
                }
            }
            System.Windows.Input.Mouse.OverrideCursor = null;
        }