private void button1_Click(object sender, EventArgs e) { int treatTimeMin; if ((string.IsNullOrWhiteSpace(medNameOutput.Text) == false) && (string.IsNullOrWhiteSpace(medDoesOutput.Text) == false) && (Int32.TryParse(treatTimeOutput.Text, out treatTimeMin))) { medNode temp = meds.findMed(nameOfMedInput.Text); temp.setName(medNameOutput.Text); temp.setDoes(medDoesOutput.Text); TimeSpan tempTime = new TimeSpan(0, treatTimeMin, 0); temp.setTime(tempTime); nameOfMedInput.Clear(); medNameOutput.Clear(); medDoesOutput.Clear(); treatTimeOutput.Clear(); nameOfMedInput.Enabled = true; searchMed.Enabled = true; currentTimers.Clear(); medNode[] currentMeds = meds.getMedArray(); foreach (medNode x in currentMeds) { currentTimers.AppendText(x.toString(1) + "\r\n"); } } }
private void searchMed_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(nameOfMedInput.Text) == false) { medNode temp = meds.findMed(nameOfMedInput.Text); if (temp == null) { MessageBox.Show("That Med Does not Exists"); } else { medNameOutput.AppendText(temp.getName()); medDoesOutput.AppendText(temp.getDoes()); treatTimeOutput.AppendText(temp.getTime().TotalMinutes.ToString()); nameOfMedInput.Enabled = false; searchMed.Enabled = false; } } else { MessageBox.Show("Please input a Medication name"); } }
private void addEvent_Click(object sender, EventArgs e) { DateTime temp = new DateTime(); if ((string.IsNullOrWhiteSpace(eventNameInput.Text) == false) && (string.IsNullOrWhiteSpace(linkedMedInput.Text) == false) && (DateTime.TryParse(eventTimeInput.Text, out temp))) { medNode tempMed = meds.findMed(linkedMedInput.Text); if (tempMed == null) { MessageBox.Show("That medication Does not Exist"); } else if (DateTime.Compare(temp, DateTime.Now) < 0) { MessageBox.Show("That date has already past"); } else { events.addEvent(eventNameInput.Text, temp, tempMed); MessageBox.Show("Event Added"); } } else if ((string.IsNullOrWhiteSpace(eventNameInput.Text) == false) && (DateTime.TryParse(eventTimeInput.Text, out temp))) { if (DateTime.Compare(temp, DateTime.Now) < 0) { MessageBox.Show("That date has already past"); } else { events.addEvent(eventNameInput.Text, temp); MessageBox.Show("Event Added"); } } }