Exemplo n.º 1
0
        /// <summary>
        /// Method called by the SPFGrid to add/update/delete an SPF
        /// </summary>
        /// <param name="editedSPF">The SPF to be added/updated/deleted</param>
        public void EditSPF(SPF editedSPF, Pupil pupil, string extraparam)
        {
            string oper = Request.Params.Get("oper");
            string pupilID = Session["pupilID"].ToString();
            if (IsAuthorized())
            {
                //var spfModel = GenerateGrids().SpfGrid;

                if (oper == "edit")
                {
                    SPF spfToUpdate = VaKEGradeRepository.Instance.GetSPF(editedSPF.ID);

                    spfToUpdate.SubjectID = editedSPF.SubjectID;

                    spfToUpdate.Level = editedSPF.Level;

                    VaKEGradeRepository.Instance.Update();
                }
                if (oper == "add")
                {
                     VaKEGradeRepository.Instance.AssignSPF(Convert.ToInt32(pupilID), Convert.ToInt32(editedSPF.SubjectID), editedSPF.Level);
                }
                if (oper == "del")
                {
                    VaKEGradeRepository.Instance.DeleteSPF(editedSPF.ID);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method called by jqGrid to add/update/delete a student
        /// </summary>
        /// <param name="editedPupil">The student to be added/updated/deleted</param>
        public void EditStudent(Database.Pupil editedPupil)
        {
            if (IsAuthorized())
            {
                try
                {
                    //var pupilModel = GenerateGrids().PupilGrid;
                    string oper = Request.Params.Get("oper");
                    if (oper == "edit")
                    {
                        Database.Pupil pupilToUpdate = Database.VaKEGradeRepository.Instance.GetPupil(editedPupil.ID);

                        pupilToUpdate.FirstName = editedPupil.FirstName;
                        pupilToUpdate.LastName = editedPupil.LastName;
                        pupilToUpdate.Birthdate = editedPupil.Birthdate;
                        pupilToUpdate.Religion = editedPupil.Religion;
                        pupilToUpdate.Gender = editedPupil.Gender;

                        Database.VaKEGradeRepository.Instance.Update();
                    }
                    if (oper == "add")
                    {
                        Pupil newPupil = new Pupil();
                        newPupil.FirstName = editedPupil.FirstName;
                        newPupil.LastName = editedPupil.LastName;
                        newPupil.Religion = editedPupil.Religion;
                        newPupil.Birthdate = editedPupil.Birthdate;
                        newPupil.Gender = editedPupil.Gender;
                        newPupil.SchoolClass = ((Teacher)Session["User"]).PrimaryClasses.First();
                        VaKEGradeRepository.Instance.AddPupil(newPupil);
                    }
                    if (oper == "del")
                    {
                        VaKEGradeRepository.Instance.DeletePupil(editedPupil.ID);
                    }
                }
                catch (Exception) {

                }
            }
        }
Exemplo n.º 3
0
 private void AddMockGrades(Pupil pupil)
 {
     foreach (BranchSubjectAssignment bsa in pupil.SchoolClass.Branch.BranchSubjectAssignments.Where(x=>x.Level==pupil.SchoolClass.Level)) {
         foreach(SubjectArea sa in bsa.Subject.SubjectAreas){
             AssignNewGrade(pupil, sa, 0);
         }
     }
 }
Exemplo n.º 4
0
 public void AddPupil(Pupil pupil)
 {
     entities.AddToPupils(pupil);
     AddMockGrades(pupil);
     entities.SaveChanges();
 }
Exemplo n.º 5
0
 public IEnumerable<Grade> GetGradesOfPupil(Pupil pupil, Subject subject)
 {
     return (from grade in pupil.Grades
             where grade.SubjectArea.SubjectID == subject.ID
             orderby grade.SubjectArea.Name descending
             select grade);
 }
Exemplo n.º 6
0
 public IEnumerable<Subject> GetSubjectsOfPupil(Pupil pupil)
 {
     return (from bsa in pupil.SchoolClass.Branch.BranchSubjectAssignments
             where bsa.Level == pupil.SchoolClass.Level
             select bsa.Subject).ToList();
 }
Exemplo n.º 7
0
 public void AssignSPF(Pupil pupil, Subject subject, int level)
 {
     entities.AddToSPFs(new SPF() { Pupil = pupil, Subject = subject, Level = level });
     entities.SaveChanges();
 }
Exemplo n.º 8
0
 public void AssignVoluntarySubject(Pupil pupil, Subject subject)
 {
     entities.AddToVoluntarySubjectAssignements(new VoluntarySubjectAssignement() { Pupil = pupil, Subject = subject });
     entities.SaveChanges();
 }
Exemplo n.º 9
0
 public void AssignNewGrade(Pupil pupil, SubjectArea subjectArea, int grade)
 {
     entities.AddToGrades(new Grade() { Pupil = pupil, SubjectArea = subjectArea, Value = grade });
     entities.SaveChanges();
 }
Exemplo n.º 10
0
 public void AssignSPF(Pupil pupil, Subject subject)
 {
     entities.AddToSPFs(new SPF() { Pupil = pupil, Subject = subject, Level = pupil.SchoolClass.Level });
     entities.SaveChanges();
 }
Exemplo n.º 11
0
        public void GeneratePupils()
        {
            string[] religions = new string[] { "römisch-katholisch", "muslimisch", "ohne Bekenntnis", "Zeuge Jehova", "buddhistisch", "evangelisch" };

            List<SchoolClass> sc = repository.GetClasses().ToList();

            Random random;
            Pupil pupil;
            for (int i = 0; i < 100; i++)
            {
                random = new Random();
                pupil = new Pupil();
                if (random.Next(0, 2) == 0)
                {
                    pupil.Gender = "m";
                    pupil.FirstName = mFirstNames[random.Next(0, mFirstNames.Length)];
                }
                else
                {
                    pupil.Gender = "w";
                    pupil.FirstName = wFirstNames[random.Next(0, wFirstNames.Length)];
                }
                pupil.LastName = lastNames[random.Next(0, lastNames.Length)];
                pupil.Religion = religions[random.Next(0, religions.Length)];
                pupil.Birthdate = new DateTime(DateTime.Now.AddYears(-random.Next(11, 15)).Year, random.Next(1, 13), random.Next(1, 28));
                List<SchoolClass> pc = repository.GetClasses().Where(x=>x.Level==DateTime.Now.Year-pupil.Birthdate.Year-10).ToList();

                pupil.SchoolClass = pc[random.Next(0, pc.Count)];
                repository.AddPupil(pupil);

                foreach(Subject subject in pupil.SchoolClass.Branch.BranchSubjectAssignments.Where(x=>x.Level==pupil.SchoolClass.Level).Select(x=>x.Subject).Distinct().ToList()){
                    foreach (SubjectArea area in subject.SubjectAreas.ToList()) {
                        repository.AssignGrade(pupil.ID, area.ID, random.Next(1, 6));
                    }
                }
            }
        }
Exemplo n.º 12
0
        private static void GenerateCertificate(Pupil pupil, SchoolClass schoolClass, string schoolYear, ref Document document)
        {
            Paragraph paragraph;
            PdfPTable table;
            PdfPCell cell;

            paragraph = new Paragraph("HAUPTSCHULE 1 RIED IM INNKREIS", FontFactory.GetFont("Arial", 14f, 1));
            paragraph.Alignment = 1;
            document.Add(paragraph);

            table = new PdfPTable(1);
            cell = new PdfPCell(new Paragraph("Brucknerstraße 20, 4910 Ried im Innkreis", FontFactory.GetFont("Arial", 7f, 0)));
            cell.BorderWidthLeft = 0;
            cell.BorderWidthRight = 0;
            cell.BorderWidthTop = 0;
            cell.BorderWidthBottom = 0.5f;
            cell.BorderColorBottom = BaseColor.BLACK;
            cell.PaddingBottom = 5;
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            table.AddCell(cell);
            table.WidthPercentage = 100f;
            document.Add(table);

            //paragraph = new Paragraph("Brucknerstraße 20, 4910 Ried im Innkreis", FontFactory.GetFont("Arial", 10f, 0));
            //paragraph.Alignment = 1;
            //paragraph.SpacingAfter = 12;
            //document.Add(paragraph);

            table = new PdfPTable(2);
            cell = new PdfPCell(new Paragraph("Alternative Form der Leistungsbeurteilung gemäß § 78 SchUG", FontFactory.GetFont("Arial", 7f, 0)));
            cell.BorderWidth = 0;
            cell.Padding = 0;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            table.AddCell(cell);
            cell = new PdfPCell(new Paragraph("Schuljahr " + schoolYear, FontFactory.GetFont("Arial", 7f, 0)));
            cell.BorderWidth = 0;
            cell.Padding = 0;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);
            table.WidthPercentage = 100f;
            table.SpacingAfter = 10;
            document.Add(table);

            paragraph = new Paragraph("Jahreszeugnis", FontFactory.GetFont("Arial", 24f, 0));
            paragraph.Alignment = 1;
            document.Add(paragraph);

            paragraph = new Paragraph("VaKE-Klasse", FontFactory.GetFont("Arial", 12f, 0));
            paragraph.Alignment = 1;
            paragraph.SpacingAfter = 8;
            document.Add(paragraph);

            paragraph = new Paragraph(pupil.LastName.ToUpper() + " " + pupil.FirstName, FontFactory.GetFont("Arial", 14f, 1));
            paragraph.Alignment = 1;
            paragraph.SpacingAfter = 8;
            document.Add(paragraph);

            paragraph = new Paragraph("geboren am " + pupil.Birthdate.ToShortDateString() + ", Religionsbekenntnis: " + pupil.Religion, FontFactory.GetFont("Arial", 11f, 0));
            paragraph.Alignment = 1;
            paragraph.SpacingAfter = 3;
            document.Add(paragraph);

            paragraph = new Paragraph((pupil.Gender == "m" ? "Schüler" : "Schülerin") + " der Klasse " + schoolClass.Level + schoolClass.Name + " (" + (schoolClass.Level + 4) + ".Schulstufe), Hauptschule", FontFactory.GetFont("Arial", 11f, 0));
            paragraph.Alignment = 1;
            paragraph.SpacingAfter = 3;
            document.Add(paragraph);

            paragraph = new Paragraph("Verhalten in der Schule: ", FontFactory.GetFont("Arial", 12f, 0));
            paragraph.Add(new Chunk("Sehr zufriedenstellend", FontFactory.GetFont("Arial", 11f, 1)));
            paragraph.Alignment = 0;
            paragraph.SpacingAfter = 10;
            document.Add(paragraph);

            document.Add(CertificateGenerator.GenerateImage(pupil));

            if (pupil.BindingSubjectAssignments.Count > 0)
            {
                List<Subject> bindingSubjects = (from vsa in pupil.BindingSubjectAssignments
                                                   select vsa.Subject).ToList();
                string subjects = "";
                for(int i = 0; i < bindingSubjects.Count; i++)
                {
                    subjects += (bindingSubjects.Count > 1 && i == bindingSubjects.Count-1 ? " und " : " ") + "\"" + bindingSubjects[i].Name + "\""+(i < bindingSubjects.Count-2 ? "," : "");
                }
                subjects.Remove(subjects.Length - 1,1);

                paragraph = new Paragraph((pupil.Gender == "m" ? "Er" : "Sie") + " hat an "+(bindingSubjects.Count > 1 ? "den" : "der")+" verbindlichen "+(bindingSubjects.Count > 1 ? "Übungen" : "Übung") + subjects + " teilgenommen.", FontFactory.GetFont("Arial", 9f, 0));
                paragraph.Alignment = 0;
                paragraph.SpacingBefore = 5;
                paragraph.SpacingAfter = 0;
                document.Add(paragraph);
            }

            if (pupil.VoluntarySubjectAssignements.Count > 0)
            {
                List<Subject> voluntarySubjects = (from vsa in pupil.VoluntarySubjectAssignements
                                                   select vsa.Subject).ToList();
                string subjects = "";
                for (int i = 0; i < voluntarySubjects.Count; i++)
                {
                    subjects += (voluntarySubjects.Count > 1 && i == voluntarySubjects.Count - 1 ? " und " : " ") + "\"" + voluntarySubjects[i].Name + "\"" + (i < voluntarySubjects.Count - 2 ? "," : "");
                }
                subjects.Remove(subjects.Length - 1);

                paragraph = new Paragraph((pupil.Gender == "m" ? "Er" : "Sie") + " hat an " + (voluntarySubjects.Count > 1 ? "den" : "der") + " freiwilligen " + (voluntarySubjects.Count > 1 ? "Übungen " : "Übung ") + subjects + " teilgenommen.", FontFactory.GetFont("Arial", 9f, 0));
                paragraph.Alignment = 0;
                paragraph.SpacingBefore = 5;
                paragraph.SpacingAfter = 0;
                document.Add(paragraph);
            }

            paragraph = new Paragraph((pupil.Gender == "m" ? "Er" : "Sie") + " ist gemäß §25 des SchUG zum Aufsteigen in die " + (schoolClass.Level + 1) + ".Klasse (" + (schoolClass.Level + 5) + ".Schulstufe) berechtigt.", FontFactory.GetFont("Arial", 9f, 0));
            paragraph.Alignment = 0;
            paragraph.SpacingBefore = 30;
            paragraph.SpacingAfter = 50;
            document.Add(paragraph);

            paragraph = new Paragraph("Ried im Innkreis, am " + DateTime.Now.ToShortDateString(), FontFactory.GetFont("Arial", 10f, 0));
            paragraph.Alignment = 0;
            paragraph.SpacingAfter = 30;
            document.Add(paragraph);

            paragraph = new Paragraph("R.S.", FontFactory.GetFont("Arial", 10f, 1));
            paragraph.Alignment = 1;
            paragraph.SpacingAfter = 25;
            document.Add(paragraph);

            table = new PdfPTable(2);
            cell = new PdfPCell(new Paragraph("__________________________", FontFactory.GetFont("Arial", 10f, 0)));
            cell.BorderWidth = 0;
            cell.Padding = 0;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            table.AddCell(cell);

            cell = new PdfPCell(new Paragraph("__________________________", FontFactory.GetFont("Arial", 10f, 0)));
            cell.BorderWidth = 0;
            cell.Padding = 0;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);

            cell = new PdfPCell(new Paragraph("Leiter der Schule", FontFactory.GetFont("Arial", 7f, 0)));
            cell.PaddingTop = 3;
            cell.BorderWidth = 0;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            table.AddCell(cell);

            cell = new PdfPCell(new Paragraph("Klassenvorstand", FontFactory.GetFont("Arial", 7f, 0)));
            cell.PaddingTop = 3;
            cell.BorderWidth = 0;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);

            cell = new PdfPCell(new Paragraph("Max Mustermann", FontFactory.GetFont("Arial", 9f, 0)));
            cell.BorderWidth = 0;
            cell.Padding = 0;
            cell.BorderWidthLeft = 0;
            cell.BorderWidthRight = 0;
            cell.BorderWidthTop = 0;
            cell.BorderWidthBottom = 0.5f;
            cell.BorderColorBottom = BaseColor.BLACK;
            cell.PaddingBottom = 12;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            table.AddCell(cell);

            cell = new PdfPCell(new Paragraph(schoolClass.PrimaryClassTeacher.FirstName + " " + schoolClass.PrimaryClassTeacher.LastName, FontFactory.GetFont("Arial", 9f, 0)));
            cell.BorderWidth = 0;
            cell.Padding = 0;
            cell.BorderWidthLeft = 0;
            cell.BorderWidthRight = 0;
            cell.BorderWidthTop = 0;
            cell.BorderWidthBottom = 0.5f;
            cell.BorderColorBottom = BaseColor.BLACK;
            cell.PaddingBottom = 12;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            table.AddCell(cell);
            table.WidthPercentage = 100f;
            table.SpacingAfter = 10;
            document.Add(table);

            paragraph = new Paragraph("DVR: 0064351412052\nBeurteilungskriterien: Lernziele (LZ), Mitarbeit (MA)\nBeurteilungsstufen: Sehr gut (1), Gut (2), Befriedigend (3), Genügend (4), Nicht genügend (5), Nicht teilgenommen (0)\nVerhalten in der Schule: Sehr zufriedenstellend, Zufriedenstellend, Wenig zufriedenstellend, Nicht zufriedenstellend\n", FontFactory.GetFont("Arial", 7f, 0));
            paragraph.Add(new Chunk(pupil.LastName.ToUpper() + " " + pupil.FirstName, FontFactory.GetFont("Arial", 7f, 2)));
            paragraph.Alignment = 0;
            document.Add(paragraph);

            document.NewPage();
        }
