private void listToolStripMenuItem3_Click(object sender, EventArgs e) { if (CBC[0].Events.Count > 0) { this.Enabled = false; frmListEvents F = new frmListEvents(); F.Show(); F.MainForm = this; F.PopulateEvents(CBC[0].Events); } else { MessageBox.Show("There are no events. Please add events so you can list them.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void DeleteEvent(EventClass evtDel, frmListEvents FLE) { bool Found = false; if (evtDel != null) { foreach (EventClass EC in CBC[0].Events) { if (!Found) { if (EC == evtDel) Found = true; } } } if (Found) { CBC[0].Events.Remove(evtDel); MessageBox.Show("Event has been deleted.", "Success"); } else MessageBox.Show("Couldn't delete Event.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); FLE.PopulateEvents(CBC[0].Events); blDataSaved = false; CheckStatus(); }
public void EditEvent(EventClass evtOld, EventClass evtUpdate, Image Picture, frmListEvents FLE) { bool Found = false; if (evtOld != null) { foreach (EventClass EE in CBC[0].Events) { if (!Found) { if (EE.Name == evtOld.Name) { EE.Name = evtUpdate.Name; EE.Description = evtUpdate.Description; EE.SavePicture = ImageToString(Picture); EE.Date = evtUpdate.Date; EE.Location = evtUpdate.Location; Found = true; blDataSaved = false; } } } } if (Found) MessageBox.Show("Event edit successful!", "Editing..."); else MessageBox.Show("Failed to edit event!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }