예제 #1
0
 public Group_Details()
 {
     GlobalVariables.connectToDatabase();
     InitializeComponent();
     load_Page();
 }
예제 #2
0
 private void Create_Task(object sender, RoutedEventArgs e)
 {
     GlobalVariables.insertIntoTasks(TaskName.Text, TaskDescription.Text, GlobalVariables.taskTime.ToString());
     GlobalVariables.assignTaskToGroup(GlobalVariables.returnTaskID(TaskName.Text, TaskDescription.Text, GlobalVariables.taskTime.ToString()), GlobalVariables.selectedGroup);
     DisplayTasks.Text = DisplayTasks.Text + Environment.NewLine + TaskName.Text + Environment.NewLine + TaskDescription.Text + Environment.NewLine;
 }
예제 #3
0
 public Group_Tasks()
 {
     GlobalVariables.connectToDatabase();
     InitializeComponent();
     load_tasks();
 }
예제 #4
0
 public Login()
 {
     InitializeComponent();
     GlobalVariables.connectToDatabase();
     //GlobalVariables.insertIntoPeople("Z", "C", "123", 9, "B");
 }
예제 #5
0
 public Account_Details()
 {
     InitializeComponent();
     GlobalVariables.connectToDatabase();
 }
예제 #6
0
        public static void insertIntoPeople(string FName, string LName, string Password, int Email, string Username)
        {
            string        sql     = $"INSERT into People (FName,LName,Password,Email,Username) values ('{FName}','{LName}','{GlobalVariables.hashPassword(Password)}',{Email},'{Username}')";
            SQLiteCommand command = new SQLiteCommand(sql, GlobalVariables.connection);

            command.ExecuteNonQuery();
        }
예제 #7
0
 public MainScreenFoundation()
 {
     InitializeComponent();
     GlobalVariables.connectToDatabase();
 }
예제 #8
0
        public static int returnTaskAmount()
        {
            List <string> groups = GlobalVariables.returnTaskGroups();

            return(groups.Count());
        }
