protected override void OnNavigatedTo(NavigationEventArgs e)
        {

            try
            {
                base.OnNavigatedTo(e);
                getIds = (string)e.Parameter;

                getParentID = getIds.Substring(0,1);
                getChildID = getIds.Substring(2);

                objChildrenViewModel = new ChildrenViewModel();
                objRegChild = new RegisterChild();

                objRegChild = objChildrenViewModel.getChildDetails(Convert.ToInt32(getChildID), Convert.ToInt32(getParentID));
                

                testsViewModel = new TestsViewModel();
                test = testsViewModel.GetTests(Convert.ToInt32(getIds.Substring(2)));

                lsViewTest.Items.Add("Test ID" + "\t" + "Right" + "\t" + "Wrong" + "\t" + "Date & Time");

                foreach (var c in test)
                {
                    lsViewTest.Items.Add(c.Id +  " \t" + c.RightAnswers + "\t" + c.WrongAnswers + "\t" + c.Date);

                }
                base.OnNavigatedTo(e);

                lblChId.Text = "" + objRegChild.Id + " - " + objRegChild.Name + " " + objRegChild.Surname; 

            }
            catch (Exception)
            {

            }


        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {

            try
            {
                base.OnNavigatedTo(e);
                getIds = (string)e.Parameter;

                parentID = Convert.ToInt32(getIds.Substring(0, 1));
                childID = Convert.ToInt32(getIds.Substring(2));

                objRegChild = new RegisterChild();
                objChildrenViewModel = new ChildrenViewModel();

                objRegChild = objChildrenViewModel.getChildDetails(childID, parentID);

                base.OnNavigatedTo(e);

            }
            catch (Exception)
            {

            }


        }
        //Button to delete all child test results
        private void btnDeleteAll_Click(object sender, RoutedEventArgs e)
        {
            if(!getChildID.Equals(""))
            {
                int convChildId = myChildId(getChildID);
                int convParentId = myParentId(getParentID);
                objChildrenViewModel = new ChildrenViewModel();
                objRegChild = new RegisterChild();
                objTestViewModel = new TestViewModel();

                objRegChild = objChildrenViewModel.getChildDetails(convChildId, convParentId);
                objTestViewModel.deleteChildTestRecords(convChildId);


                this.Frame.Navigate(typeof(SelectChildToViewPage), convParentId);
                string msg = "All child test records for " + objRegChild.Name + " " + objRegChild.Surname + " were successfully deleted";
                messageBox(msg);



            }
            else
            {
                messageBox("Child id can't be empty!");
            }
        }
        //Button to update child details
        private void btnEditChildDetails_Click(object sender, RoutedEventArgs e)
        {
            regChild = new RegisterChild();
            childrenViewModel = new ChildrenViewModel();

            int convertChildId = 0;
            int convertParentId = 0;
            string strMsg = "";

            try
            {
                int verifyNum;
                bool isNumerical = int.TryParse(idNum, out verifyNum);

                if (idNum.Equals("") || isNumerical == false)
                {
                    strMsg = "Please select a child first before proceeding with the editing process!";
                    messageBox(strMsg);

                }
                else
                {
                    convertChildId = Convert.ToInt32(idNum);
                    convertParentId = Convert.ToInt32(parentId);
                    regChild = childrenViewModel.getChildDetails(convertChildId, parentId);

                    if ((convertChildId <= 0) && (convertParentId <= 0))
                    {
                        strMsg = "Please select a child first before proceeding with the editing process!";
                        messageBox(strMsg);
                    }
                    else
                    {
                        if (regChild != null)
                        {
                            this.Frame.Navigate(typeof(EditedSelectedChildPage), regChild);
                            string msg = "Found child details in the database!";
                            messageBox(msg);
                        }
                        else
                        {
                            string msg = "Couldn't retrive child infomation from the database";
                            messageBox(msg);
                        }
                    }
                }
            }
            catch(Exception)
            {

            }

            
            
        }