private void editTaskButton_Click(object sender, EventArgs e) { ListViewItem lvi = taskListView.SelectedItems[0]; AddTaskPage editPage = new AddTaskPage(lvi.SubItems[0].Text, lvi.SubItems[2].Text, lvi.SubItems[3].Text, Convert.ToDateTime(lvi.SubItems[1].Text), lvi.SubItems[4].Text, server, eventId); editPage.ShowDialog(); if (editPage.isConfirm == true) { string name = editPage.name; DateTime deadline = editPage.deadline; string inChargeName = editPage.inChargeName; string inChargeMatric = editPage.matric; string description = editPage.description; eventOrganizerManager.EditTask(name, inChargeMatric, description, deadline, Convert.ToInt32(lvi.SubItems[6].Text), Convert.ToInt32(lvi.SubItems[7].Text), this.eventId); lvi.SubItems[0].Text = name; lvi.SubItems[1].Text = deadline.ToString("d"); lvi.SubItems[2].Text = inChargeMatric; lvi.SubItems[3].Text = inChargeName; lvi.SubItems[4].Text = description; toolStripStatusLabel1.Text = "Details of task <" + name + "> has been editted."; } editPage.Close(); taskButtonDisable(); }
private void addTaskButton_Click(object sender, EventArgs e) { AddTaskPage addPage = new AddTaskPage(server, eventId); addPage.ShowDialog(); if (addPage.isConfirm == true) { string name = addPage.name; DateTime deadline = addPage.deadline; string inChargeName = addPage.inChargeName; string inChargeMatric = addPage.matric; string description = addPage.description; int taskId = eventOrganizerManager.AddTask(name, inChargeMatric, description, deadline, false, 0, this.eventId); ListViewItem newTask = new ListViewItem(new[] { name, deadline.ToString("d"), inChargeMatric, inChargeName, description, "Overall", "0", taskId.ToString() }); taskListView.Items.Add(newTask); toolStripStatusLabel1.Text = "Task <" + name + "> has been added to the tasklist."; } addPage.Close(); taskButtonDisable(); }