private void Acceptance_SelectionChanged(object sender, SelectionChangedEventArgs e) { if ( !criteriaContext && (Acceptance.SelectedIndex == 1 || Acceptance.SelectedIndex == 2) ) { criteriaContext = true; this.Height += 60; GridCriteriaRow.Height = new GridLength(50); Windows.CUWindow cuw = Application.Current.MainWindow as Windows.CUWindow; if (cuw != null) { cuw.Height = this.Height + 30; } } else if (criteriaContext && (Acceptance.SelectedIndex == 0 || Acceptance.SelectedIndex == 3)) { criteriaContext = false; this.Height -= 60; GridCriteriaRow.Height = new GridLength(0); Windows.CUWindow cuw = Application.Current.MainWindow as Windows.CUWindow; if (cuw != null) { cuw.Height = this.Height + 30; } } }
private void SaveButton_Click(object sender, RoutedEventArgs e) { if (this.Acceptance.SelectedIndex != 3) { if (this.Acceptance.SelectedIndex == 1 || this.Acceptance.SelectedIndex == 2) { if (!string.IsNullOrEmpty(this.Criteria.Text) && !string.IsNullOrWhiteSpace(this.Criteria.Text)) { DatabaseConnector.DatabaseConnector.UpdateTask(tv.ID, (Model.Task.eAcceptanceProperty)Acceptance.SelectedItem, Criteria.Text, Model.Task.eStatus.Acceptence); } } else { DatabaseConnector.DatabaseConnector.UpdateTask(tv.ID, (Model.Task.eAcceptanceProperty)Acceptance.SelectedItem, "", Model.Task.eStatus.In_work); } MessageBox.Show("User Updated"); Windows.CUWindow cuw = Application.Current.MainWindow as Windows.CUWindow; if (cuw != null) { cuw.Close(); } } else { MessageBox.Show("You have to accept or denie the task!\n" + "If you want to do nothing, click on Cancel"); } }
private void CancelButton_Click(object sender, RoutedEventArgs e) { Windows.CUWindow cuw = Application.Current.MainWindow as Windows.CUWindow; if (cuw != null) { cuw.Close(); } }
private void SaveButton_Click(object sender, RoutedEventArgs e) { if ( !string.IsNullOrWhiteSpace(Name.Text) && !string.IsNullOrEmpty(Name.Text) && !string.IsNullOrWhiteSpace(Username.Text) && !string.IsNullOrEmpty(Username.Text) && !string.IsNullOrWhiteSpace(Password.Password) && !string.IsNullOrEmpty(Password.Password) && !string.IsNullOrWhiteSpace(Phone.Text) && !string.IsNullOrEmpty(Phone.Text) && !string.IsNullOrWhiteSpace(CreditCardNumber.Text) && !string.IsNullOrEmpty(CreditCardNumber.Text) && !string.IsNullOrWhiteSpace(Nickname.Text) && !string.IsNullOrEmpty(Nickname.Text) && !string.IsNullOrWhiteSpace(Email.Text) && !string.IsNullOrEmpty(Email.Text) && Logic.PatternCheck.PatternCheck.CheckToPattern(Logic.PatternCheck.PatternCheck.ePatterns.Email, Email.Text) && Logic.PatternCheck.PatternCheck.CheckToPattern(Logic.PatternCheck.PatternCheck.ePatterns.Phone, Phone.Text) && Logic.PatternCheck.PatternCheck.CheckToPattern(Logic.PatternCheck.PatternCheck.ePatterns.CreditCardNumber, CreditCardNumber.Text) ) { Model.User newUser = new Model.User { ID = -1, Email = Email.Text, Name = Name.Text, Username = Username.Text, Password = Password.Password, CreditCardNumber = CreditCardNumber.Text, Nickname = Nickname.Text, Phone = Phone.Text }; if (!DatabaseConnector.DatabaseConnector.ExistingUser(newUser.Username) && DatabaseConnector.DatabaseConnector.AddUser(newUser) ) { MessageBox.Show("User Created"); Windows.CUWindow cuw = Application.Current.MainWindow as Windows.CUWindow; if (cuw != null) { cuw.Close(); } } } else { MessageBox.Show("This Username is occupied, or the datas are not satisfy the patterns"); } }
private void Edit_Click(object sender, RoutedEventArgs e) { Views.UsersView user = (Views.UsersView)UsersDataGrid.SelectedItem; if (user != null) { cuw = new Windows.CUWindow(Windows.CUWindow.ePage.Users, Windows.CUWindow.eMode.Update, user); cuw.Show(); } else { MessageBox.Show("Select an item!"); } }
private void SaveButton_Click(object sender, RoutedEventArgs e) { if ( !string.IsNullOrWhiteSpace(Name.Text) && !string.IsNullOrEmpty(Name.Text) && !string.IsNullOrWhiteSpace(Username.Text) && !string.IsNullOrEmpty(Username.Text) && !string.IsNullOrWhiteSpace(Password.Password) && !string.IsNullOrEmpty(Password.Password) && !string.IsNullOrWhiteSpace(Phone.Text) && !string.IsNullOrEmpty(Phone.Text) && !string.IsNullOrWhiteSpace(CreditCardNumber.Text) && !string.IsNullOrEmpty(CreditCardNumber.Text) && !string.IsNullOrWhiteSpace(Nickname.Text) && !string.IsNullOrEmpty(Nickname.Text) && !string.IsNullOrWhiteSpace(Email.Text) && !string.IsNullOrEmpty(Email.Text) && Logic.PatternCheck.PatternCheck.CheckToPattern(Logic.PatternCheck.PatternCheck.ePatterns.Email, Email.Text) && Logic.PatternCheck.PatternCheck.CheckToPattern(Logic.PatternCheck.PatternCheck.ePatterns.Phone, Phone.Text) && Logic.PatternCheck.PatternCheck.CheckToPattern(Logic.PatternCheck.PatternCheck.ePatterns.CreditCardNumber, CreditCardNumber.Text) ) { if (DatabaseConnector.DatabaseConnector.UpdateUser( Username.Text, Phone.Text, Password.Password, Email.Text, Name.Text, Nickname.Text, CreditCardNumber.Text )) { MessageBox.Show("User Updated"); Windows.CUWindow cuw = Application.Current.MainWindow as Windows.CUWindow; if (cuw != null) { cuw.Close(); } } else { MessageBox.Show("User not updated because of an error, possible network error"); } } else { MessageBox.Show("These modifications can not be done\nPlease check if all of the columns are filled" + " and the datas are passing to the fill-out patterns"); } }
//TODO: leprogramozni azt, hogy megváltozik az Acceptance message //TODO: leprogramozni azt, hogy megváltozik az assigned user private void SaveButton_Click(object sender, RoutedEventArgs e) { if (state == 0) { if (To.SelectedItem != null && !string.IsNullOrEmpty(Description.Text) && !string.IsNullOrWhiteSpace(Description.Text) && Logic.PatternCheck.PatternCheck.CheckToPattern(Logic.PatternCheck.PatternCheck.ePatterns.Date, RequestedCompletitionDate.SelectedDate.ToString()) ) { DatabaseConnector.DatabaseConnector.UpdateTask(refTask.ID, Model.Task.eAcceptanceProperty.Waiting_for_reply, "", Model.Task.eStatus.Open); } } else if (state == 1) { if (To.SelectedItem != null && !string.IsNullOrEmpty(Description.Text) && !string.IsNullOrWhiteSpace(Description.Text) ) { DatabaseConnector.DatabaseConnector.UpdateTask(refTask.ID, Model.Task.eAcceptanceProperty.Accepted, refTask.AcceptanceMessage, Model.Task.eStatus.In_work); Windows.CUWindow cuw = Application.Current.MainWindow as Windows.CUWindow; if (cuw != null) { cuw.Close(); } } } else if (state == 2) { // Megváltozik az assigned user // Megváltozik az acceptance message } }
private void Create_Click(object sender, RoutedEventArgs e) { cuw = new Windows.CUWindow(Windows.CUWindow.ePage.Tasks, Windows.CUWindow.eMode.Create); cuw.Show(); }
private void SaveButton_Click(object sender, RoutedEventArgs e) { if ( From.SelectedItem != null && !string.IsNullOrEmpty(Description.Text) && !string.IsNullOrWhiteSpace(Description.Text) && Logic.PatternCheck.PatternCheck.CheckToPattern(Logic.PatternCheck.PatternCheck.ePatterns.Date, RequestedCompletitionDate.SelectedDate.ToString()) ) { List <string> assignedUsers = new List <string>(); foreach (CheckBox cb in ToStackPanel.Children) { if (cb.IsChecked == true) { assignedUsers.Add(cb.Name); } } if (assignedUsers.Count != 0) { Model.User selectedFromUser = null; List <Model.User> AssignedUsers = new List <Model.User>(); try { selectedFromUser = DatabaseConnector.DatabaseConnector.SearchUser(Usernames[From.SelectedIndex]); foreach (string assignedUser in assignedUsers) { AssignedUsers.Add(DatabaseConnector.DatabaseConnector.SearchUser(assignedUser)); } } catch { MessageBox.Show("The selected user didn't exist anymore, please refresh the Task page!"); } if (selectedFromUser != null) { foreach (Model.User assignedTo in AssignedUsers) { Model.Task newTask = new Model.Task { ID = -1, CreationDate = DateTime.Now, Description = Description.Text, From = selectedFromUser, To = assignedTo, RequestedCompletionDate = Convert.ToDateTime(RequestedCompletitionDate.SelectedDate), TaskStatus = Model.Task.eStatus.Open, AcceptanceProperty = Model.Task.eAcceptanceProperty.Waiting_for_reply, AcceptanceMessage = "", PlannedCompletionDate = Convert.ToDateTime(RequestedCompletitionDate.SelectedDate) }; DatabaseConnector.DatabaseConnector.AddTask(newTask); } MessageBox.Show("Task(s) Created"); Windows.CUWindow cuw = Application.Current.MainWindow as Windows.CUWindow; if (cuw != null) { cuw.Close(); } } } else { MessageBox.Show("Assign users to the Task!"); } } else { MessageBox.Show("You didn't added all of the required datas " + "or the added date is not valid!\n" + "The requested date need to be later, than the creation date!"); } }