예제 #1
0
        public override void doit()
        {
            AppForm.CURR_OCTT_DOC.TeachersRootNode.Nodes.Remove(_teacher);
            AppForm.getAppForm().getTeachersTreeView().SelectedNode = AppForm.CURR_OCTT_DOC.TeachersRootNode;
            AppForm.getAppForm().getTeachersTreeView().SelectedNode.EnsureVisible();

            if (HardConstraintChecks.checkIfTitleOfTeacherIsFreeForDelete(_teacher))
            {
                AppForm.CURR_OCTT_DOC.TeacherTitlesList.Remove(_teacher.getTitle());
            }

            if (HardConstraintChecks.checkIfEduRankOfTeacherIsFreeForDelete(_teacher))
            {
                AppForm.CURR_OCTT_DOC.TeacherEduRanksList.Remove(_teacher.getEduRank());
            }

            AppForm.getAppForm().getTreeTabControl().SelectedIndex = 1;
        }
예제 #2
0
        public override void doit()
        {
            AppForm.CURR_OCTT_DOC.TeachersRootNode.Nodes.Add(_teacher);
            AppForm.getAppForm().getTeachersTreeView().SelectedNode = _teacher;
            AppForm.getAppForm().getTeachersTreeView().SelectedNode.EnsureVisible();
            AppForm.CURR_OCTT_DOC.TeachersRootNode.Expand();

            if (!AppForm.CURR_OCTT_DOC.TeacherTitlesList.Contains(_teacher.getTitle()))
            {
                AppForm.CURR_OCTT_DOC.TeacherTitlesList.Add(_teacher.getTitle());
                AppForm.CURR_OCTT_DOC.TeacherTitlesList.Sort();
            }

            if (!AppForm.CURR_OCTT_DOC.TeacherEduRanksList.Contains(_teacher.getEduRank()))
            {
                AppForm.CURR_OCTT_DOC.TeacherEduRanksList.Add(_teacher.getEduRank());
                AppForm.CURR_OCTT_DOC.TeacherEduRanksList.Sort();
            }

            AppForm.getAppForm().getTreeTabControl().SelectedIndex = 1;
        }
예제 #3
0
        public TeacherPropertiesForm(Teacher teacher) : this()
        {
            _isNew   = false;
            _teacher = teacher;

            this._nameTextBox.Text     = _teacher.getName();
            this._lastnameTextBox.Text = _teacher.getLastName();
            this._extIDTextBox.Text    = _teacher.ExtID;

            this._titleComboBox.SelectedItem   = _teacher.getTitle();
            this._eduRankComboBox.SelectedItem = _teacher.getEduRank();
        }
예제 #4
0
        public ChangeTeacherDataCmd(Teacher teacher, string newName, string newLastName, string newTitle, string newEduRank, string newExtID)
        {
            _teacher = teacher;

            _oldName     = _teacher.getName();
            _oldLastName = _teacher.getLastName();
            _oldTitle    = _teacher.getTitle();
            _oldEduRank  = _teacher.getEduRank();
            _oldExtID    = _teacher.ExtID;

            _newName     = newName;
            _newLastName = newLastName;
            _newTitle    = newTitle;
            _newEduRank  = newEduRank;
            _newExtID    = newExtID;
        }
예제 #5
0
        public static bool checkIfTitleOfTeacherIsFreeForDelete(Teacher myTeacher)
        {
            bool isFree = true;

            foreach (Teacher teacher in AppForm.CURR_OCTT_DOC.TeachersRootNode.Nodes)
            {
                if (teacher != myTeacher)
                {
                    if (teacher.getTitle() == myTeacher.getTitle())
                    {
                        isFree = false;
                        break;
                    }
                }
            }

            return(isFree);
        }
