コード例 #1
0
        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;
        }
コード例 #2
0
        public void LoadTestRecordsFromDB(int offlineStudentId)
        {
            var studentTestRecordForms = new List <ChildInformationRecord>();

            var testRecords = (clinicalTestFormService.GetStudentTestFormsByStudentID(offlineStudentId));
            var recordForm  = "";

            foreach (var testRecord in testRecords)
            {
                var obj = testRecord.formParameters != null?JObject.Parse(testRecord.formParameters) : null;

                if (obj != null)
                {
                    var dateOfTesting = (DateTime)obj.SelectToken("TestDate");

                    if (testRecord.assessmentId == AssignmentTypes.BattelleDevelopmentalCompleteID)
                    {
                        recordForm = AssignmentTypes.BattelleDevelopmentalCompleteString;
                    }
                    else if (testRecord.assessmentId == AssignmentTypes.BattelleDevelopmentalScreenerID)
                    {
                        recordForm = AssignmentTypes.BattelleDevelopmentScreenerString;
                    }
                    else
                    {
                        recordForm = AssignmentTypes.BattelleEarlyAcademicSurveyString;
                    }


                    var formParametersObj = JsonConvert.DeserializeObject <FormParamterClass>(testRecord.formParameters);
                    studentTestRecordForms.Add(new ChildInformationRecord()
                    {
                        Status            = testRecord.FormStatus,
                        AssesmentId       = testRecord.assessmentId,
                        LocalTestInstance = testRecord.LocalTestRecodId,
                        RecordForm        = recordForm,
                        InitialTestDate   = dateOfTesting.Date.ToString("MM/dd/yyyy"),
                        SyncStatus        = testRecord.SyncStausDesc,
                        StatusCode        = testRecord.SyncStausCode,
                        EnableRow         = ((testRecord.FormStatus == "Not started" && Xamarin.Essentials.Connectivity.NetworkAccess == Xamarin.Essentials.NetworkAccess.Internet) || (testRecord.FormStatus == "Saved" && Xamarin.Essentials.Connectivity.NetworkAccess != Xamarin.Essentials.NetworkAccess.Internet) || (testRecord.FormStatus == "In-Progress" && Xamarin.Essentials.Connectivity.NetworkAccess != Xamarin.Essentials.NetworkAccess.Internet) ? false : true)
                    });
                }
            }
            ChildInformationRecords.Clear();
            IsSelectAll              = false;
            ChildInformationRecords  = studentTestRecordForms;
            IsTableBottomLineVisible = ChildInformationRecords.Any();
        }
コード例 #3
0
 private void Connectivity_ConnectivityChanged(object sender, ConnectivityChangedEventArgs e)
 {
     if (e.NetworkAccess == NetworkAccess.None || e.NetworkAccess == NetworkAccess.Unknown)
     {
         EnableSync = false;
         if (IsSelectAll)
         {
             IsSelectAll = false;
         }
         foreach (var child in ChildInformationRecords)
         {
             if (child.IsSelect)
             {
                 child.IsSelect = false;
             }
             if (child.EnableRow)
             {
                 child.EnableRow = false;
             }
         }
     }
     else if (ChildInformationRecords != null && ChildInformationRecords.Any())
     {
         if (ChildInformationRecords.Any(p => p.IsSelect))
         {
             EnableSync = true;
         }
         foreach (var child in ChildInformationRecords)
         {
             if (child.Status != "Not started")
             {
                 if (!child.EnableRow)
                 {
                     child.EnableRow = true;
                 }
             }
         }
     }
 }