Exemplo n.º 1
0
        private void DecendingClicked(string obj)
        {
            List <ChildRecordsNewAssessment> reorderedList = new List <ChildRecordsNewAssessment>();

            if (obj.Equals("NameDecending"))
            {
                var list = ChildTestRecords.OrderByDescending(a => a.LastName);
                reorderedList = new List <ChildRecordsNewAssessment>(list);
            }
            else if (obj.Equals("DOBDecending"))
            {
                var list = ChildTestRecords.OrderByDescending(a => a.DOBDateField);
                reorderedList = new List <ChildRecordsNewAssessment>(list);
            }
            else if (obj.Equals("LocationDecending"))
            {
                var list = ChildTestRecords.OrderByDescending(a => a.Location);
                reorderedList = new List <ChildRecordsNewAssessment>(list);
            }
            else if (obj.Equals("EnrollmentDecending"))
            {
                var list = ChildTestRecords.OrderByDescending(a => a.EnrollmentDateField);
                reorderedList = new List <ChildRecordsNewAssessment>(list);
            }
            ChildTestRecords.Clear();
            ChildTestRecords = reorderedList;
        }
Exemplo n.º 2
0
        private void AscendingClicked(string obj)
        {
            List <ChildRecordsNewAssessment> reorderedList = new List <ChildRecordsNewAssessment>();

            if (obj.Equals("NameAscending"))
            {
                var list = ChildTestRecords.OrderBy(a => a.LastName);
                reorderedList = new List <ChildRecordsNewAssessment>(list);
            }
            else if (obj.Equals("DOBAscending"))
            {
                var list = ChildTestRecords.OrderBy(a => a.DOBDateField);
                reorderedList = new List <ChildRecordsNewAssessment>(list);
            }
            else if (obj.Equals("LocationAscending"))
            {
                var list = ChildTestRecords.OrderBy(a => a.Location);
                reorderedList = new List <ChildRecordsNewAssessment>(list);
            }
            else if (obj.Equals("EnrollmentAscending"))
            {
                var list = ChildTestRecords.OrderBy(a => a.EnrollmentDateField);
                reorderedList = new List <ChildRecordsNewAssessment>(list);
            }
            else if (obj.Equals("ChildAscendingDecending"))
            {
                bool isAscending = (ChildTestRecords.SequenceEqual(ChildTestRecords.OrderBy(a => a.ChildID))) ? true : false;
                reorderedList = isAscending ? new List <ChildRecordsNewAssessment>(ChildTestRecords.OrderByDescending(a => a.ChildID)) : new List <ChildRecordsNewAssessment>(ChildTestRecords.OrderBy(a => a.ChildID));
            }
            ChildTestRecords.Clear();
            ChildTestRecords = reorderedList;
        }
Exemplo n.º 3
0
        public async Task LoadChildRecordsFromDBAsync()
        {
            int addedBy;

            IsTableBottomLineVisible = true;
            var initialChildRecords = new List <ChildRecordsNewAssessment>();

            if (Application.Current.Properties.ContainsKey("UserID"))
            {
                var isSuccess = int.TryParse(Application.Current.Properties["UserID"].ToString(), out addedBy);
                if (isSuccess)
                {
                    var childRecords  = (_studentService.GetStudentsByOfflineID(addedBy));
                    var hasPermission = await userPermissionService.GetStudentEditPermissionsAsync() || Application.Current.Properties["UserTypeID"].ToString() == "1" || Application.Current.Properties["UserTypeID"].ToString() == "6";

                    if (childRecords != null)
                    {
                        foreach (var childRecord in childRecords)
                        {
                            if (childRecord.SelectedLocationId.HasValue && AllLocations != null && AllLocations.Any() && AllLocations.Where(p => p.IsEnabled).Any(p => p.LocationId == childRecord.SelectedLocationId.Value))
                            {
                                initialChildRecords.Add(new ChildRecordsNewAssessment()
                                {
                                    IsChildEditEnable = hasPermission || childRecord.AddedBy == addedBy,
                                    AddRfIconImage    = hasPermission || childRecord.AddedBy == addedBy ? "icon_add_record.png" : "icon_add_record_gray.png",
                                    OfflineStudentId  = childRecord.OfflineStudentID,
                                    FirstName         = childRecord.FirstName,
                                    LastName          = childRecord.LastName,
                                    ChildID           = childRecord.ChildID,
                                    ChildUserID       = childRecord.UserId,
                                    LocationID        = (childRecord.SelectedLocationId == null) ? 0 : Convert.ToInt32(childRecord.SelectedLocationId),
                                    DOB        = childRecord.Birthdate.ToString("MM/dd/yyyy"),
                                    Enrollment = childRecord.EnrollmentDate != DateTime.MinValue ? childRecord.EnrollmentDate.ToString("MM/dd/yyyy") : "",
                                    Location   = AllLocations != null && AllLocations.Any() && childRecord.SelectedLocationId != null ? AllLocations.FirstOrDefault(p => p.LocationId == childRecord.SelectedLocationId.Value)?.LocationName : "",
                                });
                            }
                        }
                        var list = initialChildRecords.OrderBy(a => a.LastName + a.FirstName);
                        initialChildRecords = new List <ChildRecordsNewAssessment>(list);
                    }
                }
            }
            ChildTestRecords.Clear();
            ChildTestRecords = initialChildRecords;

            SearchErrorVisible = true;
            SearchResult       = string.Format(ErrorMessages.RecordsFoundMessage, ChildTestRecords.Count(), ChildTestRecords.Count() == 1 ? "Match" : "Matches");
        }
