/* Constructors */ public FormJobDetails(Job job) { InitializeComponent(); textMain.Text += "Title: " + job.Title + Environment.NewLine + Environment.NewLine; textMain.Text += "Description: " + job.Description + Environment.NewLine + Environment.NewLine; textMain.Text += "Deadline: " + job.DeadlineDate.ToShortDateString() + Environment.NewLine + Environment.NewLine; textMain.Text += "Status: " + job.Status.ToString(); if (job.Status == JobStatus.Completed) { textMain.Text += " (at " + job.CompletedDate.ToShortDateString() + ")"; } textMain.Text += Environment.NewLine; }
// Edit job mode public FormCreateJob(Job job) { InitializeComponent(); Text = "Edit job"; Icon = Resources.Jobs_Edit_Icon_16; newJob = job; textTitle.Text = newJob.Title; textDescription.Text = newJob.Description; if (newJob.Termless) { checkTermless.Checked = true; ActionTermless(this, null); } else { calendarDeadline.SelectionStart = newJob.DeadlineDate; } }
/* Additional functions */ private void AddItemToList(Job t) { ListViewItem item = new ListViewItem(t.Status.ToString()); item.SubItems.Add(t.Title); if (t.Termless) { item.SubItems.Add("Termless"); } else { item.SubItems.Add(t.DeadlineDate.ToShortDateString()); } if (t.Status == JobStatus.Completed) { item.SubItems.Add(t.CompletedDate.ToShortDateString()); } listMain.Items.Add(item); }
/* Constructors */ public FormCreateJob() { InitializeComponent(); Icon = Resources.Jobs_Create_Icon_16; newJob = new Job(); }
private void AtionJobEditing(Object sender, Job editedJob) { foreach (ListViewItem t in listMain.Items) { if (editedJob.Key == (Int32)t.Tag) { t.SubItems[1].Text = editedJob.Title; if (editedJob.Termless) { t.SubItems[2].Text = "Termless"; } else { t.SubItems[2].Text = editedJob.DeadlineDate.ToShortDateString(); } break; } } for(Int32 i = 0; i < listJobs.Count;i++) { if (((Job)listJobs[i]).Key == editedJob.Key) { listJobs[i] = editedJob; break; } } jobsChanged = true; }
private void AddItemInList(Job t) { ListViewItem item = new ListViewItem(t.Status.ToString()); item.SubItems.Add(t.Title); item.Tag = t.Key; if (t.Termless) { item.SubItems.Add("Termless"); } else { item.SubItems.Add(t.DeadlineDate.ToShortDateString()); } listMain.Items.Add(item); }
private void ActionJobAdding(Object sender, Job newJob) { AddItemInList(newJob); listJobs.Add(newJob); jobsChanged = true; }