예제 #6
0
        private static void createTableRow(XGraphics gfx, Teacher teacher)
        {
            XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always);
            XBrush          brush   = XBrushes.Black;
            XStringFormat   format  = new XStringFormat();

            format.LineAlignment = XLineAlignment.Center;

            XPen   xpen   = new XPen(XColors.Black, 0.5);
            XBrush xbrush = XBrushes.Bisque;

            XRect rect;
            XFont font;

            int currX = X_START - 30;

            string ordinalNum = ROW_COUNTER.ToString() + ".";

            rect             = new XRect(currX, CURR_Y, 28, ROW_HEIGHT);
            font             = new XFont("Arial", 10, XFontStyle.Regular, options);
            format.Alignment = XStringAlignment.Far;
            //gfx.DrawRectangle(xpen, xbrush, rect);
            gfx.DrawString(ordinalNum, font, brush, rect, format);

            currX = X_START;

            string teacherLastName = teacher.getLastName();

            rect             = new XRect(currX, CURR_Y, COL_WIDTH[0], ROW_HEIGHT);
            font             = new XFont("Arial", 10, XFontStyle.Regular, options);
            format.Alignment = XStringAlignment.Near;
            //gfx.DrawRectangle(xpen, xbrush, rect);
            gfx.DrawString(teacherLastName, font, brush, rect, format);

            currX += COL_WIDTH[0] + COL_GAP;

            string teacherName = teacher.getName();

            rect = new XRect(currX, CURR_Y, COL_WIDTH[1], ROW_HEIGHT);
            //gfx.DrawRectangle(xpen, xbrush, rect);
            gfx.DrawString(teacherName, font, brush, rect, format);

            currX += COL_WIDTH[1] + COL_GAP;

            string teacherTitle = teacher.getTitle();

            rect = new XRect(currX, CURR_Y, COL_WIDTH[2], ROW_HEIGHT);
            //gfx.DrawRectangle(xpen, xbrush, rect);
            gfx.DrawString(teacherTitle, font, brush, rect, format);

            currX += COL_WIDTH[2] + COL_GAP;

            string teacherEduRank = teacher.getEduRank();

            rect = new XRect(currX, CURR_Y, COL_WIDTH[3], ROW_HEIGHT);
            //gfx.DrawRectangle(xpen, xbrush, rect);
            gfx.DrawString(teacherEduRank, font, brush, rect, format);

            currX += COL_WIDTH[3] + COL_GAP;

            string teacherExtID = teacher.ExtID;

            rect = new XRect(currX, CURR_Y, COL_WIDTH[4], ROW_HEIGHT);
            //gfx.DrawRectangle(xpen, xbrush, rect);
            gfx.DrawString(teacherExtID, font, brush, rect, format);

            gfx.DrawLine(xpen, X_START - 20, CURR_Y + ROW_HEIGHT + 2, X_START + 475, CURR_Y + ROW_HEIGHT + 2);

            CURR_Y += ROW_HEIGHT + 4;
        }
