Пример #1
0
        protected bool saveEvent()
        {
            bool errorx = false;

            xmlEvent tempevent = new xmlEvent();

            if (textBox1.Text.Length < 1)
            {
                MessageBox.Show("Please enter a valid name", "Invalid Name", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                errorx = true;
            }
            else
            {
                tempevent.name = textBox1.Text;
            }
            events[day, eventnum] = tempevent;
            try
            {
                xmltime sTime = new xmltime();
                sTime.setHour(int.Parse(sHour.Text));
                sTime.setMin(int.Parse(sMin.Text));
                sTime.setDayTime(sDayTime.Text);
                tempevent.starttime = sTime;
            }
            catch (Exception ex)
            {
                if (ex is FormatException || ex is NullReferenceException)
                {
                    MessageBox.Show("Incorrect Start Time", "Start Time Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    errorx = true;
                }
            }
            try
            {
                xmltime eTime = new xmltime();
                eTime.setHour(int.Parse(eHour.Text));
                eTime.setMin(int.Parse(eMin.Text));
                eTime.setDayTime(eDayTime.Text);
                tempevent.endtime = eTime;
            }
            catch (Exception ex)
            {
                if (ex is FormatException || ex is NullReferenceException)
                {
                    MessageBox.Show("Incorrect End Time", "Start Time Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                errorx = true;
            }
            tempevent.location = loc.Text;
            return(errorx);
        }
Пример #2
0
        protected void displayEvent()
        {
            xmlEvent tempevent = new xmlEvent();

            tempevent       = events[day, eventnum];
            textBox1.Text   = tempevent.name;
            sHour.Text      = tempevent.starttime.getHour();
            sMin.Text       = tempevent.starttime.getMin();
            sDayTime.Text   = tempevent.starttime.getDayTime();
            eHour.Text      = tempevent.endtime.getHour();
            eMin.Text       = tempevent.endtime.getMin();
            eDayTime.Text   = tempevent.endtime.getDayTime();
            loc.Text        = tempevent.location;
            daylabel.Text   = "Day " + day;
            eventlabel.Text = "Event " + eventnum;
            textBox1.Focus();
        }