Пример #1
0
        public JsonResult RetrieveSPFs(int pupilID)
        {
            if (IsAuthorized())
            {
                Teacher user = VaKEGradeRepository.Instance.GetTeacher(((Teacher)Session["User"]).ID);
                Session["User"] = user;
                Pupil pupil = VaKEGradeRepository.Instance.GetPupil(pupilID);
                //Session["SelPupilID"] = pupil.ID;
                if (pupil != null)
                {
                    List<Database.SPF> spfs = pupil.SPFs.ToList();
                    GridData gData = new GridData() { page = 1 };
                    List<RowData> rows = new List<RowData>();
                    Session["pupilID"] = pupilID;

                    foreach (SPF spf in spfs)
                    {
                        rows.Add(new RowData() { id = spf.ID, cell = new string[] { spf.Subject.Name, spf.Level.ToString() } });
                    }

                    gData.records = rows.Count();
                    gData.total = rows.Count();
                    gData.rows = rows.ToArray();

                    return Json(gData, JsonRequestBehavior.AllowGet);
                }
                return null;
            }
            return null;
        }
Пример #2
0
        public JsonResult RetrieveAllStudents()
        {
            if (IsAuthorized()) {
                Teacher user = VaKEGradeRepository.Instance.GetTeacher(((Teacher)Session["User"]).ID);
                Session["User"] = user;
                List<Database.Pupil> pupils = user.PrimaryClasses.First().Pupils.ToList();

                GridData gData = new GridData() { page = 1 };
                List<RowData> rows = new List<RowData>();

                foreach (Database.Pupil pupil in pupils)
                {
                    rows.Add(new RowData() { id = pupil.ID, cell = new string[] { pupil.LastName, pupil.FirstName, pupil.Religion, pupil.Birthdate.ToShortDateString(), pupil.Gender } });
                }

                gData.records = rows.Count();
                gData.total = rows.Count();
                gData.rows = rows.ToArray();
                return Json(gData, JsonRequestBehavior.AllowGet);
            }
            return null;
        }
Пример #3
0
        public JsonResult RetrieveClassList()
        {
            if (IsAuthorized())
            {
                try
                {
                    List<Database.SchoolClass> classes = VaKEGrade.Database.VaKEGradeRepository.Instance.GetClasses().ToList<Database.SchoolClass>();

            GridData gData = new GridData() { page = 1 };
            List<RowData> rows = new List<RowData>();

            foreach (Database.SchoolClass sclass in classes)
            {
                rows.Add(new RowData() { id = sclass.ID, cell = new string[] { sclass.Level.ToString(), sclass.Name, sclass.PrimaryClassTeacher.LastName } });
            }

            gData.records = rows.Count();
            gData.total = rows.Count();
            gData.rows = rows.ToArray();

            JsonResult jres = Json(gData, JsonRequestBehavior.AllowGet);

            return jres;
                }
                catch (Exception e) { }
            }
            ViewData["error"] = "Bitte melden sie sich am System an";
            return null;
        }
Пример #4
0
        public JsonResult RetrieveSubjects()
        {
            if (IsAuthorized())
            {
                List<Database.Subject> subjects = VaKEGrade.Database.VaKEGradeRepository.Instance.GetSubjects().ToList<Database.Subject>();
                GridData gData = new GridData() { page = 1 };
                List<RowData> rows = new List<RowData>();

                string obligatoryTranlation = "";

                foreach (Database.Subject subject in subjects)
                {
                    if (subject.IsVoluntary)
                    {
                        obligatoryTranlation = "Nein";
                    }
                    else
                    {
                        obligatoryTranlation = "Ja";
                    }
                    //List<Database.Subject> subjects = branch.BranchSubjectAssignments.Select(x => x.Subject).Distinct().ToList();
                    rows.Add(new RowData() { id = subject.ID, cell = new string[] { subject.Name, obligatoryTranlation, subject.SPFs.Count.ToString() } });
                }

                gData.records = rows.Count();
                gData.total = rows.Count();
                gData.rows = rows.ToArray();

                JsonResult jres = Json(gData, JsonRequestBehavior.AllowGet);

                return jres;
            }
            ViewData["error"] = "Bitte melden sie sich am System an";
            return null;
        }
Пример #5
0
        public JsonResult RetrieveAllSubjects()
        {
            if (IsAuthorized())
            {
                List<Database.Pupil> pupils = VaKEGrade.Database.VaKEGradeRepository.Instance.GetPupils().ToList<Database.Pupil>();
                GridData gData = new GridData() { page = 1 };
                List<RowData> rows = new List<RowData>();

                foreach (Database.Pupil pupil in pupils)
                {
                    rows.Add(new RowData() { id = pupil.ID, cell = new string[] { pupil.LastName, pupil.FirstName, pupil.Birthdate.ToString(), pupil.Gender } });
                }

                gData.records = rows.Count();
                gData.total = rows.Count();
                gData.rows = rows.ToArray();

                JsonResult jres = Json(gData, JsonRequestBehavior.AllowGet);

                return jres;
            }
            ViewData["error"] = "Bitte melden sie sich am System an";
            return null;
        }