示例#1
0
 public xmlEvent(string name, xmltime starttime, xmltime endtime, string location)
 {
     this.name      = name;
     this.starttime = starttime;
     this.endtime   = endtime;
     this.location  = location;
 }
示例#2
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);
        }