private void LoginButtonClick(object sender, RoutedEventArgs e)
 {
     this.Hide();
     var mainWindow = new MainWindow();
     var status = mainWindow.ShowDialog();
     this.Close();
 }
        private void RegisterProviderButtonClick(object sender, RoutedEventArgs e)
        {
            if (noOfErrorsOnScreen > 0)
            {
                errorLabel.Visibility = System.Windows.Visibility.Visible;
                return;
            }

            bool isMale = false;
            try
            {
                if (rdMale.IsChecked != null && bool.Parse(rdMale.IsChecked.ToString()))
                    isMale = true;
                var providerDataRepository = new ProviderDataRepository();
                providerDataRepository.SaveProviderRecord(new Provider
                {
                    FirstName = txtFirstName.Text.Trim(),
                    LastName = txtLastName.Text.Trim(),
                    MiddleName = txtMiddleName.Text.Trim(),
                    Address = txtAddress.Text.Trim(),
                    Gender = isMale,
                    DOB = dtPicker.SelectedDate.Value,
                    EmailAddress = txtEmailAddress.Text.Trim(),
                    UserName = txtUserName.Text.Trim(),
                    Password = EncryptDecrypt.EncryptData(passWordBox.Password),
                    PhoneNumber = txtPhoneNumber.Text.Trim()
                });
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            this.Hide();
            var mainWindow = new MainWindow();
            mainWindow.ShowDialog();
            this.Close();
        }