private void Form1_Load(object sender, EventArgs e) { //Calendar working objects dateList activeDateList = new dateList(); dateEntry activeDateEntry = new dateEntry(001, "", "", 001, 001); gameDateList activeGDateList = new gameDateList(); gameDateEntry activeGameDate = new gameDateEntry(001, ""); }
dateList testDate2 = new dateList(); //Holds info for loading //TEST private void btnTestAssign_Click(object sender, EventArgs e) { dateEntry newEntry = new dateEntry(Convert.ToInt32(txtGDateID.Text), txtGEntry.Text, txtSessionEntry.Text, Convert.ToInt32(txtGDSID.Text), Convert.ToInt32(txtGDEID.Text)); testDate.addEntry(newEntry); }
//TEST private void btnTestRecall_Click(object sender, EventArgs e) { dateEntry retrievedEntry = new dateEntry(); retrievedEntry = testDate.retrieveEntry(Convert.ToInt32(txtGDateID.Text)); txtGDateID.Text = retrievedEntry.dateID.ToString(); txtGEntry.Text = retrievedEntry.planEntry; txtSessionEntry.Text = retrievedEntry.sessionEntry; txtGDSID.Text = retrievedEntry.gameDateStartID.ToString(); txtGDEID.Text = retrievedEntry.gameDateEndID.ToString(); }
//new Date selected private void DTdateSelector_ValueChanged(object sender, EventArgs e) { //If entry has been edited if (changedDateEntry == true) { updateDateEntry(); saveDateList(); } //Check target date for valid entry dateEntry openDate = dateLL.retrieveEntry(DTdateSelector.Value.Date); activeDate = DTdateSelector.Value.Date; if (openDate.planEntry == "<!>ERROR") { activeDateEntry = blankEntry; activeDateEntry.dateID = activeDate; } else { activeDateEntry = openDate; } updateCalendar(); changedDateEntry = false; }
public void loadCalendar() { if (dateLL.getLast().planEntry != "<!>ERROR") { activeDateEntry = dateLL.getLast(); } updateCalendar(); dateEntry openDate = dateLL.getFirst(); if (openDate.planEntry != "<!>ERROR") { DTdateSelector.Value = openDate.dateID; } }
//Removes active session from dateLL private void BTNDeleteSession_Click(object sender, EventArgs e) { var confirm = System.Windows.Forms.MessageBox.Show("Delete This Session?", "Confirm Session Delete", MessageBoxButtons.YesNo); if (confirm == DialogResult.Yes) { dateLL.removeEntry(activeDate); activeDateEntry = blankEntry; activeDateEntry.dateID = activeDate; updateCalendar(); } }
//Add specified payload to list public Boolean addEntry (dateEntry newDate) { if (dList.Count == 0) { dList.AddFirst(newDate); return true; } LinkedListNode<dateEntry> current = dList.First; while (current != null) { if (current.Value.dateID == newDate.dateID) { //If updating an entry current.Value = newDate; return true; } else if (current.Value.dateID > newDate.dateID) { //Inserting within list dList.AddBefore(current, newDate); return true; } else if (current == dList.Last) { //Inserting at end of list dList.AddAfter(current, newDate); return true; } current = current.Next; } return false; }
public void loadCalendar() { if (dateLL.getLast().planEntry != "<!>ERROR") { activeDateEntry = dateLL.getLast(); } updateCalendar(); }