예제 #9
0
        private void MakeUserNow(object sender, RoutedEventArgs e)
        {
            bool   Robbieisbudgesbestfriend = false;
            string StringAlpha = UserEnteredName.Text;
            bool   HasSpace    = StringAlpha.Contains(" ");
            string UserNameNow = UserEnteredName.Text.ToString();

            bool FirstNameContainsSpace = UserFirstName.Text.Contains(" ");
            bool LastNameContainsSpace  = UserLastName.Text.Contains(" ");

            bool FirstNameContainsWrong = false;
            bool LastNameContainsWrong  = false;

            if (UserFirstName.Text.Contains("\u0022"))
            {
                LastNameContainsWrong = true;
            }
            if (UserLastName.Text.Contains("\u0022"))
            {
                LastNameContainsWrong = true;
            }
            if (UserFirstName.Text.Contains("\u0027"))
            {
                LastNameContainsWrong = true;
            }
            if (UserLastName.Text.Contains("\u0027"))
            {
                LastNameContainsWrong = true;
            }

            if (UserEnteredCode.Text.Contains("\u0022"))
            {
                LastNameContainsWrong = true;
            }
            if (PasswordBoxConfirm.Password.Contains("\u0022"))
            {
                LastNameContainsWrong = true;
            }
            if (UserEnteredCode.Text.Contains("\u0027"))
            {
                LastNameContainsWrong = true;
            }
            if (PasswordBoxMake.Password.Contains("\u0027"))
            {
                LastNameContainsWrong = true;
            }
            if (PasswordBoxConfirm.Password.Contains("\u0027"))
            {
                LastNameContainsWrong = true;
            }
            if (PasswordBoxConfirm.Password.Contains("\u0022"))
            {
                LastNameContainsWrong = true;
            }



            if (UserFirstName.Text.Length < 2 || UserLastName.Text.Length < 2)
            {
                ErrorBox.Foreground      = new BrushConverter().ConvertFromString("#ff0000") as SolidColorBrush;
                ErrorBox.Text            = "First or Last Name Too Short!";
                Robbieisbudgesbestfriend = true;
            }
            if (FirstNameContainsSpace || LastNameContainsSpace)
            {
                ErrorBox.Foreground      = new BrushConverter().ConvertFromString("#ff0000") as SolidColorBrush;
                ErrorBox.Text            = "First or Last Name Contains A Space!";
                Robbieisbudgesbestfriend = true;
            }
            if (FirstNameContainsWrong || LastNameContainsWrong)
            {
                ErrorBox.Foreground      = new BrushConverter().ConvertFromString("#ff0000") as SolidColorBrush;
                ErrorBox.Text            = "Please Do Not Use \" or \'";
                Robbieisbudgesbestfriend = true;
            }

            /*
             * if (PasswordBoxConfirm.Password == PasswordBoxMake.Password && UserEnteredName.Text != "User Name" && HasSpace == false)
             * {
             *  var NewPassword = PasswordBoxConfirm.Password;
             *  ErrorBox.Foreground = new BrushConverter().ConvertFromString("#3dff11") as SolidColorBrush;
             *  ErrorBox.Text = "User Created!";
             *  //add password to data base
             * }
             */

            if (UserEnteredName.Text == "User Name" || HasSpace || UserEnteredName.Text.Length < 5 || (UserNameNow.Contains('\u0022')) || (UserNameNow.Contains('\u0027')))
            {
                if (HasSpace)
                {
                    ErrorBox.Foreground = new BrushConverter().ConvertFromString("#ff0000") as SolidColorBrush;
                    ErrorBox.Text       = "User Name Has Spaces!";
                }
                else if (UserEnteredName.Text.Length < 5)
                {
                    ErrorBox.Foreground = new BrushConverter().ConvertFromString("#ff0000") as SolidColorBrush;
                    ErrorBox.Text       = "User Name To Short!";
                }
                else
                {
                    ErrorBox.Foreground = new BrushConverter().ConvertFromString("#ff0000") as SolidColorBrush;
                    ErrorBox.Text       = "User Name Invalid";
                }
                Robbieisbudgesbestfriend = true;
            }

            if (PasswordBoxConfirm.Password != PasswordBoxMake.Password)
            {
                ErrorBox.Foreground      = new BrushConverter().ConvertFromString("#ff0000") as SolidColorBrush;
                ErrorBox.Text            = "Passwords Do Not Match!";
                Robbieisbudgesbestfriend = true;
            }
            if (UserEnteredName.Text == "User Name" || HasSpace)
            {
                ErrorBox.Foreground      = new BrushConverter().ConvertFromString("#ff0000") as SolidColorBrush;
                ErrorBox.Text            = "User Name Invalid!";
                Robbieisbudgesbestfriend = true;
            }
            if (PasswordBoxMake.Password == PasswordBoxConfirm.Password && PasswordBoxMake.Password.Length < 5)
            {
                ErrorBox.Foreground      = new BrushConverter().ConvertFromString("#ff0000") as SolidColorBrush;
                ErrorBox.Text            = "Password To Short!";
                Robbieisbudgesbestfriend = true;
            }

            if (PasswordBoxMake.Password.Any(char.IsUpper))
            {
            }
            else
            {
                ErrorBox.Foreground = new BrushConverter().ConvertFromString("#ff0000") as SolidColorBrush;
                ErrorBox.Text       = "Password Doesn't Meet Requirements!";
            }


            // Zachary's tests

            if (GlobalVariables.isEmailInPeople(UserEnteredCode.Text))
            {
                ErrorBox.Foreground      = new BrushConverter().ConvertFromString("#ff0000") as SolidColorBrush;
                ErrorBox.Text            = "Student Code is already taken!";
                Robbieisbudgesbestfriend = true;
            }

            if (GlobalVariables.isUsernameInPeople(UserEnteredName.Text))
            {
                ErrorBox.Foreground      = new BrushConverter().ConvertFromString("#ff0000") as SolidColorBrush;
                ErrorBox.Text            = "Username is already taken!";
                Robbieisbudgesbestfriend = true;
            }


            // End of Zac's tests
            if (Robbieisbudgesbestfriend == false)
            {
                ErrorBox.Foreground    = new BrushConverter().ConvertFromString("#3dff11") as SolidColorBrush;
                ErrorBox.Text          = "User Created!";
                PublishUser.Visibility = Visibility.Hidden;
                Go_Login.Content       = "Go To Login";
                GlobalVariables.insertIntoPeople(UserFirstName.Text, UserLastName.Text, PasswordBoxConfirm.Password, int.Parse(UserEnteredCode.Text), UserEnteredName.Text);
            }
        }
예제 #10
0
 public Make_User()
 {
     InitializeComponent();
     GlobalVariables.connectToDatabase();
 }