예제 #1
0
        //TESTING
        private static List<StudentModel> BuildList(int p)
        {
            List<StudentModel> li = new List<StudentModel>();

            for (int i = 0; i < 100; i++)
            {

                int rand = new Random(i).Next(0, Boys.Count() - 1);
                string grade = getGrade(rand);
                int Sclass = getSclass(rand);
                var health = getHealth(rand);
                var pickUpOptions2 = getPickUp(rand);
                StudentModel s = new StudentModel()
                {
                    BirthDay = DateTime.Now,
                    BirthDayString = DateTime.Now.ToShortDateString(),
                    CheckedIn = new CheckedInOutModel(),
                    FirstName = Boys[rand],
                    LastName = Girls[rand],
                    Gender = (rand > 20) ? "Male" : "Female",
                    Grade = grade,
                    SClass = Sclass.ToString(),
                    StudentID = i.ToString(),
                    HealthIssues = health,
                    HealthIssuesString = string.Join(",", health),
                    HomeNum = "03-5555555",
                    Img = "",
                    IsPickedUp = false,
                    LastUpdateTime = DateTime.Now,
                    Parent1Email = "*****@*****.**",
                    Parent1Name = Boys[rand],
                    Parent2Name = Girls[rand],
                    Parent1Num = "052-1234567",
                    Parent2Num = "052-7654321",
                    PickUp = new CheckedInOutModel(),
                    PickUpFrom = "nada",
                    PickUpOptions = pickUpOptions2
                };
                li.Add(s);
            }
            return li;
        }
예제 #2
0
        internal static List<StudentModel> GetStudentsData()
        {
            List<StudentModel> students = new List<StudentModel>();
            ApplicationContext.Instnace.contextInstance.students.ToList().ForEach(s =>
                {
                    contacts contact = InMemoryHandler.GetContactById(s.student_concacts_id);
                    contacts parentA = InMemoryHandler.GetContactById(s.parent_a_contacts_id);
                    contacts parentB = InMemoryHandler.GetContactById(s.parent_b_contacts_id);

                    if (contact == null)
                    {
                        return;
                    }

                    CheckedInOutModel checkedIn = InMemoryHandler.Today_CheckedIn.Where(stud => stud.StuedntContactId == contact.id).FirstOrDefault();
                    CheckedInOutModel pickedUp= InMemoryHandler.Today_PickedUp.Where(stud => stud.StuedntContactId == contact.id).FirstOrDefault();

                    StudentModel student = new StudentModel
                    {
                        StudentContactID = contact.id,
                        BirthDay = s.birthday ?? DateTime.MinValue,
                        BranchId = s.branch_id ?? 0,
                        FirstName = contact.first_name,
                        LastName = contact.last_name,
                        SClass = s.@class,
                        Grade = s.grade,
                        HomeNum = contact.phone_home,
                        Img = contact.image,
                        StudentID = contact.user_id,
                        PickUpOptions = (s.pick_up_options != null) ? s.pick_up_options.Split(',').ToList() : null,
                        Gender = Utils.Utils.GetGender(s.gender),
                        CheckedIn = checkedIn,
                        PickUp = pickedUp,
                        IsPickedUp = pickedUp!=null
                    };
                    if (parentA != null)
                    {
                        student.Parent1Email = parentA.email_1;
                        student.Parent1Name = parentA.first_name + " " + parentA.first_name;
                        student.Parent1Num = parentA.phone_mobile;
                    }
                    if (parentB != null)
                    {
                        student.Parent2Email = parentB.email_1;
                        student.Parent2Name = parentB.first_name + " " + parentA.first_name;
                        student.Parent2Num = parentB.phone_mobile;
                    }

                    students.Add(student);
                });
            return students;
        }