Esempio n. 1
0
 private void navLog_Click(object sender, RoutedEventArgs e)
 {
     //This would appear as sign out
     logged = Login.GetPrincipalUser();
     if (logged != null)
     {
         LogOut();
         SharedFunctions.GoHomeOnly(this);
     }
     else //this appears as signin
     {
         Login log = new Login();
         this.Hide();
         log.Show();
     }
 }
        public void ValidateDonorDetails()
        {
            var databaseContext = new UserRegistrationDBEntities();
            var user            = new DonorDetail()

            {
                DonorID        = Int32.Parse(donorIDText.Text.Trim()),
                DOB            = Convert.ToDateTime(birthText.Text.Trim()),
                Gender         = genderText.Text.Trim(),
                Ethnicity      = ethnicityText.Text.Trim(),
                BloodType      = bloodTypeText.Text.Trim(),
                RHFactor       = rhFactorText.Text.Trim(),
                MedicalHistory = historyText.Text.Trim(),
                NhsID          = principleUser.NhsID
            };

            databaseContext.DonorDetails.Add(user);
            databaseContext.SaveChanges();
            MessageBox.Show("Donor Data Added");
            SharedFunctions.BackToAccount(this);
        }
Esempio n. 3
0
        public MainWindow()
        {
            SharedFunctions.FullSizeWindow(this);
            logged = Login.GetPrincipalUser();
            InitializeComponent();
            if (logged != null)
            {
                navLog.Content = "Sign out";
                label.Content  = $"Welcome {logged.Username}";

                Button personalDetails = new Button
                {
                    Content    = "My Account",
                    Margin     = new Thickness(0, 0, 0, 10),
                    Background = new SolidColorBrush(Color.FromRgb(122, 180, 230)),
                    Foreground = Brushes.White
                };
                nav.Children.Add(personalDetails);
                personalDetails.Click += details_Click;
            }
        }
Esempio n. 4
0
        public void AddValidateDetails()
        {
            var databaseContext = new UserRegistrationDBEntities();
            var user            = new tableUser()
            {
                FirstName = first.Text.Trim(),
                LastName  = last.Text.Trim(),
                Contact   = number.Text.Trim(),
                Address   = location.Text.Trim(),
                Username  = alias.Text.Trim(),
                Password  = pass.Text.Trim(),
                Email     = mail.Text.Trim()
            };

            databaseContext.tableUsers.Add(user);
            databaseContext.SaveChanges();
            MessageBox.Show("Registered successfully");
            registered = true;
            Login.SetPrincipleUser(user);
            SharedFunctions.Clear(this);
            SharedFunctions.GoHomeOnly(this);
        }
Esempio n. 5
0
        private void Send_Click(object sender, RoutedEventArgs e)
        {
            bool passedEmptyBoxesStage = SharedFunctions.PassedEmpty(this);
            var  emailAtr = new EmailAddressAttribute();

            if (passedEmptyBoxesStage)
            {
                if (!number.Text.All(Char.IsDigit))
                {
                    SharedFunctions.AddErrors(number, "Contact: Type in only numbers");
                }

                if (pass.Text != confirm.Text)
                {
                    SharedFunctions.AddErrors(pass, "Password confirmation does not match");
                }

                if (emailAtr.IsValid(mail.Text) == false)
                {
                    SharedFunctions.AddErrors(mail, "Please write your email in the format: [email protected]");
                }

                if (SharedFunctions.GetFoundErrors().Count() == 0)
                {
                    AddValidateDetails();
                }
                else
                {
                    SharedFunctions.CheckForErrors();
                }
            }
            //All fields where blank, leave all red, but change as input
            else
            {
                SharedFunctions.Clear(this);
            }
        }
 private void Cancel_Click(object sender, RoutedEventArgs e)
 {
     SharedFunctions.BackToAccount(this);
 }
Esempio n. 7
0
 private void homeFromReg_Click(object sender, RoutedEventArgs e)
 {
     ChangeSearchStatus(false);
     SharedFunctions.GoHomeOnly(this);
 }
 public RegisterMedical()
 {
     InitializeComponent();
     SharedFunctions.FullSizeWindow(this);
 }
 private void HistoryText_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
 {
     SharedFunctions.ResetBox(sender as TextBox);
 }
 private void homeFromReg_Click(object sender, RoutedEventArgs e)
 {
     SharedFunctions.GoHomeOnly(this);
 }
Esempio n. 11
0
 private void welcomeIcon_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     SharedFunctions.GoHomeOnly(this);
 }
Esempio n. 12
0
 public DataRecords()
 {
     InitializeComponent();
     SharedFunctions.FullSizeWindow(this);
 }
Esempio n. 13
0
 private void Data_Click(object sender, RoutedEventArgs e)
 {
     ChangeSearchStatus(false);
     SharedFunctions.ViewAllRecords(this);
 }
Esempio n. 14
0
 private void Cancel_Click(object sender, RoutedEventArgs e)
 {
     SharedFunctions.GoHomeOnly(this);
 }
Esempio n. 15
0
 private void Data_Click(object sender, RoutedEventArgs e)
 {
     SharedFunctions.ViewAllRecords(this);
 }
Esempio n. 16
0
 private void GoFromLog_Click(object sender, RoutedEventArgs e)
 {
     //Go home without attempting to login
     SharedFunctions.GoHomeOnly(this);
 }
Esempio n. 17
0
 public Login()
 {
     InitializeComponent();
     SharedFunctions.FullSizeWindow(this);
 }
Esempio n. 18
0
 private void Welcome_Click(object sender, RoutedEventArgs e)
 {
     //Go home but stay logged in
     SharedFunctions.GoHomeOnly(this);
 }