private async void HyperlinkClicked(ChildInformationRecord child) { UserDialogs.Instance.ShowLoading("Loading..."); await Task.Delay(200); LocalTestFormID = child.LocalTestInstance; this.FullName = this.Name; this.DOB = this.DateofBirth; commonDataService.DOB = this.DateofBirth; this.TestDate = child.InitialTestDate; commonDataService.StudentTestFormOverview = null; commonDataService.StudentTestForms = studentTestFormsService.GetStudentTestForms(LocalTestFormID); commonDataService.StudentTestFormOverview = clinicalTestFormService.GetStudentTestFormsByID(LocalTestFormID); commonDataService.LocaInstanceID = LocalTestFormID; commonDataService.IsCompleteForm = child.AssesmentId == AssignmentTypes.BattelleDevelopmentalCompleteID; commonDataService.IsAcademicForm = child.AssesmentId == AssignmentTypes.BattelleDevelopmentalAcademicSurveyID; commonDataService.IsScreenerForm = child.AssesmentId == AssignmentTypes.BattelleDevelopmentalScreenerID; var navigationParams = new AdminstrationNavigationParams { LocalInstanceID = LocalTestFormID, DOB = DOB, TestDate = TestDate, FullName = FullName, OfflineStudentID = OfflineStudentId }; if (child.AssesmentId == AssignmentTypes.BattelleDevelopmentalCompleteID) { navigationParams.IsDevelopmentCompleteForm = true; } if (child.AssesmentId == AssignmentTypes.BattelleDevelopmentalAcademicSurveyID) { await Application.Current.MainPage.Navigation.PushModalAsync(new AcademicformWithMatAndItems(navigationParams)); } else { await Application.Current.MainPage.Navigation.PushModalAsync(new AdministrationView(navigationParams)); } ResetContent?.Invoke(); }
public AcademicSurveyLiteracyView(AdminstrationNavigationParams adminstrationNavigationParams) { UserDialogs.Instance.HideLoading(); var instaceId = 0; var txtdob = ""; var testdate = ""; instaceId = adminstrationNavigationParams.LocalInstanceID; txtdob = adminstrationNavigationParams.DOB; testdate = adminstrationNavigationParams.TestDate; MyViewModel = new AcademicSurveyLiteracyViewModel(instaceId, txtdob, testdate); this.BindingContext = MyViewModel; InitializeComponent(); MyViewModel.OfflineStudentID = adminstrationNavigationParams.OfflineStudentID; MyViewModel.LocaInstanceID = adminstrationNavigationParams.LocalInstanceID; DatePicker_DOB.PropertyChanged += DatePicker_DOB_PropertyChanged; //structure.PropertyChanged += Structure_PropertyChanged; //observation.PropertyChanged += Observation_PropertyChanged; //interview.PropertyChanged += Interview_PropertyChanged; DatePickerGrid.IsVisible = false; DateTime Now = DateTime.Now; var splittedDate = txtdob.Split('/'); DateTime dateOfBirth = new DateTime(Convert.ToInt32(splittedDate[2]), Convert.ToInt32(splittedDate[0]), Convert.ToInt32(splittedDate[1])); int Years = dateOfBirth < Now ? new DateTime(DateTime.Now.Subtract(dateOfBirth).Ticks).Year - 1 : 0; DateTime PastYearDate = dateOfBirth.AddYears(Years); int Months = 0; for (int i = 1; i <= 12; i++) { if (PastYearDate.AddMonths(i) == Now) { Months = i; break; } else if (PastYearDate.AddMonths(i) >= Now) { Months = i - 1; break; } } var totalMonths = Months + (Years * 12); if (totalMonths <= 23) { age.Text = totalMonths + (totalMonths == 1 ? " month" : " months"); } else { age.Text = Years + " years, " + Months + (Months == 1 ? " month" : " months"); } childName.Text = adminstrationNavigationParams.FullName; dob.Text = adminstrationNavigationParams.DOB; if (!string.IsNullOrEmpty(MyViewModel.TestDate)) { testDate.Text = MyViewModel.TestDate; } //if (childInfo is NewAssessmentViewModel) //{ // newAssessmentViewModel = childInfo as NewAssessmentViewModel; // MyViewModel.OfflineStudentID = newAssessmentViewModel.OfflineStudentId; //} //else if (childInfo is SearchEditViewModel) //{ // SearchEditViewModel = childInfo as SearchEditViewModel; // MyViewModel.OfflineStudentID = SearchEditViewModel.OfflineStudentId; //} //else if (childInfo is ChildInformationpageViewModel) //{ // ChildInformationpageViewModel = childInfo as ChildInformationpageViewModel; // MyViewModel.OfflineStudentID = ChildInformationpageViewModel.OfflineStudentId; //} //else //{ // AssessmentConfigPopupViewModel = childInfo as AssessmentConfigPopupViewModel; // MyViewModel.OfflineStudentID = AssessmentConfigPopupViewModel.OfflineStudentId; //} //age.Text = "<years, months>"; //if (childInfo != null) //{ // childName.Text = (newAssessmentViewModel != null ? newAssessmentViewModel.FullName : SearchEditViewModel != null ? SearchEditViewModel.FullName : ChildInformationpageViewModel != null ? ChildInformationpageViewModel.FullName : AssessmentConfigPopupViewModel.FullName); // dob.Text = (newAssessmentViewModel != null ? newAssessmentViewModel.DOB : SearchEditViewModel != null ? SearchEditViewModel.DOB : ChildInformationpageViewModel != null ? ChildInformationpageViewModel.DOB : AssessmentConfigPopupViewModel.DOB); // testDate.Text = (newAssessmentViewModel != null ? newAssessmentViewModel.TestDate : SearchEditViewModel != null ? SearchEditViewModel.TestDate : ChildInformationpageViewModel != null ? ChildInformationpageViewModel.TestDate : AssessmentConfigPopupViewModel.TestDate); //} //else //{ // childName.Text = "child name"; // dob.Text = "00/00/0000"; // testDate.Text = "00/00/0000"; //} }
private async void StartAssessmentClicked() { _commonDataService.DOB = DOB; _commonDataService.IsAcademicForm = false; _commonDataService.IsScreenerForm = false; _commonDataService.IsCompleteForm = false; if (PopupNavigation.Instance.PopupStack != null && PopupNavigation.Instance.PopupStack.Count == 1) { await PopupNavigation.Instance.PopAsync(false); } UserDialogs.Instance.ShowLoading("Loading..."); await Task.Delay(300); var clinicalTestForm = new StudentTestFormOverview { LocalStudentId = OfflineStudentId, assessmentId = IsBattelleDevelopmentalCompleteChecked ? AssignmentTypes.BattelleDevelopmentalCompleteID : IsBattelleDevelopmentalScreenerChecked ? AssignmentTypes.BattelleDevelopmentalScreenerID : AssignmentTypes.BattelleDevelopmentalAcademicSurveyID }; int.TryParse(Application.Current.Properties["UserID"].ToString(), out var addedBy); clinicalTestForm.createdByUserId = addedBy; clinicalTestForm.createDate = DateTime.Now; var label = ProgramNote == "Select a program label" ? null : ProgramNote; var labelId = label != null?_commonDataService.ProgramNoteModels.FirstOrDefault(p => p.LabelName == ProgramNote)?.LabelId : null; clinicalTestForm.FormStatus = "Not started"; DateTime dateTime; DateTime.TryParse(TestDate, out dateTime); clinicalTestForm.formParameters = JsonConvert.SerializeObject( new FormParamterClass() { ProgramLabelId = labelId, TestDate = dateTime, }); clinicalTestFormService.InsertTestForm(clinicalTestForm); _commonDataService.StudentTestFormOverview = clinicalTestForm; LocalTestFormID = clinicalTestForm.LocalTestRecodId; var contentBaseCeiling = _commonDataService.ContentBasalCeilings; if (IsBattelleEarlyAcademicSurveyChecked) { var academicCategories = _commonDataService.AcademicCategories; if (academicCategories != null && academicCategories.Any()) { var lstStudentTestForms = new List <StudentTestForms>(); var parentCategories = _commonDataService.AcademicCategories.Where(p => p.parentContentCategoryId == 0).ToList(); foreach (var parentCategory in parentCategories) { var childCategory = _commonDataService.AcademicCategories.Where(p => p.parentContentCategoryId == parentCategory.contentCategoryId); if (childCategory != null && childCategory.Any()) { foreach (var item in childCategory) { var studentTestForms = new StudentTestForms { TSOStatus = "Not Started", LocalformInstanceId = LocalTestFormID, testDate = TestDate, examinerId = Convert.ToInt32(_commonDataService.SearchStaffResponseModel.FirstOrDefault(p => p.FirstNameLastName == Examiner)?.UserID), contentCategoryId = item.contentCategoryId, createDate = DateTime.Now, BaselCeilingReached = contentBaseCeiling.FirstOrDefault(p => p.contentCategoryId == item.contentCategoryId) == null, IsBaselCeilingApplied = contentBaseCeiling.FirstOrDefault(p => p.contentCategoryId == item.contentCategoryId) != null, }; var childchildCategory = _commonDataService.AcademicCategories.Where(p => p.parentContentCategoryId == item.contentCategoryId); if (childchildCategory != null && childchildCategory.Any()) { foreach (var childitem in childchildCategory) { var childitemstudentTestForms = new StudentTestForms { TSOStatus = "Not Started", LocalformInstanceId = LocalTestFormID, testDate = TestDate, examinerId = Convert.ToInt32(_commonDataService.SearchStaffResponseModel.FirstOrDefault(p => p.FirstNameLastName == Examiner)?.UserID), contentCategoryId = childitem.contentCategoryId, createDate = DateTime.Now, BaselCeilingReached = contentBaseCeiling.FirstOrDefault(p => p.contentCategoryId == childitem.contentCategoryId) == null, IsBaselCeilingApplied = contentBaseCeiling.FirstOrDefault(p => p.contentCategoryId == childitem.contentCategoryId) != null, }; lstStudentTestForms.Add(childitemstudentTestForms); } } else { lstStudentTestForms.Add(studentTestForms); } } } else { var studentTestForms = new StudentTestForms { TSOStatus = "Not Started", LocalformInstanceId = LocalTestFormID, testDate = TestDate, examinerId = Convert.ToInt32(_commonDataService.SearchStaffResponseModel.FirstOrDefault(p => p.FirstNameLastName == Examiner)?.UserID), contentCategoryId = parentCategory.contentCategoryId, createDate = DateTime.Now }; lstStudentTestForms.Add(studentTestForms); } } studentTestFormsService.DeleteAll(LocalTestFormID); studentTestFormsService.InsertAll(lstStudentTestForms); _commonDataService.LocaInstanceID = LocalTestFormID; _commonDataService.StudentTestForms = new List <StudentTestForms>(lstStudentTestForms); _commonDataService.IsAcademicForm = true; var navigationParams = new AdminstrationNavigationParams { LocalInstanceID = LocalTestFormID, DOB = DOB, TestDate = TestDate, FullName = FullName, OfflineStudentID = OfflineStudentId, IsDevelopmentCompleteForm = false }; await Application.Current.MainPage.Navigation.PushModalAsync(new AcademicformWithMatAndItems(navigationParams)); _commonDataService.ClearAddChildContent?.Invoke(); } } if ((IsBattelleDevelopmentalCompleteChecked && !string.IsNullOrEmpty(Examiner)) || (IsBattelleDevelopmentalScreenerChecked && !string.IsNullOrEmpty(Examiner))) { var totalCategories = IsBattelleDevelopmentalScreenerChecked ? _commonDataService.ScreenerCategories : _commonDataService.BattleCategories.Where(p => p.contentCategoryLevelId == 2).ToList(); if (totalCategories != null && totalCategories.Any()) { var lstStudentTestForms = new List <StudentTestForms>(); foreach (var item in totalCategories) { if (IsBattelleDevelopmentalScreenerChecked) { _commonDataService.IsScreenerForm = true; } else if (IsBattelleDevelopmentalCompleteChecked) { _commonDataService.IsCompleteForm = true; } var studentTestForms = new StudentTestForms { TSOStatus = "Not Started", LocalformInstanceId = LocalTestFormID, testDate = TestDate, examinerId = Convert.ToInt32(_commonDataService.SearchStaffResponseModel .FirstOrDefault(p => p.FirstNameLastName == Examiner)?.UserID), contentCategoryId = item.contentCategoryId, createDate = DateTime.Now, BaselCeilingReached = contentBaseCeiling.FirstOrDefault(p => p.contentCategoryId == item.contentCategoryId) == null, IsBaselCeilingApplied = true // contentBaseCeiling.FirstOrDefault(p => p.contentCategoryId == item.contentCategoryId) != null, }; lstStudentTestForms.Add(studentTestForms); } studentTestFormsService.DeleteAll(LocalTestFormID); studentTestFormsService.InsertAll(lstStudentTestForms); _commonDataService.LocaInstanceID = LocalTestFormID; _commonDataService.StudentTestForms = new List <StudentTestForms>(lstStudentTestForms); } var navigationParams = new AdminstrationNavigationParams { LocalInstanceID = LocalTestFormID, DOB = DOB, TestDate = TestDate, FullName = FullName, OfflineStudentID = OfflineStudentId, IsDevelopmentCompleteForm = IsBattelleDevelopmentalCompleteChecked }; _commonDataService.ClearAddChildContent?.Invoke(); await Application.Current.MainPage.Navigation.PushModalAsync(new AdministrationView(navigationParams)); } }
public AdministrationView(AdminstrationNavigationParams adminstrationNavigationParams) { var instaceId = 0; var txtdob = ""; var testdate = ""; instaceId = adminstrationNavigationParams.LocalInstanceID; txtdob = adminstrationNavigationParams.DOB; testdate = adminstrationNavigationParams.TestDate; MyViewModel = new AdministrationViewModel(instaceId, adminstrationNavigationParams.IsDevelopmentCompleteForm, txtdob, testdate); this.BindingContext = MyViewModel; InitializeComponent(); MyViewModel.OfflineStudentID = adminstrationNavigationParams.OfflineStudentID; MyViewModel.LocaInstanceID = adminstrationNavigationParams.LocalInstanceID; DatePickerGrid.IsVisible = false; DateTime Now = DateTime.Now; var splittedDate = txtdob.Split('/'); try { DateTime itemdateTime = new DateTime(Convert.ToInt32(splittedDate[2]), Convert.ToInt32(splittedDate[0]), Convert.ToInt32(splittedDate[1])); int Years = new DateTime(DateTime.Now.Subtract(itemdateTime).Ticks).Year - 1; DateTime PastYearDate = itemdateTime.AddYears(Years); int Months = 0; for (int i = 1; i <= 12; i++) { if (PastYearDate.AddMonths(i) == Now) { Months = i; break; } else if (PastYearDate.AddMonths(i) >= Now) { Months = i - 1; break; } } var totalMonths = Months + (Years * 12); if (totalMonths <= 23) { age.Text = totalMonths + (totalMonths == 1 ? " month" : " months"); } else { age.Text = Years + " years, " + Months + (Months == 1 ? " month" : " months"); } childName.Text = adminstrationNavigationParams.FullName; dob.Text = adminstrationNavigationParams.DOB; if (!string.IsNullOrEmpty(MyViewModel.TestDate)) { testDate.Text = MyViewModel.TestDate; } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.StackTrace); } loadtestform(); }
public AcademicformWithMatAndItems(AdminstrationNavigationParams adminstrationNavigationParams) { var instaceId = 0; var txtdob = ""; var testdate = ""; instaceId = adminstrationNavigationParams.LocalInstanceID; txtdob = adminstrationNavigationParams.DOB; testdate = adminstrationNavigationParams.TestDate; MyViewModel = new AcademicSurveyLiteracyViewModel(instaceId, txtdob, testdate); this.BindingContext = MyViewModel; InitializeComponent(); MyViewModel.OfflineStudentID = adminstrationNavigationParams.OfflineStudentID; MyViewModel.LocaInstanceID = adminstrationNavigationParams.LocalInstanceID; MyViewModel.PropertyChanged -= MyViewModel_PropertyChanged; MyViewModel.PropertyChanged += MyViewModel_PropertyChanged; DatePicker_DOB.PropertyChanged -= DatePicker_DOB_PropertyChanged; DatePicker_DOB.PropertyChanged += DatePicker_DOB_PropertyChanged; //structure.PropertyChanged += Structure_PropertyChanged; //observation.PropertyChanged += Observation_PropertyChanged; //interview.PropertyChanged += Interview_PropertyChanged; DatePickerGrid.IsVisible = false; DateTime Now = DateTime.Now; var splittedDate = txtdob.Split('/'); DateTime dateOfBirth = new DateTime(Convert.ToInt32(splittedDate[2]), Convert.ToInt32(splittedDate[0]), Convert.ToInt32(splittedDate[1])); int Years = dateOfBirth.Date < Now.Date ? new DateTime(DateTime.Now.Subtract(dateOfBirth).Ticks).Year - 1 : 0; DateTime PastYearDate = dateOfBirth.AddYears(Years); int Months = 0; for (int i = 1; i <= 12; i++) { if (PastYearDate.AddMonths(i) == Now) { Months = i; break; } else if (PastYearDate.AddMonths(i) >= Now) { Months = i - 1; break; } } var totalMonths = Months + (Years * 12); if (totalMonths <= 23) { age.Text = totalMonths + (totalMonths == 1 ? " month" : " months"); } else { age.Text = Years + " years, " + Months + (Months == 1 ? " month" : " months"); } childName.Text = adminstrationNavigationParams.FullName; dob.Text = adminstrationNavigationParams.DOB; if (!string.IsNullOrEmpty(MyViewModel.TestDate)) { testDate.Text = MyViewModel.TestDate; } loadpage(); }