Example #1
0
 public BasicReportViewModel()
 {
     _locationService         = DependencyService.Get <ILocationService>();
     _studentService          = DependencyService.Get <IStudentsService>();
     _clinicalTestFormService = DependencyService.Get <IClinicalTestFormService>();
     _commonDataService       = DependencyService.Get <ICommonDataService>();
     _studentTestFormsService = DependencyService.Get <IStudentTestFormsService>();
     GetLocations();
 }
Example #2
0
 public AssessmentConfigPopupViewModel(int offlineStudentId)
 {
     _commonDataService      = DependencyService.Get <ICommonDataService>();
     studentTestFormsService = DependencyService.Get <IStudentTestFormsService>();
     clinicalTestFormService = DependencyService.Get <IClinicalTestFormService>();
     _studentService         = DependencyService.Get <IStudentsService>();
     _orgRecordFormService   = DependencyService.Get <IOrgRecordFormService>();
     OfflineStudentId        = offlineStudentId;
     StartAssessmentCommand  = new Command(StartAssessmentClicked);
 }
        public ChildInformationpageViewModel(int offlineStudentId)
        {
            productResearchCodeValuesService = DependencyService.Get <IProductResearchCodeValuesService>();
            productResearchCodesService      = DependencyService.Get <IProductResearchCodesService>();

            userPermissionService   = DependencyService.Get <IUserPermissionService>();
            studentTestFormsService = DependencyService.Get <IStudentTestFormsService>();
            commonDataService       = DependencyService.Get <ICommonDataService>();
            locationService         = DependencyService.Get <ILocationService>();
            clinicalTestFormService = DependencyService.Get <IClinicalTestFormService>();
            OfflineStudentId        = offlineStudentId;
            EditCommand             = new Command(EditClicked);
            AddNewRecordCommand     = new Command(AddNew);
            HyperLinkClickedCommand = new Xamarin.Forms.Command <ChildInformationRecord>(HyperlinkClicked);

            _studentService = DependencyService.Get <IStudentsService>();
            _tokenService   = DependencyService.Get <ITokenService>();
            var tokenModel = _tokenService.GetTokenResposne();

            if (tokenModel != null)
            {
                UserFullName = "" + tokenModel.FirstName + "  " + "" + tokenModel.LastName + "";
            }

            FailedString  = "Failed: 0";
            PendingString = "Pending: 0";
            Task.Run(async() => { await LoadData(OfflineStudentId); });
            LoadTestRecordsFromDB(OfflineStudentId);

            if (Connectivity.NetworkAccess != NetworkAccess.Internet)
            {
                foreach (var child in ChildInformationRecords)
                {
                    child.EnableRow = false;
                }
                EnableSync = false;
            }
            else
            {
                if (ChildInformationRecords.Any(p => p.Status != "Not started") && ChildInformationRecords.Any(p => p.IsSelect))
                {
                    EnableSync = true;
                }
            }
            Connectivity.ConnectivityChanged -= Connectivity_ConnectivityChanged;
            Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;

            commonDataService.ClearAddChildContent = ResetContent;
        }
