public void Delete(Assignment assignment)
 {
     var assignmentForDeletion = AllAssignments.Find(a => a.Id == assignment.Id);
     AllAssignments.Remove(assignmentForDeletion);
     Serialize();
     GetAllAssignments();
 }
 public void Change(Assignment assignment)
 {
     var assignmentToChange = AllAssignments.Find(u => u.Id == assignment.Id);
     if (AllAssignments.Any(u => u.Name == assignment.Name))
     {
         throw new InvalidOperationException("AssignmentName is already used");
     }
     AllAssignments.Remove(assignmentToChange);
     AllAssignments.Add(assignment);
     Serialize();
     GetAllAssignments();
 }
        protected new void OkButton_Click(object sender, EventArgs e)
        {
            var assignment = new Assignment
            {
                Description = DescriptionRichTextBox.Text,
                ExpirationDate = ExpirationDateTimePicker.Value,
                Name = AssignmentNameBox.Text,
                Owner = AssignmentManagementClient.UsersOrganizer.GetUserByName(OwnerComboBox.Text).Id,
                Id = _id
            };

            AssignmentManagementClient.AssignmentOrganizer.Change(assignment);
            Close();
        }
        protected virtual void OkButton_Click(object sender, EventArgs e)
        {
            var assignment = new Assignment
                {
                    Description = DescriptionRichTextBox.Text,
                    ExpirationDate = ExpirationDateTimePicker.Value,
                    Id = Guid.NewGuid(),
                    Name = AssignmentNameBox.Text,
                    Owner = AssignmentManagementClient.UsersOrganizer.GetUserByName(AssignmentNameBox.Text).Id
                };

            AssignmentManagementClient.AssignmentOrganizer.Add(assignment);
            Close();
        }
        public EditAssignmentForm(Assignment assignment, List<User> users)
        {
            InitializeComponent();

            DescriptionRichTextBox.Text = assignment.Description;
            ExpirationDateTimePicker.Value = assignment.ExpirationDate;
            AssignmentNameBox.Text = assignment.Name;
            foreach (var user in users)
            {
                OwnerComboBox.Items.Add(user.Name);
            };

            OwnerComboBox.Text = AssignmentManagementClient.UsersOrganizer.GetUserById(assignment.Owner).Name;
            _id = assignment.Id;

            RemoveAssignmentButton.Enabled = true;
        }
 public void Add(Assignment assignment)
 {
     AllAssignments.Add(assignment);
     Serialize();
     GetAllAssignments();
 }