示例#1
0
        public MainPage(HymnsAttendance attendance)
        {
            InitializeComponent();

            Attendance = attendance;
            string[] weeklyBirthdays = Attendance.WeeklyBirthdays();
            for (int i = 0; i < weeklyBirthdays.Length; i++)
            {
                // add odds to leftStack else rightstack

                if (i % 2 == 0)
                {
                    LeftStack.Children.Add(new Label {
                        Text = weeklyBirthdays[i], FontSize = 17
                    });
                }

                else
                {
                    RightStack.Children.Add(new Label {
                        Text = weeklyBirthdays[i], FontSize = 17
                    });
                }
            }
            Classes.ItemsSource = classesToInterface(HymnsAttendance.OrderedClasses);
        }
示例#2
0
        public App()
        {
            InitializeComponent();

            Attendance = new HymnsAttendance();
            MainPage   = new NavigationPage(new MainPage(Attendance))
            {
                BarBackgroundColor = Color.FromHex("#4682B4"), BarTextColor = Color.White
            };
        }
 public GradeTabbedPage(HymnsAttendance attendance, string grade)
 {
     InitializeComponent();
     Children.Add(new GradeAttendance(attendance, grade)
     {
         Title = "Attendance"
     });
     Children.Add(new StudentInfo(attendance, grade)
     {
         Title = "Class Information"
     });
 }
        public GradeAttendance(HymnsAttendance attendance, string className)
        {
            InitializeComponent();
            DatePicker.MaximumDate = DateTime.Now;
            Attendance             = attendance;
            ClassName          = className;
            Backup             = new List <ViewCell>();
            TeacherBackup      = new List <ViewCell>();
            NamesTable         = new TableSection();
            TeachersNamesTable = new TableSection();

            InGrade = Attendance.StudentsOfGrade(ClassName);
            InitializeTeachers();
            InitializeStudents();
        }
        public EditAddTeacher(HymnsAttendance attendance, string id, string name, string className, bool add)
        {
            ToolbarItem item = new ToolbarItem();

            if (!add)
            {
                item.Text = name;
            }
            else
            {
                item.Text = "Add Teacher";
            }
            // "this" refers to a Page object
            this.ToolbarItems.Add(item);
            InitializeComponent();
            name           = string.IsNullOrEmpty(name) ? "" : Capitalize(name);
            Add            = add;
            ClassName      = className;
            Attendance     = attendance;
            NameEntry.Text = name;
            this.id        = id;

            Classes.ItemsSource = ClassesToInterface(HymnsAttendance.OrderedClasses);

            if (!add)
            {
                string[] info = Attendance.GetTeacherInfo(id);
                //name, phone, grade, parentName, parentPhone, birthday, photo, later
                string num    = info[1];
                string parsed = num.Length == 0 ? "" : "(" + num.Substring(0, 3) + ")-" + num.Substring(3, 3) + "-" + num.Substring(6);
                TeacherPhoneEntry.Text = info[1];
                //MM/dd
                int slash = info[2].IndexOf("/");

                BirthdayMonth.Text = info[2].Substring(0, slash);
                BirthdayDay.Text   = info[2].Substring(slash + 1);

                Classes.SelectedItem = parseName(className);
            }
        }
        public TeacherProfile(HymnsAttendance attendance, string id, string className)
        {
            Attendance = attendance;
            Id         = id;
            ClassName  = className;
            string[] teacherInfo = Attendance.GetTeacherInfo(Id);
            // name, phone, birthday
            ToolbarItem item = new ToolbarItem();

            item.Text = teacherInfo[0];

            InitializeComponent();


            var   stream         = Attendance.GetTeacherPhoto(id);
            Image profilePicture = new Image
            {
                Source = ImageSource.FromStream(() =>
                {
                    return(stream);
                })
            };

            if (stream == null)
            {
                profilePicture = new Image {
                    Source = "blankprofile.png", HeightRequest = 500, WidthRequest = 500
                };
            }

            storeInfo.Children.Add(profilePicture);
            Label lname = new Label {
                Text = "Teacher's Name:", TextColor = Color.SteelBlue, FontSize = 23
            };
            var ename = new Entry {
                Text = teacherInfo[0], IsReadOnly = true
            };

            storeInfo.Children.Add(lname);
            storeInfo.Children.Add(ename);

            Label lPhone = new Label {
                Text = "Teacher's Phone Number:", TextColor = Color.SteelBlue, FontSize = 23
            };
            string num    = teacherInfo[1];
            string parsed = num.Length == 0 ? "" : "(" + num.Substring(0, 3) + ")-" + num.Substring(3, 3) + "-" + num.Substring(6);
            var    ePhone = new Entry {
                Text = parsed, IsReadOnly = true
            };

            storeInfo.Children.Add(lPhone);
            storeInfo.Children.Add(ePhone);

            StackLayout slbirthday = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal, Spacing = 10
            };
            int slash = teacherInfo[2].IndexOf("/");

            Label lbirthday = new Label {
                Text = "Teacher's Birthday:", TextColor = Color.SteelBlue, FontSize = 23
            };
            var ebirthdayMonth = new Entry {
                Text = teacherInfo[2].Substring(0, slash), IsReadOnly = true
            };
            Label slashText = new Label()
            {
                Text = "/", FontSize = 23, TextColor = Color.SteelBlue
            };
            var ebirthdayDay = new Entry {
                Text = teacherInfo[2].Substring(slash + 1), IsReadOnly = true
            };

            slbirthday.Children.Add(ebirthdayMonth);
            slbirthday.Children.Add(slashText);
            slbirthday.Children.Add(ebirthdayDay);

            storeInfo.Children.Add(lbirthday);
            storeInfo.Children.Add(slbirthday);


            Label lclassName = new Label {
                Text = "Teacher's Class:", TextColor = Color.SteelBlue, FontSize = 23
            };
            //for the edit
            var eclassName = new Entry {
                Text = parseName(ClassName), IsReadOnly = true
            };

            storeInfo.Children.Add(lclassName);
            storeInfo.Children.Add(eclassName);
        }
 public CurriculumPage(HymnsAttendance attendance)
 {
     InitializeComponent();
     Attendance = attendance;
     PrintCurriculum();
 }