예제 #7
0
        public void importDataForTTStart(DataSet ds)
        {
            AppForm.CURR_OCTT_DOC = new OCTTDocument();

            DataTable dtDocumentProperties = ds.Tables["DocumentProperties"];
            DataRow   drDP = dtDocumentProperties.Rows[0];

            AppForm.CURR_OCTT_DOC.EduInstitutionName = (string)drDP["DocEduInstitutionName"];
            AppForm.CURR_OCTT_DOC.SchoolYear         = (string)drDP["DocSchoolYear"];
            AppForm.CURR_OCTT_DOC.DocumentType       = System.Convert.ToInt32(drDP["DocType"]);
            AppForm.CURR_OCTT_DOC.DocumentVersion    = (string)drDP["DocVersion"];

            //included days
            DataTable dtIncludedDays = ds.Tables["IncludedDays"];
            ArrayList dl             = new ArrayList();

            foreach (DataRow dr in dtIncludedDays.Rows)
            {
                int d = System.Convert.ToInt16(dr["DayIndexInWeek"]) - 1;
                dl.Add(d);
            }

            for (int n = 0; n < 7; n++)
            {
                if (dl.Contains(n))
                {
                    AppForm.CURR_OCTT_DOC.setIsDayIncluded(n, true);
                }
                else
                {
                    AppForm.CURR_OCTT_DOC.setIsDayIncluded(n, false);
                }
            }

            //included terms
            DataTable dtIncludedTerms = ds.Tables["IncludedTerms"];

            int[] oneT;
            AppForm.CURR_OCTT_DOC.IncludedTerms.Clear();
            foreach (DataRow dr in dtIncludedTerms.Rows)
            {
                oneT    = new int[4];
                oneT[0] = System.Convert.ToInt32(dr["StartH"]);
                oneT[1] = System.Convert.ToInt32(dr["StartM"]);
                oneT[2] = System.Convert.ToInt32(dr["EndH"]);
                oneT[3] = System.Convert.ToInt32(dr["EndM"]);

                AppForm.CURR_OCTT_DOC.IncludedTerms.Add(oneT);
            }

            //teachers
            DataTable dtTeachers = ds.Tables["Teachers"];
            Hashtable htTeachers = new Hashtable();

            foreach (DataRow dr in dtTeachers.Rows)
            {
                int     tID     = System.Convert.ToInt16(dr["ID"]);
                Teacher teacher = new Teacher((string)dr["Name"], (string)dr["Lastname"], (string)dr["Title"], (string)dr["EduRank"], (string)dr["ExtId"]);

                AppForm.CURR_OCTT_DOC.TeachersRootNode.Nodes.Add(teacher);
                htTeachers.Add(tID, teacher);

                if (!AppForm.CURR_OCTT_DOC.TeacherTitlesList.Contains(teacher.getTitle()))
                {
                    AppForm.CURR_OCTT_DOC.TeacherTitlesList.Add(teacher.getTitle());
                }

                if (!AppForm.CURR_OCTT_DOC.TeacherEduRanksList.Contains(teacher.getEduRank()))
                {
                    AppForm.CURR_OCTT_DOC.TeacherEduRanksList.Add(teacher.getEduRank());
                }
            }

            AppForm.CURR_OCTT_DOC.TeacherTitlesList.Sort();
            AppForm.CURR_OCTT_DOC.TeacherEduRanksList.Sort();
            AppForm.CURR_OCTT_DOC.TeachersRootNode.ExpandAll();


            //rooms
            DataTable dtRooms = ds.Tables["Rooms"];

            foreach (DataRow dr in dtRooms.Rows)
            {
                Room room = new Room((string)dr["Name"], System.Convert.ToInt32(dr["Capacity"]), (string)dr["ExtId"]);
                AppForm.CURR_OCTT_DOC.RoomsRootNode.Nodes.Add(room);
            }

            AppForm.CURR_OCTT_DOC.RoomsRootNode.Expand();


            //EPGs, EPs, courses
            DataTable dtEduProgramGroups = ds.Tables["EduProgramGroups"];
            DataTable dtEduPrograms      = ds.Tables["EduPrograms"];
            DataTable dtCourses          = ds.Tables["Courses"];

            foreach (DataRow drepg in dtEduProgramGroups.Rows)
            {
                string name = (string)drepg["Name"];
                string extid;
                if (drepg["ExtId"] != null)
                {
                    extid = (string)drepg["ExtId"];
                }
                else
                {
                    extid = "";
                }

                EduProgramGroup newEPG = new EduProgramGroup(name, extid);
                AppForm.CURR_OCTT_DOC.CoursesRootNode.Nodes.Add(newEPG);

                DataRow[] drep = drepg.GetChildRows(ds.Relations["EPG_EP"]);
                foreach (DataRow r in drep)
                {
                    string semester;
                    string code;
                    string extidop;
                    if (r["Semester"] != null)
                    {
                        semester = (string)r["Semester"];
                    }
                    else
                    {
                        semester = "";
                    }

                    if (r["Code"] != null)
                    {
                        code = (string)r["Code"];
                    }
                    else
                    {
                        code = "";
                    }

                    if (r["ExtId"] != null)
                    {
                        extidop = (string)r["ExtId"];
                    }
                    else
                    {
                        extidop = "";
                    }

                    EduProgram newEP = new EduProgram((string)r["Name"], semester, code, extidop);
                    newEPG.Nodes.Add(newEP);

                    DataRow[] drc = r.GetChildRows(ds.Relations["EP_Courses"]);
                    foreach (DataRow rc in drc)
                    {
                        int teacherID;

                        string groupName;
                        string extidc;

                        int    numoflessperweek;
                        int    numofenrstud;
                        string courseType;

                        Teacher myTeacher;
                        teacherID = System.Convert.ToInt32(rc["TeacherID"]);

                        myTeacher = (Teacher)htTeachers[teacherID];

                        numoflessperweek = System.Convert.ToInt32(rc["NumOfLessPerWeek"]);
                        numofenrstud     = System.Convert.ToInt32(rc["NumOfEnrolledStud"]);
                        courseType       = (string)rc["CourseType"];

                        if (rc["GroupName"] != null)
                        {
                            groupName = System.Convert.ToString(rc["GroupName"]);
                        }
                        else
                        {
                            groupName = "";
                        }

                        bool isGroup;
                        if (groupName == null || groupName == "")
                        {
                            isGroup = false;
                        }
                        else
                        {
                            isGroup = true;
                        }


                        if (rc["ExtId"] != null)
                        {
                            extidc = (string)rc["ExtId"];
                        }
                        else
                        {
                            extidc = "";
                        }

                        Course newCourse = new Course((string)rc["Name"], (string)rc["ShortName"], myTeacher, numoflessperweek, numofenrstud, isGroup, groupName, extidc, courseType);
                        newEP.Nodes.Add(newCourse);

                        if (!AppForm.CURR_OCTT_DOC.CourseTypesList.Contains(courseType))
                        {
                            AppForm.CURR_OCTT_DOC.CourseTypesList.Add(courseType);
                        }

                        AppForm.CURR_OCTT_DOC.incrUnallocatedLessonsCounter(numoflessperweek);

                        for (int k = 0; k < numoflessperweek; k++)
                        {
                            ListViewItem lvi = new ListViewItem();
                            lvi.Tag = newCourse;
                            newEP.getUnallocatedLessonsList().Add(lvi);
                        }
                    }
                }

                AppForm.CURR_OCTT_DOC.CoursesRootNode.Expand();
                foreach (EduProgramGroup epg in AppForm.CURR_OCTT_DOC.CoursesRootNode.Nodes)
                {
                    epg.Expand();
                }

                AppForm.CURR_OCTT_DOC.CourseTypesList.Sort();
                AppForm.getAppForm().getStatusBarPanel2().Text = AppForm.CURR_OCTT_DOC.getNumOfUnallocatedLessonsStatusText();
            }

            AppForm.getAppForm().doNewDocAction();
        }