Esempio n. 1
0
        public static void UnSignGroupFromCurriculum(TblGroups group, TblCurriculums curriculum)
        {
            List <TblPermissions> curriculumPermissions = ServerModel.DB.Query <TblPermissions>(
                new AndCondition(
                    new CompareCondition <int>(
                        DataObject.Schema.CurriculumRef,
                        new ValueCondition <int>(curriculum.ID), COMPARE_KIND.EQUAL),
                    new CompareCondition <int>(
                        DataObject.Schema.OwnerGroupRef,
                        new ValueCondition <int>(group.ID), COMPARE_KIND.EQUAL)));

            ServerModel.DB.Delete <TblPermissions>(curriculumPermissions);

            foreach (TblStages stage in TeacherHelper.StagesOfCurriculum(curriculum))
            {
                List <TblPermissions> stagePermissions = ServerModel.DB.Query <TblPermissions>(
                    new AndCondition(
                        new CompareCondition <int>(
                            DataObject.Schema.StageRef,
                            new ValueCondition <int>(stage.ID), COMPARE_KIND.EQUAL),
                        new CompareCondition <int>(
                            DataObject.Schema.OwnerGroupRef,
                            new ValueCondition <int>(group.ID), COMPARE_KIND.EQUAL)));

                ServerModel.DB.Delete <TblPermissions>(stagePermissions);
            }
        }
Esempio n. 2
0
        public static Table Sort(Table table, TblCurriculums curriculum)
        {
            Table           temp       = new Table();
            TableHeaderRow  headerRow  = new TableHeaderRow();
            TableHeaderCell headerCell = new TableHeaderCell();

            headerCell.Text = Translations.TeacherHelper_Sort_Student;
            headerRow.Cells.Add(headerCell);

            foreach (TblStages stage in TeacherHelper.StagesOfCurriculum(curriculum))
            {
                foreach (TblThemes theme in TeacherHelper.ThemesOfStage(stage))
                {
                    headerCell      = new TableHeaderCell();
                    headerCell.Text = theme.Name;
                    headerRow.Cells.Add(headerCell);
                }
            }
            headerCell      = new TableHeaderCell();
            headerCell.Text = Translations.TeacherHelper_Sort_Total;
            headerRow.Cells.Add(headerCell);

            headerCell      = new TableHeaderCell();
            headerCell.Text = Translations.TeacherHelper_Sort_Percent;
            headerRow.Cells.Add(headerCell);

            headerCell      = new TableHeaderCell();
            headerCell.Text = "ECTS";
            headerRow.Cells.Add(headerCell);

            temp.Rows.Add(headerRow);

            for (int i = 1; i < table.Rows.Count; i++)
            {
                int max = 0;
                int row = 0;
                for (int j = 1; j < table.Rows.Count; j++)
                {
                    if (Int32.Parse(table.Rows[j].Cells[table.Rows[j].Cells.Count - 2].Text) > max)
                    {
                        max = Int32.Parse(table.Rows[j].Cells[table.Rows[j].Cells.Count - 2].Text);
                        row = j;
                    }
                }
                temp.Rows.Add(table.Rows[row]);
                table.Rows.RemoveAt(row);
                i--;
            }
            return(temp);
        }
