Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 public void createCalendarTest()
 {
     CalendarBLL target = new CalendarBLL();
     string name = "UnitTestName";
     bool expected = true;
     bool actual;
     actual = target.createCalendar(name);
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 3
0
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            String calendarToDelete = DeleteDropDown.SelectedValue;
            CalendarBLL calendarBLL = new CalendarBLL();
            if (TopMostMessageBox.Show("Are you sure you want to delete " + calendarToDelete + "?", "Message", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                calendarBLL.deleteCalendar(calendarToDelete);
            }

            DeleteCalendarPanel.Visible = false;
            InitPanel.Visible = true;
        }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
        protected void SaveEdit_Click(object sender, EventArgs e)
        {
            CalendarBLL calendarBLL = new CalendarBLL();

            String calendarToEdit = CalendarDropDown.SelectedValue;
            String newName = EditNameTextBox.Text;

            ArrayList currentCalendars = new ArrayList();
            if ((currentCalendars = calendarBLL.getCalendars()) != null)
            {
                foreach (String n in currentCalendars)
                {
                    if (newName.Equals(n))
                    {
                        TopMostMessageBox.Show("A calendar with that name already exists.", "Error");
                        return;
                    }
                }
            }

            if (newName.Length == 0)
            {
                TopMostMessageBox.Show("Please enter a calendar name.", "Error");
                return;
            }

            /*String newProject = NewProjectDropDown.SelectedValue;

            if (calendarBLL.updateCalendarInfo(calendarToEdit, newName, newProject))
            {
                TopMostMessageBox.Show("Successfully updated " + newName, "Message", MessageBoxButtons.OKCancel);
            }*/

            InitPanel.Visible = true;
            EditPanel.Visible = false;
        }
Ejemplo n.º 6
0
        /*private void populateNewProjectDropDown()
        {
            CalendarBLL temp = new CalendarBLL();
            NewProjectDropDown.DataSource = temp.getProjectNames();
            NewProjectDropDown.DataBind();
        }*/
        protected void SaveNewCalendar(object sender, EventArgs e)
        {
            CalendarBLL calendarBLL = new CalendarBLL();
            ArrayList currentCalendars = null;

            String name = calendarName.Text;
            if (name == null || name.Length == 0)
            {
                TopMostMessageBox.Show("Name cannot be empty", "Error");
                return;
            }

            if ((currentCalendars = calendarBLL.getCalendars()) != null)
            {
                foreach (String n in currentCalendars)
                {
                    if (name.Equals(n))
                    {
                        TopMostMessageBox.Show("A calendar with that name already exists.", "Error");
                        return;
                    }
                }
            }

            /*String projectName = ProjectsDropDown.SelectedValue;

            if (projectName == null || projectName.Length == 0)
            {
                TopMostMessageBox.Show("Project cannot be empty", "Error");
                return;
            }*/

            calendarBLL.createCalendar(name);
            InitPanel.Visible = true;
            CreatePanel.Visible = false;
        }
Ejemplo n.º 7
0
        protected void populateDeleteEventCheckBox()
        {
            CalendarBLL calendarBLL = new CalendarBLL();
            ArrayList events = calendarBLL.getCalendarEvents(currentCalendar.getCalendarId());

            ArrayList names = new ArrayList();
            foreach (CalendarEvent e in events)
            {
                names.Add(e.getName());
            }

            DeleteEventCheckBox.DataSource = names;
            DeleteEventCheckBox.DataBind();
        }
Ejemplo n.º 8
0
 protected void populateDeleteEventDropDown()
 {
     CalendarBLL calendarBLL = new CalendarBLL();
     ArrayList calendarNames = calendarBLL.getCalendars();
     DeleteEventDropDown.DataSource = calendarNames;
     DeleteEventDropDown.DataBind();
 }
Ejemplo n.º 9
0
        protected void DeleteEventPageClick(object sender, EventArgs e)
        {
            CalendarBLL calendarBLL = new CalendarBLL();
            String calendarToDeleteEvents = DeleteEventDropDown.SelectedValue;
            System.Diagnostics.Trace.WriteLine(calendarToDeleteEvents);
            ProjectManagerLibrary.Models.Calendar calendar = calendarBLL.getCalendarByName(calendarToDeleteEvents);
            currentCalendar.setCalendarName(calendarToDeleteEvents);
            currentCalendar.setCalendarId(calendar.getCalendarId());
            //currentCalendar.setProjectId(calendar.getProjectId());

            populateDeleteEventCheckBox();

            DeleteEventPanel.Visible = true;
            InitPanel.Visible = false;
        }
Ejemplo n.º 10
0
 protected void PMCalendar_SelectionChanged(object sender, EventArgs e)
 {
     CalendarBLL calendarBLL = new CalendarBLL();
     ArrayList events = calendarBLL.getEventsByDate(PMCalendar.SelectedDate, currentCalendar.getCalendarId());
     if (events.Count == 0)
     {
         TopMostMessageBox.Show("There are no events for this date.", PMCalendar.SelectedDate.ToString());
     }
     else
     {
         String eventsString = "";
         foreach (CalendarEvent calEvent in events)
         {
             eventsString += calEvent.getName() + ": " + calEvent.getStart().ToString() + " - " +
                     calEvent.getEnd().ToString() + System.Environment.NewLine;
         }
         TopMostMessageBox.Show(eventsString, PMCalendar.SelectedDate.ToString());
     }
 }
Ejemplo n.º 11
0
 private void populateViewCalendarDropDown()
 {
     CalendarBLL calendarBLL = new CalendarBLL();
     ArrayList calendarNames = calendarBLL.getCalendars();
     foreach (String name in calendarNames)
     {
         System.Diagnostics.Trace.WriteLine(name);
     }
     ViewDropDown.DataSource = calendarNames;
     ViewDropDown.DataBind();
 }
Ejemplo n.º 12
0
 public void deleteEventsByNameTest()
 {
     CalendarBLL target = new CalendarBLL(); // TODO: Initialize to an appropriate value
     string eventName = string.Empty; // TODO: Initialize to an appropriate value
     bool expected = false; // TODO: Initialize to an appropriate value
     bool actual;
     actual = target.deleteEventsByName(eventName);
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 13
0
 public void CalendarBLLConstructorTest()
 {
     CalendarBLL target = new CalendarBLL();
     Assert.IsNotNull(target);
 }
Ejemplo n.º 14
0
        protected void ViewCalendarClick(object sender, EventArgs e)
        {
            CalendarBLL calendarBLL = new CalendarBLL();
            String calendarToView = ViewDropDown.SelectedValue;
            ProjectManagerLibrary.Models.Calendar calendar = calendarBLL.getCalendarByName(calendarToView);
            currentCalendar.setCalendarName(calendarToView);
            currentCalendar.setCalendarId(calendar.getCalendarId());
            //currentCalendar.setProjectId(calendar.getProjectId());

            System.Diagnostics.Trace.WriteLine("Current calendar set at " + currentCalendar.getCalendarId());

            InitPanel.Visible = false;
            ViewCalendarPanel.Visible = true;
        }
Ejemplo n.º 15
0
 public void getCalendarByNameTest()
 {
     CalendarBLL target = new CalendarBLL();
     string calendarName = "UnitTestName";
     Calendar actual;
     actual = target.getCalendarByName(calendarName);
     Assert.IsNotNull(actual);
 }
Ejemplo n.º 16
0
 public void updateCalendarInfoTest()
 {
     CalendarBLL target = new CalendarBLL();
     string currentName = "UnitTestName";
     string newName = "UnitTestChangeName";
     bool expected = true;
     bool actual;
     actual = target.updateCalendarInfo(currentName, newName);
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 17
0
 public void getUsersTest()
 {
     CalendarBLL target = new CalendarBLL();
     ArrayList actual;
     actual = target.getUsers();
     Assert.IsNotNull(actual);
 }
Ejemplo n.º 18
0
 public void getCalendarIdByNameTest()
 {
     CalendarBLL target = new CalendarBLL();
     string calendarName = "UnitTestName";
     int expected = 1;
     int actual;
     actual = target.getCalendarIdByName(calendarName);
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 19
0
 public void getCalendarEventsTest()
 {
     CalendarBLL target = new CalendarBLL(); // TODO: Initialize to an appropriate value
     int calendarId = 0; // TODO: Initialize to an appropriate value
     ArrayList expected = null; // TODO: Initialize to an appropriate value
     ArrayList actual;
     actual = target.getCalendarEvents(calendarId);
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 20
0
 private void populateCalendarDropDown(DropDownList temp)
 {
     CalendarBLL calendarBLL = new CalendarBLL();
     ArrayList calendarNames = calendarBLL.getCalendars();
     temp.DataSource = calendarNames;
     temp.DataBind();
 }
Ejemplo n.º 21
0
 public void deleteCalendarTest()
 {
     CalendarBLL target = new CalendarBLL();
     string calendarToDelete = "UnitTestName";
     bool expected = true;
     bool actual;
     actual = target.deleteCalendar(calendarToDelete);
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 22
0
        protected void DeleteEvent(object sender, EventArgs e)
        {
            for (int i = 0; i < DeleteEventCheckBox.Items.Count; i ++) {
                if (DeleteEventCheckBox.Items[i].Selected) {
                    String eventName = DeleteEventCheckBox.Items[i].Text;
                    CalendarBLL calendarBLL = new CalendarBLL();
                    System.Diagnostics.Trace.WriteLine(eventName);
                    if (calendarBLL.deleteEventsByName(eventName))
                    {
                        TopMostMessageBox.Show(eventName + " successfully deleted.", "message");
                    }
                    else
                    {
                        TopMostMessageBox.Show("Could not delete " + eventName + ".", "message");
                    }
                }
            }

            DeleteEventPanel.Visible = false;
            InitPanel.Visible = true;
        }
Ejemplo n.º 23
0
 public void deleteEventsByCalendarIdTest()
 {
     CalendarBLL target = new CalendarBLL();
     int calendarToDelete = 1;
     bool expected = true;
     bool actual;
     actual = target.deleteEventsByCalendarId(calendarToDelete);
     Assert.AreEqual(expected, actual);
 }