Beispiel #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Do any additional setup after loading the view.
            var listHours = new List <string>(new string[] { "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16" });
            var students  = Backendoptions.GetAllStudents();
            var subjects  = Backendoptions.GetSubjects();
            var classes   = Backendoptions.GetClasses();
            var parents   = Backendoptions.GetAllParents();
            var teachers  = Backendoptions.GetTeachers();
            var rooms     = Backendoptions.GetRooms();
            var units     = Backendoptions.GetUnits();
            var profiles  = Backendoptions.GetProfiles();
            var status    = Backendoptions.GetStatuses();

            if (Backendoptions.IsParent())
            {
                string stringinfo = "dzieci pod moją opieką:\n";
                var    child      = Backendoptions.GetChildren();
                foreach (var ch in child)
                {
                    stringinfo = stringinfo + " " + ch + ",";
                }
                PMyInfo.StringValue       = stringinfo.Remove(stringinfo.Length - 1);
                PChildList.UsesDataSource = true;
                PChildList.DataSource     = new MyCombo(child);
                PChildList.Editable       = false;
                PChildList.SelectItem(0);
                if (Backendoptions.IsChildSet())
                {
                    PNotes.StringValue         = Backendoptions.GetMyChildPresance(); //Yes, presance - i've done a mistake while creating names in a builder
                    PPresance.StringValue      = Backendoptions.GetMyChildNotes();    //so here are notes
                    PWarnings.StringValue      = Backendoptions.GetMyChildWarnings();
                    PLegitimize.UsesDataSource = true;
                    PLegitimize.DataSource     = new MyCombo(Backendoptions.GetAbsence());
                }
            }
            else
            {
                if (Backendoptions.IsAdmin())
                {
                    AStList.StringValue  = Backendoptions.GetAllStudentsData();
                    AParList.StringValue = Backendoptions.GetAllParentsData();

                    ATeaList.StringValue   = Backendoptions.GetAllTeachersData();
                    AAUnitH.UsesDataSource = true;
                    AAUnitH.DataSource     = new MyCombo(listHours);
                    AAUnitH.Editable       = false;
                    AAUnitH.SelectItem(0);
                    AAddStClass.UsesDataSource   = true;
                    AAddStClass.DataSource       = new MyCombo(classes);
                    AAddStClass.Editable         = false;
                    AGrillParent.UsesDataSource  = true;
                    AGrillStudent.UsesDataSource = true;
                    AGrillStudent.DataSource     = new MyCombo(students);
                    AGrillStudent.Editable       = false;
                    AGrillParent.DataSource      = new MyCombo(parents);
                    AGrillParent.Editable        = false;

                    ACForm.UsesDataSource  = true;
                    ACClass.UsesDataSource = true;
                    ACForm.DataSource      = new MyCombo(teachers);
                    ACForm.Editable        = false;

                    ACClass.DataSource       = new MyCombo(classes);
                    ACClass.Editable         = false;
                    AALessSub.UsesDataSource = true;
                    AALessUH.UsesDataSource  = true;
                    AALessRR.UsesDataSource  = true;
                    AALessDay.UsesDataSource = true;
                    AALessClL.UsesDataSource = true;
                    var listDay = new List <string>(new string[] { "1", "2", "3", "4", "5", "6" });
                    AALessDay.DataSource = new MyCombo(listDay);
                    AALessDay.Editable   = false;
                    AALessDay.SelectItem(0);
                    AALessSub.DataSource = new MyCombo(subjects);
                    AALessSub.Editable   = false;
                    AALessRR.DataSource  = new MyCombo(rooms);
                    AALessRR.Editable    = false;
                    if (rooms.Count > 0)
                    {
                        AALessRR.SelectItem(0);
                    }
                    AALessUH.DataSource = new MyCombo(units);
                    AALessUH.Editable   = false;
                    AALessUH.SelectItem(0);
                    AALessClL.DataSource          = new MyCombo(classes);
                    AALessClL.Editable            = false;
                    AAClassProfile.UsesDataSource = true;
                    AAClassProfile.DataSource     = new MyCombo(profiles);
                    AAClassProfile.Editable       = false;

                    AAClassForm.UsesDataSource = true;
                    AAClassForm.DataSource     = new MyCombo(teachers);
                    AAClassForm.Editable       = false;
                    ADelPar.UsesDataSource     = true;
                    ADelPar.DataSource         = new MyCombo(parents);
                    ADelPar.Editable           = false;
                    ADelSt.UsesDataSource      = true;
                    ADelSt.DataSource          = new MyCombo(students);
                    ADelSt.Editable            = false;

                    ADelTea.UsesDataSource = true;
                    ADelTea.DataSource     = new MyCombo(teachers);
                    ADelTea.Editable       = false;

                    AChSt.UsesDataSource = true;
                    AChSt.DataSource     = new MyCombo(students);
                    AChSt.Editable       = false;

                    AchCl.UsesDataSource        = true;
                    AchCl.DataSource            = new MyCombo(classes);
                    AchCl.Editable              = false;
                    ADelGrillPar.UsesDataSource = true;
                    ADelGrillPar.DataSource     = new MyCombo(parents);
                    ADelGrillPar.Editable       = false;
                    ADelGrillSt.UsesDataSource  = true;
                    ADelGrillSt.DataSource      = new MyCombo(students);
                    ADelGrillSt.Editable        = false;
                    if (classes.Count > 0)
                    {
                        AAddStClass.SelectItem(0);
                        ACClass.SelectItem(0);
                        AALessClL.SelectItem(0);
                        AchCl.SelectItem(0);
                    }
                    if (students.Count > 0)
                    {
                        AGrillStudent.SelectItem(0);
                        ADelGrillSt.SelectItem(0);
                        AChSt.SelectItem(0);
                        ADelSt.SelectItem(0);
                    }
                    if (parents.Count > 0)
                    {
                        AGrillParent.SelectItem(0);
                        ADelPar.SelectItem(0);
                        ADelGrillPar.SelectItem(0);
                    }
                    if (teachers.Count > 0)
                    {
                        ADelTea.SelectItem(0);
                        ACForm.SelectItem(0);
                        AAClassForm.SelectItem(0);
                    }
                }
                else
                {
                    if (Backendoptions.IsTeacher())
                    {
                        TClass.UsesDataSource = true;
                        TClass.DataSource     = new MyCombo(classes);
                        TClass.Editable       = false;
                        if (Backendoptions.IsClassSet())
                        {
                            if (Backendoptions.GetStudents().Count != 0)
                            {
                                var classstudents = Backendoptions.GetStudents();
                                TWSt.UsesDataSource   = true;
                                TWSt.DataSource       = new MyCombo(classstudents);
                                TWSt.Editable         = false;
                                TNSt.UsesDataSource   = true;
                                TNSt.DataSource       = new MyCombo(classstudents);
                                TNSt.Editable         = false;
                                TPreSt.UsesDataSource = true;
                                TPreSt.DataSource     = new MyCombo(classstudents);
                                TPreSt.Editable       = false;
                                TWSt.SelectItem(0);
                                TNSt.SelectItem(0);
                                TPreSt.SelectItem(0);
                                TCNSt.UsesDataSource = true;
                                TCNSt.DataSource     = new MyCombo(classstudents);
                                TCNSt.Editable       = false;
                                TCNSt.SelectItem(0);
                                string studentsstring = "", presance = "";
                                foreach (var st in classstudents)
                                {
                                    studentsstring = studentsstring + st + "\n";
                                }
                                TCheckStudent.StringValue  = studentsstring;
                                TCheckStudent.Editable     = false;
                                TCheckPresance.StringValue = presance;
                                TCNDesc.UsesDataSource     = true;
                                TCNDesc.DataSource         = new MyCombo(Backendoptions.GetLastNotes());
                                TCNDesc.Editable           = false;
                                var best = Backendoptions.GetTopThree();
                                TBest1.StringValue      = best;
                                TPreUnit.UsesDataSource = true;
                                TPreUnit.DataSource     = new MyCombo(Backendoptions.LastLessonsForClass());
                                TPreUnit.Editable       = false;
                            }
                        }
                        TNVal.UsesDataSource = true;
                        TNCat.UsesDataSource = true;
                        TNSub.UsesDataSource = true;
                        var values = new List <string>(new string[] { "1", "2", "2.5", "3", "3.5", "4", "4.5", "5", "5.5", "6" });
                        TNVal.DataSource        = new MyCombo(values);
                        TNVal.Editable          = false;
                        TCNVal.UsesDataSource   = true;
                        TCNVal.DataSource       = new MyCombo(values);
                        TCNVal.Editable         = false;
                        TNSub.DataSource        = new MyCombo(subjects);
                        TNSub.Editable          = false;
                        TNCat.DataSource        = new MyCombo(Backendoptions.GetCategories());
                        TNCat.Editable          = false;
                        TPreStat.UsesDataSource = true;
                        TPrUnit.UsesDataSource  = true;
                        TPrUnit.DataSource      = new MyCombo(units);
                        TPrUnit.Editable        = false;
                        TPreStat.DataSource     = new MyCombo(status);
                        TPreStat.Editable       = false;
                        TClass.SelectItem(0);
                        TNVal.SelectItem(0);
                        TNSub.SelectItem(0);
                        TNCat.SelectItem(0);
                        TPreStat.SelectItem(0);
                        TPrUnit.SelectItem(0);
                        TCNVal.SelectItem(0);
                    }
                    else
                    {
                        if (Backendoptions.IsStudent())
                        {
                            var warning = Backendoptions.GetMydWarnings();
                            SWarnings.StringValue = warning.Item1;
                            SPoints.StringValue   = warning.Item2.ToString();
                            SNotes.StringValue    = Backendoptions.GetMyNotes();
                            SPresance.StringValue = Backendoptions.GetMyPresance();
                            SyInfo.StringValue    = Backendoptions.GetMyStudentInfo();
                        }
                    }
                }
            }
        }