public void addCalendarEventTest()
 {
     CalendarBLL target = new CalendarBLL();
     CalendarEvent e = new CalendarEvent(1, "EventName", DateTime.Now, DateTime.Now, 1, "Test Type");
     bool expected = true;
     bool actual;
     actual = target.addCalendarEvent(e);
     Assert.AreEqual(expected, actual);
 }
        protected void SaveNewEvent_Click(object sender, EventArgs e)
        {
            CalendarEvent newEvent = new CalendarEvent();

            if (NewEventNameTextBox.Text.Length == 0)
            {
                TopMostMessageBox.Show("Please enter an event name.", "Error", MessageBoxButtons.RetryCancel);
                return;
            }
            newEvent.setName(NewEventNameTextBox.Text);

            if (StartYear.Text.Length == 0)
            {
                TopMostMessageBox.Show("Please enter a start year.", "Error", MessageBoxButtons.RetryCancel);
                return;
            }
            else if (StartMonth.Text.Length == 0)
            {
                TopMostMessageBox.Show("Please enter a start month.", "Error", MessageBoxButtons.RetryCancel);
                return;
            }
            else if (StartDay.Text.Length == 0)
            {
                TopMostMessageBox.Show("Please enter a start day.", "Error", MessageBoxButtons.RetryCancel);
                return;
            }
            else if (StartHour.Text.Length == 0)
            {
                TopMostMessageBox.Show("Please enter a start hour.", "Error", MessageBoxButtons.RetryCancel);
                return;
            }
            else if (StartMinute.Text.Length == 0)
            {
                TopMostMessageBox.Show("Please enter a start minute.", "Error", MessageBoxButtons.RetryCancel);
                return;
            }

            if (EndYear.Text.Length == 0)
            {
                TopMostMessageBox.Show("Please enter a end year.", "Error", MessageBoxButtons.RetryCancel);
                return;
            }
            else if (EndMonth.Text.Length == 0)
            {
                TopMostMessageBox.Show("Please enter a end month.", "Error", MessageBoxButtons.RetryCancel);
                return;
            }
            else if (EndDay.Text.Length == 0)
            {
                TopMostMessageBox.Show("Please enter a end day.", "Error", MessageBoxButtons.RetryCancel);
                return;
            }
            else if (EndHour.Text.Length == 0)
            {
                TopMostMessageBox.Show("Please enter a end hour.", "Error", MessageBoxButtons.RetryCancel);
                return;
            }
            else if (EndMinute.Text.Length == 0)
            {
                TopMostMessageBox.Show("Please enter a end minute.", "Error", MessageBoxButtons.RetryCancel);
                return;
            }

            int startYear = Convert.ToInt32(StartYear.Text);
            int startMonth = Convert.ToInt32(StartMonth.Text);
            int startDay = Convert.ToInt32(StartDay.Text);
            int startHour = Convert.ToInt32(StartHour.Text);
            int startMinute = Convert.ToInt32(StartMinute.Text);
            int endYear = Convert.ToInt32(EndYear.Text);
            int endMonth = Convert.ToInt32(EndMonth.Text);
            int endDay = Convert.ToInt32(EndDay.Text);
            int endHour = Convert.ToInt32(EndHour.Text);
            int endMinute = Convert.ToInt32(EndMinute.Text);

            DateTime startTime = new DateTime(startYear, startMonth, startDay, startHour, startMinute, 0);
            DateTime endTime = new DateTime(endYear, endMonth, endDay, endHour, endMinute, 0);

            System.Diagnostics.Trace.WriteLine(startTime.ToString());
            System.Diagnostics.Trace.WriteLine(endTime.ToString());

            newEvent.setStart(startTime);
            newEvent.setEnd(endTime);
            newEvent.setCalendarId(currentCalendar.getCalendarId());
            newEvent.setType(TypeDropDownList.SelectedValue);

            CalendarBLL calendarBLL = new CalendarBLL();
            calendarBLL.addCalendarEvent(newEvent);

            ViewCalendarPanel.Visible = true;
            AddEventPanel.Visible = false;
        }