private void FilledButtonClick(object sender, RoutedEventArgs e)
        {
            search = context.StudentTables.Find(int.Parse(AdmissionNumberDisplay.Text.ToString()));

            Affidavit aff = new Affidavit(search.AdmissionNumber, search.Active);

            aff.Show();
        }
        public void forUpdate(int val)
        {
            try
            {
                search = context.StudentTables.Find(val);

                if (search.Gender == "Male")
                {
                    MaleRadioButton.IsChecked = true;
                }
                else
                {
                    FemaleRadioButton.IsChecked = true;
                }

                Grade.SelectedValue          = search.Grade.ToString();
                NationalityBox.SelectedValue = search.Nationality.ToString();
                ReligionBox.SelectedValue    = search.Religion.ToString();

                //***************************PERSONAL INFORMATION GRID***********************

                //              STUDENT IMAGE
                if (search.StudentImage == null)
                {
                    studentImage.Source = null;
                }
                else
                {
                    studentImage.Source = BitmapImageFromBytes(search.StudentImage);
                }
                //              STUDENT FROM BAY
                if (search.StudentFormBay == null)
                {
                    formBay.Source = null;
                }
                else
                {
                    formBay.Source = BitmapImageFromBytes(search.StudentFormBay);
                }
                //              STUDENT Birth Certificate
                if (search.StudentBC == null)
                {
                    birthCertificate.Source = null;
                }
                else
                {
                    birthCertificate.Source = BitmapImageFromBytes(search.StudentBC);
                }

                DOBText.Text           = search.DOB.ToString("dd/MM/yyyy");
                StudentNameText.Text   = search.Name;
                PlaceOfBirthText.Text  = search.PlaceOfBirth;
                FirstLanguageText.Text = search.FirstLanguage;
                FatherNameText.Text    = search.FatherName;
                FatherCNICText.Text    = search.FatherCNIC;
                MotherNameText.Text    = search.MotherName;
                MotherCNICText.Text    = search.MotherCNIC;
                HomeAddressText.Text   = search.HomeAddress;
                PhoneText.Text         = search.Phone;
                EmergencyText.Text     = search.Emergency;
                MobileText.Text        = search.Mobile;
                //***************************PARENTS INFORMATION GRID***********************
                FatherOccupationText.Text = search.FarherOccupation;
                FatherDesignation.Text    = search.FatherDesignation;
                FatherAdress.Text         = search.FatherWorkAddress;
                MotherOccupationText.Text = search.MotherOccupation;
                MotherDesignation.Text    = search.MotherDesignation;
                MotherAddress.Text        = search.MotherWorkAddress;
                GuardianNameText.Text     = search.GuardianName;
                RelationText.Text         = search.GuardianRelation;
                GuardianAddress.Text      = search.GuardianAddress;

                //***************************PREVIOUS ACADEMIC INFORMATION GRID***********************
                PreviousSchoolText.Text = search.PreviousSchoolName;
                FromToText.Text         = search.Studied;
                ReasonText.Text         = search.ReasonOfLeaving;
            }
            catch (Exception err)
            {
                this.ShowMessageAsync("Doesn't not Exits!", "The Student does not exits in the database with this Admission ID "
                                      + val + " . Please enter a valid Admission ID.");
                clearAll();
                nextAdmission();
                UpdateButton.Visibility = Visibility.Hidden;
                SubmitButton.Visibility = Visibility.Visible;
                Console.WriteLine(err.ToString());
            }
        }