Ejemplo n.º 1
0
        // ## add semester from menu

        /// <summary>
        /// The semesterToolStripMenuItem method is used to instantiate the SemesterAdd
        /// Form and handle some other functionality.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void semesterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //suspend current window, load new semester add window
            this.SuspendLayout();
            SemesterAdd newSemester = new SemesterAdd(ref semesterList);

            newSemester.ShowDialog();

            //check if action was canceled ie. is getSemester null?
            if (newSemester.Semester == null)
            {
                return;
            }

            //add the new semester to a reference
            Semester semester = newSemester.Semester;

            //add new semester object to semester list
            semesterList.Add(semester);

            //create dictionary entry for prescheduleing
            preScheduleDict.Add(semester, new List <Course>());

            //update viewer
            updateSemesterViewer();
        }
Ejemplo n.º 2
0
        // Add new item
        public Semester AddSemester(SemesterAdd Semester)
        {
            // Map from DTO object to domain (POCO) object
            var p = ds.Semesters.Add(Mapper.Map <ICTGWS.Models.Semester>(Semester));

            ds.SaveChanges();
            // Map to DTO object
            return(Mapper.Map <Semester>(p));
        }