Exemplo n.º 4
0
        private void UpdateChildRecordTableBounds(double listviewheight)
        {
            double rowHeight      = 0.0;
            double totalRowHeight = 0.0;

            if (ChildTestRecords.Any())
            {
                rowHeight      = ChildTestRecords.FirstOrDefault().RowHeight;
                totalRowHeight = ChildTestRecords.Count() * rowHeight;
            }
            if (totalRowHeight > listviewheight)
            {
                IsTableBottomLineVisible = true;
            }
            else if (ChildTestRecords.Count > 0)
            {
                ChildTestRecords[ChildTestRecords.Count - 1].IsTableSepartorVisble = true;
                IsTableBottomLineVisible = false;
            }
        }
Exemplo n.º 5
0
        public async void SearchClicked(string dob, string enrollmentDate)
        {
            var searchChildRecords = new List <ChildRecordsNewAssessment>();
            var isMorethan1000     = false;

            await LoadChildRecordsFromDBAsync();

            if (!string.IsNullOrEmpty(FirstName) || !string.IsNullOrEmpty(LastName) || (SelectedLocations != null && SelectedLocations.Any()) || !string.IsNullOrEmpty(dob) || !string.IsNullOrEmpty(enrollmentDate) || !string.IsNullOrEmpty(ChildID))
            {
                IEnumerable <ChildRecordsNewAssessment> query = ChildTestRecords;

                if (!string.IsNullOrEmpty(FirstName))
                {
                    query = query.Where(p => !string.IsNullOrEmpty(p.FirstName) && p.FirstName.ToLower().Contains(FirstName.ToLower()));
                }
                if (!string.IsNullOrEmpty(LastName))
                {
                    query = query.Where(p => !string.IsNullOrEmpty(p.LastName) && p.LastName.ToLower().Contains(LastName.ToLower()));
                }
                if (!string.IsNullOrEmpty(ChildID))
                {
                    query = query.Where(p => !string.IsNullOrEmpty(p.ChildID) && p.ChildID.ToLower().Contains(ChildID.ToLower()));
                }
                if (!string.IsNullOrEmpty(dob))
                {
                    query = query.Where(p => !string.IsNullOrEmpty(p.DOB) && p.DOB == dob);
                }
                if (!string.IsNullOrEmpty(enrollmentDate))
                {
                    query = query.Where(p => !string.IsNullOrEmpty(p.Enrollment) && p.Enrollment == enrollmentDate);
                }
                if (SelectedLocations.Count > 0)
                {
                    query = query.Where(p => !string.IsNullOrEmpty(p.Location) && SelectedLocations.Contains(p.Location));
                }

                searchChildRecords = new List <ChildRecordsNewAssessment>(query);
            }
            else
            {
                searchChildRecords = ChildTestRecords;
            }


            if (!searchChildRecords.Any())
            {
                SearchResult       = ErrorMessages.RecordMatchesFoundMessage;
                SearchErrorColor   = Color.Red;
                SearchErrorVisible = true;
            }
            else
            {
                SearchResult       = string.Format(ErrorMessages.RecordsFoundMessage, searchChildRecords.Count(), searchChildRecords.Count() == 1 ? "Match" : "Matches");
                SearchErrorColor   = Color.Black;
                SearchErrorVisible = true;
                if (searchChildRecords.Count > 1000)
                {
                    isMorethan1000     = true;
                    SearchResult       = ErrorMessages.SearchError;
                    SearchErrorColor   = Color.Red;
                    SearchErrorVisible = true;
                }
                else if (searchChildRecords.Count > 5)
                {
                    searchChildRecords[searchChildRecords.Count - 1].IsTableSepartorVisble = false;
                }
                else
                {
                    searchChildRecords[searchChildRecords.Count - 1].IsTableSepartorVisble = true;
                    IsTableBottomLineVisible = false;
                }
                if (SelectAll)
                {
                    int index = 0;
                    foreach (var record in searchChildRecords)
                    {
                        index++;
                    }
                }
            }
            var list          = searchChildRecords.OrderBy(a => a.LastName);
            var reorderedList = new List <ChildRecordsNewAssessment>(list);

            ChildTestRecords.Clear();
            if (!isMorethan1000)
            {
                ChildTestRecords = reorderedList;
            }
        }