示例#8
0
        public EditAddStudent(HymnsAttendance attendance, string id, string name, string className, bool add)
        {
            ToolbarItem item = new ToolbarItem();

            if (!add)
            {
                item.Text = name;
            }
            else
            {
                item.Text = "Add Student";
                SwitchToTeacher.IsVisible = true;
            }

            // "this" refers to a Page object
            this.ToolbarItems.Add(item);
            InitializeComponent();

            Picture.Source = ImageSource.FromStream(() =>
            {
                var stream = Attendance.GetStudentPhoto(id);
                return(stream);
            });


            //add and edit cases
            name           = name == null ? "" : Capitalize(name);
            Add            = add;
            ClassName      = className;
            Attendance     = attendance;
            NameEntry.Text = name;
            this.id        = id;

            Classes.ItemsSource = ClassesToInterface(HymnsAttendance.OrderedClasses);

            if (!add)
            {
                string[] info = Attendance.GetStudentInfo(id);
                //name, phone, grade, parentName, parentPhone, birthday, photo, later
                //string num = info[1];
                //string parsed = num.Length == 0 ? "" : "(" + num.Substring(0, 3)
                //    + ")-" + num.Substring(3, 3) + "-" + num.Substring(6);

                StdPhoneEntry.Text = info[1];
                GradeEntry.Text    = info[2];

                ParentNameEntry.Text = info[3];
                //num = info[4];
                //parsed = num.Length == 0 ? "" : "(" + num.Substring(0, 3)
                //    + ")-" + num.Substring(3, 3) + "-" + num.Substring(6);
                ParentPhoneEntry.Text = info[4];

                //MM/dd
                int slash = info[5].IndexOf("/");

                BirthdayMonth.Text = info[5].Substring(0, slash);
                BirthdayDay.Text   = info[5].Substring(slash + 1);

                Classes.SelectedItem = parseName(ClassName);
            }
        }
示例#9
0
 public StudentInfo(HymnsAttendance attendance, string className)
 {
     InitializeComponent();
     Attendance = attendance;
     ClassName  = className;
 }