Exemplo n.º 13
0
        private static iTextSharp.text.Image GenerateImage(Pupil pupil)
        {
            Chart chart = new Chart();
            chart.RenderType = RenderType.ImageTag;
            chart.AntiAliasing = AntiAliasingStyles.All;
            chart.TextAntiAliasingQuality = TextAntiAliasingQuality.High;
            chart.Font.Size = 20;

            //chart.Titles.Add(pupil.FirstName + " " + pupil.LastName);
            //chart.Titles[0].Font = new System.Drawing.Font("Arial", 16f);

            List<Subject> subjects = VaKEGradeRepository.Instance.GetSubjectsOfPupil(pupil).ToList();

            foreach (Subject subject in subjects)
            {
                ChartArea chartArea = new ChartArea(subject.Name);
                chartArea.AxisX = new Axis();
                chartArea.AxisY = new Axis();
                chartArea.AxisY.Maximum = 5;
                chartArea.AxisY.Minimum = 0;
                chartArea.AxisY.CustomLabels.Add(new CustomLabel(0, 1, "5", 0, LabelMarkStyle.None));
                chartArea.AxisY.CustomLabels.Add(new CustomLabel(1, 2, "4", 0, LabelMarkStyle.None));
                chartArea.AxisY.CustomLabels.Add(new CustomLabel(2, 3, "3", 0, LabelMarkStyle.None));
                chartArea.AxisY.CustomLabels.Add(new CustomLabel(3, 4, "2", 0, LabelMarkStyle.None));
                chartArea.AxisY.CustomLabels.Add(new CustomLabel(4, 5, "1", 0, LabelMarkStyle.None));
                chartArea.AxisY.CustomLabels.Add(new CustomLabel(0, 5, subject.Name, 1, LabelMarkStyle.Box));
                //chartArea.AxisX.TitleFont = new System.Drawing.Font("Arial", 18f);
                //chartArea.AxisY.TitleFont = new System.Drawing.Font("Arial", 18f);
                //chartArea.AxisX.LabelStyle.Font = new System.Drawing.Font("Arial", 18f);
                //chartArea.AxisX.LabelStyle.Angle = -90;
                chartArea.BackColor = System.Drawing.Color.White;

                Series series = new Series("");
                series.ChartType = SeriesChartType.Column;
                series.XValueType = ChartValueType.String;
                series.YValueType = ChartValueType.Int32;
                series.ChartArea = chartArea.Name;

                chart.Series.Add("");
                foreach (Grade grade in VaKEGradeRepository.Instance.GetGradesOfPupil(pupil,subject))
                {
                    series.Points.AddXY(grade.SubjectArea.Name, 6-grade.Value);
                }

                chart.ChartAreas.Add(chartArea);
                chart.Series.Add(series);
            }

            chart.Width = Unit.Pixel(1000);
            chart.Height = Unit.Pixel(250*subjects.Count);
            MemoryStream stream = new MemoryStream();
            chart.SaveImage(stream, ChartImageFormat.Tiff);
            stream.Seek(0,SeekOrigin.Begin);
            iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(stream);
            stream.Close();

            img.ScaleAbsolute(500, 125 * subjects.Count);
            return img;
        }
Exemplo n.º 14
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Pupils EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPupils(Pupil pupil)
 {
     base.AddObject("Pupils", pupil);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Create a new Pupil object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="firstName">Initial value of the FirstName property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 /// <param name="religion">Initial value of the Religion property.</param>
 /// <param name="gender">Initial value of the Gender property.</param>
 /// <param name="classID">Initial value of the ClassID property.</param>
 /// <param name="birthdate">Initial value of the Birthdate property.</param>
 public static Pupil CreatePupil(global::System.Int32 id, global::System.String firstName, global::System.String lastName, global::System.String religion, global::System.String gender, global::System.Int32 classID, global::System.DateTime birthdate)
 {
     Pupil pupil = new Pupil();
     pupil.ID = id;
     pupil.FirstName = firstName;
     pupil.LastName = lastName;
     pupil.Religion = religion;
     pupil.Gender = gender;
     pupil.ClassID = classID;
     pupil.Birthdate = birthdate;
     return pupil;
 }