Example #4
0
        public TestSessionOverViewModel(bool isReport = false)
        {
            IsDevelopmentalBasicReport = isReport;
            if (IsDevelopmentalBasicReport)
            {
                Title         = "BDI-3 Developmental Complete Basic Report";
                IsDateVisible = false;
            }
            else
            {
                Title         = "Test Session Overview";
                IsDateVisible = true;
            }
            commonDataService       = DependencyService.Get <ICommonDataService>();
            studentTestFormsService = DependencyService.Get <IStudentTestFormsService>();
            LocalformInstanceId     = commonDataService.LocaInstanceID;
            GetExaminerDetails();
            clinicalTestFormService = DependencyService.Get <IClinicalTestFormService>();
            ProgramLabel            = "Select a program label";
            GetProgramNotes();
            if (IsDevelopmentalBasicReport)
            {
                if (ProgramLabel == "Select a program label")
                {
                    ProgramLabel = string.Empty;
                }
            }

            var domains = default(List <ContentCategory>);

            if (commonDataService.IsCompleteForm)
            {
                domains = new List <ContentCategory>(commonDataService.BattleCategories);
                if (domains != null && domains.Any())
                {
                    var parentCategories = domains.Where(p => p.parentContentCategoryId == 0).OrderBy(p => p.sequenceNo);
                    if (parentCategories != null && parentCategories.Any())
                    {
                        var bdi3ScoringParser = Bdi3ScoringParser.GetInstance();
                        foreach (var parentCategory in parentCategories)
                        {
                            TestSessionRecords.Add(new TestSessionModel()
                            {
                                Domain = parentCategory.name, IsDateVisible = false
                            });
                            var childCategories = domains.Where(p => p.parentContentCategoryId == parentCategory.contentCategoryId).OrderBy(p => p.sequenceNo);
                            if (childCategories != null && childCategories.Any())
                            {
                                foreach (var childCategory in childCategories)
                                {
                                    var sessionmodel = new TestSessionModel()
                                    {
                                        ContentCategoryId = childCategory.contentCategoryId, ParentDomainCode = parentCategory.code, DomainCode = childCategory.code, LoadDomainBasedQuestionsAction = NavigateandRelaodQuestions, Domain = childCategory.name, TestDate = "mm/dd/yyyy", Examiner = "Select Examiner", Status = "Complete", IsDateVisible = true, DomainMargin = new Thickness(17, 0, 0, 0)
                                    };
                                    if (commonDataService.StudentTestForms != null && commonDataService.StudentTestForms.Any())
                                    {
                                        var testform = commonDataService.StudentTestForms.FirstOrDefault(p => p.contentCategoryId == childCategory.contentCategoryId);
                                        if (testform != null)
                                        {
                                            sessionmodel.IsScoreSelected   = testform.IsScoreSelected;
                                            sessionmodel.ContentCategoryId = childCategory.contentCategoryId;
                                            sessionmodel.TestDate          = testform.testDate;
                                            sessionmodel.Notes             = testform.Notes;
                                            sessionmodel.Status            = testform.TSOStatus;
                                            sessionmodel.RawScore          = testform.rawScore != null && testform.rawScore.HasValue ? testform.rawScore.Value.ToString() : "";
                                            sessionmodel.PropertyChanged  -= Sessionmodel_PropertyChanged;
                                            sessionmodel.PropertyChanged  += Sessionmodel_PropertyChanged;
                                            sessionmodel.EnablerawScore    = commonDataService.StudentTestForms.FirstOrDefault(p => p.contentCategoryId == childCategory.contentCategoryId).rawScoreEnabled;
                                            if (testform.rawScore != null && testform.rawScore.HasValue)
                                            {
                                                var aescore = bdi3ScoringParser.GetAeFromRs(Convert.ToDouble(testform.rawScore), null, childCategory.name);
                                                sessionmodel.AE = aescore > 0 ? (aescore / 12 > 0 ? aescore / 12 + " yrs, " : "") + aescore % 12 + " mos" : "--";
                                                var ss = bdi3ScoringParser.GetSsFromRs(Convert.ToDouble(testform.rawScore), childCategory.name, commonDataService.TotalAgeinMonths);
                                                if (ss > ScoringParser.NO_SCORE)
                                                {
                                                    sessionmodel.SS = ss.ToString();
                                                    sessionmodel.PR = bdi3ScoringParser.GetPrFromSs((double)ss)?.FirstOrDefault()?.StringValue;
                                                }
                                                else
                                                {
                                                    sessionmodel.SS = "--";
                                                    sessionmodel.PR = "--";
                                                }
                                            }
                                            if (commonDataService.SearchStaffResponseModel != null && commonDataService.SearchStaffResponseModel.Any() && testform.examinerId != null && testform.examinerId.HasValue)
                                            {
                                                sessionmodel.ExaminerID = Convert.ToInt32(testform.examinerId);
                                                sessionmodel.Examiner   = commonDataService.SearchStaffResponseModel.FirstOrDefault(p => p.UserID == testform.examinerId.Value.ToString()).FirstNameLastName;
                                            }
                                        }
                                    }
                                    TestSessionRecords.Add(sessionmodel);
                                }
                            }
                        }
                        bdi3ScoringParser = null;
                        GC.Collect();
                        GC.Collect();
                        GC.SuppressFinalize(this);
                    }
                }
            }
            else if (commonDataService.IsScreenerForm)
            {
                domains = new List <ContentCategory>(commonDataService.ScreenerCategories);
                foreach (var item in domains)
                {
                    var sessionModel = new TestSessionModel()
                    {
                        ContentCategoryId = item.contentCategoryId,
                        ParentDomainCode  = item.code,
                        DomainCode        = item.code,
                        Domain            = item.name,
                        TestDate          = "mm/dd/yyyy",
                        Examiner          = "Select Examiner",
                        Status            = "Complete",
                        RawScore          = "23",
                        IsDateVisible     = true
                    };
                    if (commonDataService.StudentTestForms != null && commonDataService.StudentTestForms.Any())
                    {
                        var testform = commonDataService.StudentTestForms.FirstOrDefault(p => p.contentCategoryId == item.contentCategoryId);
                        if (testform != null)
                        {
                            sessionModel.IsScoreSelected  = testform.IsScoreSelected;
                            sessionModel.TestDate         = testform.testDate;
                            sessionModel.Notes            = testform.Notes;
                            sessionModel.Status           = testform.TSOStatus;
                            sessionModel.RawScore         = testform.rawScore != null && testform.rawScore.HasValue ? testform.rawScore.Value.ToString() : "";
                            sessionModel.PropertyChanged -= Sessionmodel_PropertyChanged;
                            sessionModel.PropertyChanged += Sessionmodel_PropertyChanged;
                            sessionModel.EnablerawScore   = commonDataService.StudentTestForms.FirstOrDefault(p => p.contentCategoryId == item.contentCategoryId).rawScoreEnabled;
                            if (commonDataService.SearchStaffResponseModel != null && commonDataService.SearchStaffResponseModel.Any() && testform.examinerId != null && testform.examinerId.HasValue)
                            {
                                sessionModel.ExaminerID = Convert.ToInt32(testform.examinerId);
                                sessionModel.Examiner   = commonDataService.SearchStaffResponseModel.FirstOrDefault(p => p.UserID == testform.examinerId.Value.ToString()).FirstNameLastName;
                            }
                        }
                    }
                    Records.Add(sessionModel);
                }
            }
            if (commonDataService.IsAcademicForm)
            {
                domains = domains = new List <ContentCategory>(commonDataService.AcademicCategories);
                var records = new List <TestSessionModel>();
                if (domains != null && domains.Any())
                {
                    var parentDomains = domains.Where(p => p.parentContentCategoryId == 0).OrderBy(p => p.sequenceNo);
                    if (parentDomains != null && parentDomains.Any())
                    {
                        foreach (var item in parentDomains)
                        {
                            records.Add(new TestSessionModel()
                            {
                                Domain = item.name, IsDateVisible = false
                            });
                            var childRecords = domains.Where(p => p.parentContentCategoryId == item.contentCategoryId).OrderBy(p => p.sequenceNo);
                            if (childRecords != null && childRecords.Any())
                            {
                                foreach (var subitem in childRecords)
                                {
                                    var sessionmodel = new TestSessionModel()
                                    {
                                        DomainVisibility = true, ContentCategoryId = subitem.contentCategoryId, ParentDomainCode = item.code, DomainCode = subitem.code, LoadDomainBasedQuestionsAction = NavigateandRelaodQuestions, Domain = subitem.name, TestDate = "mm/dd/yyyy", Examiner = "Select Examiner", Status = "Complete", IsDateVisible = true, DomainMargin = new Thickness(17, 0, 0, 0)
                                    };
                                    records.Add(sessionmodel);
                                    var testform = commonDataService.StudentTestForms.FirstOrDefault(p => p.contentCategoryId == subitem.contentCategoryId);
                                    if (testform != null)
                                    {
                                        sessionmodel.IsScoreSelected   = testform.IsScoreSelected;
                                        sessionmodel.ContentCategoryId = subitem.contentCategoryId;
                                        sessionmodel.TestDate          = testform.testDate;
                                        sessionmodel.Notes             = testform.Notes;
                                        sessionmodel.Status            = testform.TSOStatus;
                                        if (sessionmodel.DomainCode == "PA" || sessionmodel.DomainCode == "PWR")
                                        {
                                            sessionmodel.RawScore = "";
                                        }
                                        else
                                        {
                                            sessionmodel.RawScore = testform.rawScore != null && testform.rawScore.HasValue ? testform.rawScore.Value.ToString() : "";
                                        }
                                        sessionmodel.PropertyChanged -= Sessionmodel_PropertyChanged;
                                        sessionmodel.PropertyChanged += Sessionmodel_PropertyChanged;
                                        sessionmodel.EnablerawScore   = commonDataService.StudentTestForms.FirstOrDefault(p => p.contentCategoryId == subitem.contentCategoryId).rawScoreEnabled;
                                        if (commonDataService.SearchStaffResponseModel != null && commonDataService.SearchStaffResponseModel.Any() && testform.examinerId != null && testform.examinerId.HasValue)
                                        {
                                            sessionmodel.ExaminerID = Convert.ToInt32(testform.examinerId);
                                            sessionmodel.Examiner   = commonDataService.SearchStaffResponseModel.FirstOrDefault(p => p.UserID == testform.examinerId.Value.ToString()).FirstNameLastName;
                                        }
                                        if (sessionmodel.ContentCategoryId == 162 || sessionmodel.Domain.ToLower() == "fluency")
                                        {
                                            sessionmodel.IsFluency = true;
                                            if (testform.TimeTaken != null && testform.TimeTaken.HasValue)
                                            {
                                                sessionmodel.Timer = new TimeSpan(0, 0, 0, testform.TimeTaken.Value);
                                            }
                                            else
                                            {
                                                sessionmodel.Timer = new TimeSpan(0, 0, 0, 210);
                                            }
                                        }
                                        else
                                        {
                                            sessionmodel.IsNotFluency = true;
                                        }
                                    }
                                    var areas = domains.Where(p => p.parentContentCategoryId == subitem.contentCategoryId).OrderBy(p => p.sequenceNo);
                                    if (areas != null && areas.Any())
                                    {
                                        sessionmodel.DomainColor      = Color.Black;
                                        sessionmodel.IsDateVisible    = false;
                                        sessionmodel.DomainVisibility = false;
                                        sessionmodel.LoadDomainBasedQuestionsAction = null;
                                        foreach (var area in areas)
                                        {
                                            var sessionmodel1 = new TestSessionModel()
                                            {
                                                DomainVisibility = true, ContentCategoryId = area.contentCategoryId, ParentDomainCode = subitem.code, DomainCode = area.code, LoadDomainBasedQuestionsAction = NavigateandRelaodQuestions, Domain = area.name, TestDate = "mm/dd/yyyy", Examiner = "Select Examiner", Status = "Complete", IsDateVisible = true, DomainMargin = new Thickness(27, 0, 0, 0)
                                            };
                                            records.Add(sessionmodel1);
                                            var testform1 = commonDataService.StudentTestForms.FirstOrDefault(p => p.contentCategoryId == area.contentCategoryId);
                                            if (testform1 != null)
                                            {
                                                sessionmodel1.IsScoreSelected   = testform1.IsScoreSelected;
                                                sessionmodel1.ContentCategoryId = area.contentCategoryId;
                                                sessionmodel1.TestDate          = testform1.testDate;
                                                sessionmodel1.Status            = testform1.TSOStatus;
                                                sessionmodel1.Notes             = testform1.Notes;
                                                sessionmodel1.IsNotFluency      = true;
                                                sessionmodel1.RawScore          = testform1.rawScore != null && testform1.rawScore.HasValue ? testform1.rawScore.Value.ToString() : "";
                                                sessionmodel1.PropertyChanged  -= Sessionmodel_PropertyChanged;
                                                sessionmodel1.PropertyChanged  += Sessionmodel_PropertyChanged;
                                                sessionmodel1.EnablerawScore    = commonDataService.StudentTestForms.FirstOrDefault(p => p.contentCategoryId == area.contentCategoryId).rawScoreEnabled;
                                                if (commonDataService.SearchStaffResponseModel != null && commonDataService.SearchStaffResponseModel.Any() && testform1.examinerId != null && testform1.examinerId.HasValue)
                                                {
                                                    sessionmodel1.ExaminerID = Convert.ToInt32(testform1.examinerId);
                                                    sessionmodel1.Examiner   = commonDataService.SearchStaffResponseModel.FirstOrDefault(p => p.UserID == testform1.examinerId.Value.ToString()).FirstNameLastName;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                AcademicTestSessionRecords = new List <TestSessionModel>(records);

                /*foreach(var record in AcademicTestSessionRecords)
                 * {
                 *  if(record.Domain == "Fluency")
                 *  {
                 *      record.IsFluency = true;
                 *      record.Timer = new TimeSpan(0,0,0,210);
                 *  }
                 *  else
                 *  {
                 *      record.IsNotFluency = true;
                 *  }
                 *
                 * }*/
            }

            domains = null;
        }
Example #5
0
 public NotesPopupViewModel()
 {
     studentTestFormsService = DependencyService.Get <IStudentTestFormsService>();
     clinicalTestFormService = DependencyService.Get <IClinicalTestFormService>();
 }