Esempio n. 3
0
        public static bool StageContainsTheme(int stageID, int orgID)
        {
            TblStages        stage = ServerModel.DB.Load <TblStages>(stageID);
            TblOrganizations org   = ServerModel.DB.Load <TblOrganizations>(orgID);

            foreach (TblThemes childThemes in TeacherHelper.ThemesOfStage(stage))
            {
                if (childThemes.OrganizationRef == org.ID)
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 4
0
        public static void SignGroupForCurriculum(TblGroups group, TblCurriculums curriculum)
        {
            PermissionsManager.Grand(curriculum, FxCurriculumOperations.View
                                     , null, group.ID, DateTimeInterval.Full);
            PermissionsManager.Grand(curriculum, FxCurriculumOperations.Pass
                                     , null, group.ID, DateTimeInterval.Full);

            foreach (TblStages stage in TeacherHelper.StagesOfCurriculum(curriculum))
            {
                PermissionsManager.Grand(stage, FxStageOperations.View
                                         , null, group.ID, DateTimeInterval.Full);
                PermissionsManager.Grand(stage, FxStageOperations.Pass
                                         , null, group.ID, DateTimeInterval.Full);
            }
        }
Esempio n. 5
0
        public static Table Search_Function(Table table, string Search_Name, TblCurriculums curriculum, List <TblCurriculums> curriculums, int GroupID, string RawUrl)
        {
            Table temp = new Table();

            if (curriculum != null)
            {
                TableHeaderRow  headerRow  = new TableHeaderRow();
                TableHeaderCell headerCell = new TableHeaderCell();
                headerCell.Text = Translations.TeacherHelper_Sort_Student;
                headerRow.Cells.Add(headerCell);

                foreach (TblStages stage in TeacherHelper.StagesOfCurriculum(curriculum))
                {
                    foreach (TblThemes theme in TeacherHelper.ThemesOfStage(stage))
                    {
                        headerCell      = new TableHeaderCell();
                        headerCell.Text = theme.Name;
                        headerRow.Cells.Add(headerCell);
                    }
                }
                headerCell      = new TableHeaderCell();
                headerCell.Text = Translations.TeacherHelper_Sort_Total;
                headerRow.Cells.Add(headerCell);

                headerCell      = new TableHeaderCell();
                headerCell.Text = Translations.TeacherHelper_Sort_Percent;
                headerRow.Cells.Add(headerCell);

                headerCell      = new TableHeaderCell();
                headerCell.Text = "ECTS";
                headerRow.Cells.Add(headerCell);

                temp.Rows.Add(headerRow);
            }
            else
            {
                TableHeaderRow headerRow = new TableHeaderRow();

                TableHeaderCell headerCell = new TableHeaderCell();
                headerCell.Text = Translations.TeacherHelper_Sort_Student;
                headerRow.Cells.Add(headerCell);



                foreach (TblCurriculums curr in curriculums)
                {
                    headerCell = new TableHeaderCell {
                        HorizontalAlign = HorizontalAlign.Center
                    };
                    headerCell.Controls.Add(new HyperLink
                    {
                        Text        = curr.Name,
                        NavigateUrl = ServerModel.Forms.BuildRedirectUrl(new IUDICO.DataModel.Controllers.StatisticShowController
                        {
                            GroupID      = GroupID,
                            CurriculumID = curr.ID,
                            BackUrl      = RawUrl
                        })
                    });
                    headerRow.Cells.Add(headerCell);
                }

                headerCell      = new TableHeaderCell();
                headerCell.Text = Translations.TeacherHelper_Sort_Total;
                headerRow.Cells.Add(headerCell);

                headerCell      = new TableHeaderCell();
                headerCell.Text = Translations.TeacherHelper_Sort_Percent;
                headerRow.Cells.Add(headerCell);

                headerCell      = new TableHeaderCell();
                headerCell.Text = "ECTS";
                headerRow.Cells.Add(headerCell);


                temp.Rows.Add(headerRow);
            }
            for (int i = 1; i < table.Rows.Count; i++)
            {
                string[] temp_array = table.Rows[i].Cells[0].Text.ToString().Split(' ');

                if (temp_array.Length == 2)
                {
                    if (Find_Student(Search_Name, temp_array[0], temp_array[1]) == true)
                    {
                        temp.Rows.Add(table.Rows[i]);
                        i--;
                    }
                }
                else
                {
                    if (Find_Student(Search_Name, temp_array[0], "") == true)
                    {
                        temp.Rows.Add(table.Rows[i]);
                    }
                }
            }


            return(temp);
        }