Esempio n. 1
0
        private void SubmitBtn_Click(object sender, RoutedEventArgs e)
        {
            // update BasicInfo variables to be current
            abi.lastName         = aLastName.Text.Trim();
            abi.firstName        = aFirstName.Text.Trim();
            abi.middleInitial    = aMiddleInitial.Text.Trim();
            abi.program          = aProgram.Text.Trim();
            abi.streetAddress    = aStudentStreetAddress.Text.Trim();
            abi.city             = aStudentCity.Text.Trim();
            abi.state            = aStudentState.Text;
            abi.zipCode          = aStudentZIP.Text.Trim();
            abi.primaryPhoneNum  = aStudentPrimaryPhone.Text.Trim();
            abi.cellPhoneNum     = aStudentCellPhone.Text.Trim();
            abi.hispanicOrLatino = aStudentLatino.Text;
            abi.race             = aStudentRace.Text;
            abi.gender           = aStudentGender.Text;
            abi.dateOfBirth      = aStudentDOB.SelectedDate;
            abi.SSN = SSNtext.Text;
            abi.completedEdLevel      = aEducationLevel.Text;
            abi.attendedCollegeOrTech = attendedCollegeCombo.Text;
            abi.liveWithParent        = liveWithParentCombo.Text;

            // update values of validCheck
            abiCheck.UpdateValues(abi);

            // update the datacontext to be validCheck if it was not already
            if (BasicInfoField.DataContext != abiCheck)
            {
                BasicInfoField.DataContext = abiCheck;
            }

            // update hsec to contain current information
            aec.contactName         = ECName.Text.Trim();
            aec.relationship        = ECRelationship.Text.Trim();
            aec.primaryNum          = ECPrimaryNum.Text.Trim();
            aec.alternateNum        = ECCellNum.Text.Trim();
            aec.nameNearestRelative = NRName.Text.Trim();
            aec.NRrelationship      = NRRelationship.Text.Trim();
            aec.NRstreetAddress     = NRStreetAddress.Text.Trim();
            aec.NRcity       = NRcity.Text.Trim();
            aec.NRstate      = NRstate.Text;
            aec.NRzip        = NRzip.Text.Trim();
            aec.NRprimaryNum = NRPrimaryNumber.Text.Trim();
            aec.NRcellNum    = NRAlternateNumber.Text.Trim();

            // update the validCheck variable

            aecCheck.UpdateValues(aec);

            // update the datacontext to be hsecCheck if it was not already
            if (EmergencyContactField.DataContext != aecCheck)
            {
                EmergencyContactField.DataContext = aecCheck;
            }

            // assign stroke values to new byte array in order to later save the information to the database
            byte[] signature;
            using (MemoryStream ms = new MemoryStream())
            {
                HISignatureCanvas.Strokes.Save(ms);
                signature = ms.ToArray();
            }

            ahi.primaryPhysician   = primaryPhysicianText.Text.Trim();
            ahi.otherPhysician     = oPhysicianText.Text.Trim();
            ahi.pPhysicianPhoneNum = primaryPhysPhoneText.Text.Trim();
            ahi.oPhysicianPhoneNum = oPhysicianPhoneNum.Text.Trim();
            ahi.diabeticType       = diabetesCombo.Text;
            ahi.allergies          = allergiesText.Text.Trim();
            ahi.heartIssues        = heartConditionsText.Text.Trim();
            ahi.metabolic          = metabolicCheck.IsChecked.ToString();
            ahi.jointMuscle        = jointMuscleCheck.IsChecked.ToString();
            ahi.chronicIllness     = chronicIllnessCheck.IsChecked.ToString();
            ahi.migraines          = migrainesCheck.IsChecked.ToString();
            ahi.neurological       = neurologicalCheck.IsChecked.ToString();
            ahi.pulmonary          = pulmonaryCheck.IsChecked.ToString();
            ahi.asthma             = asthmaCheck.IsChecked.ToString();
            ahi.other                     = otherCheck.IsChecked.ToString();
            ahi.otherMeds                 = otherMedsText.Text.Trim();
            ahi.specificFirstAidNeeds     = specificNeedsText.Text.Trim();
            ahi.repPermissionForTreatment = treatmentPermissionCombo.Text;
            ahi.healthSignature           = signature;

            hiCheck.UpdateValues(ahi);

            // update the datacontext to be hiCheck if it was not already
            if (HealthInformationField.DataContext != hiCheck)
            {
                HealthInformationField.DataContext = hiCheck;
            }

            byte[] policySig;
            using (MemoryStream ms = new MemoryStream())
            {
                policySignatureCanvas.Strokes.Save(ms);
                policySig = ms.ToArray();
            }

            // update hsp information to current values
            ap.attendance            = attendanceCheck.IsChecked.ToString();
            ap.tobacco               = tobaccoCheck.IsChecked.ToString();
            ap.internetAccess        = internetCheck.IsChecked.ToString();
            ap.studentInsurance      = insuranceCheck.IsChecked.ToString();
            ap.fieldTrips            = fieldTripsCheck.IsChecked.ToString();
            ap.drugTesting           = drugTestingCheck.IsChecked.ToString();
            ap.noticeOfDisclosures   = noticeOfDisclosuresCheck.IsChecked.ToString();
            ap.cellPhoneContact      = cellPhoneContactCheck.IsChecked.ToString();
            ap.releaseForPhotography = photographyReleaseCheck.IsChecked.ToString();
            ap.studentSignature      = policySig;

            pCheck.UpdateValues(ap);

            // update the datacontext to be pCheck if it was not already
            if (StudentPolicyField.DataContext != pCheck)
            {
                StudentPolicyField.DataContext = pCheck;
            }

            // update ConfidentialInfo object to contain current values
            aci.foodStamps           = foodStampsCheck.IsChecked.ToString();
            aci.dependentChildrenAid = dependentChildrenCheck.IsChecked.ToString();
            aci.supplementaryIncome  = SSIcheck.IsChecked.ToString();
            aci.housingAssistance    = section8Check.IsChecked.ToString();
            aci.none              = noneCheck.IsChecked.ToString();
            aci.homeless          = homelessCheck.IsChecked.ToString();
            aci.agedOutFosterCare = agedOutCheck.IsChecked.ToString();
            aci.outOfWorkforce    = workforceCheck.IsChecked.ToString();

            // section to overwrite data
            DataAccess db = new DataAccess();

            OverwriteConfirmation ow = new OverwriteConfirmation("Some of the information for this student may have been changed. Invalid values will not be saved. Are you sure you want to overwrite the data for this user? The information may not be recovered.");

            ow.ShowDialog();

            if (overwrite == true)
            {
                db.SaveABI(abi, abiCheck);
                db.SaveAEC(aec, aecCheck);
                db.SaveAHI(ahi, hiCheck);
                db.SaveAP(ap, pCheck);
                db.SaveACI(aci);
            }
        }
        private void NextBtn_Click(object sender, RoutedEventArgs e)
        {
            // variable to tell whether the signature fields have been filled out
            bool sigError = false;

            #region Checks the signature field, if it is not empty it is saved as a byte array --- also changes signature field border colors based on input
            if (signatureCanvas.Strokes.Count == 0)
            {
                sigCanBorder.BorderBrush = Brushes.Red;
                sigError = true;
            }

            else
            {
                if (sigCanBorder.BorderBrush == Brushes.Red)
                {
                    sigCanBorder.BorderBrush = new SolidColorBrush(Color.FromRgb(33, 148, 243));
                }

                sigError = false;
            }

            byte[] signature;
            using (MemoryStream ms = new MemoryStream())
            {
                signatureCanvas.Strokes.Save(ms);
                signature = ms.ToArray();
            }
            #endregion

            // update ap object information
            ap.attendance            = attendanceCheck.IsChecked.ToString();
            ap.tobacco               = tobaccoCheck.IsChecked.ToString();
            ap.internetAccess        = internetCheck.IsChecked.ToString();
            ap.studentInsurance      = insuranceCheck.IsChecked.ToString();
            ap.fieldTrips            = fieldTripsCheck.IsChecked.ToString();
            ap.drugTesting           = drugTestingCheck.IsChecked.ToString();
            ap.noticeOfDisclosures   = noticeOfDisclosuresCheck.IsChecked.ToString();
            ap.cellPhoneContact      = cellPhoneContactCheck.IsChecked.ToString();
            ap.releaseForPhotography = photographyReleaseCheck.IsChecked.ToString();
            ap.studentSignature      = signature;


            // update the validCheck variable

            validCheck.UpdateValues(ap);

            // update the datacontext to be validCheck if it was not already
            if (textFields.DataContext != validCheck)
            {
                textFields.DataContext = validCheck;
            }

            // DataAccess variable to be used to save information to the database
            DataAccess db = new DataAccess();

            db.SaveAP(ap, validCheck);

            // if no errors are found, save changes to database and change visibility of UC to hidden
            // also change selected index for Information_Page --- this is what controls the moving cursor grid on that page
            if (validCheck.IsValid.Count == 0 && !sigError)
            {
                Information_Page.aspuc.Visibility = Visibility.Hidden;

                Information_Page.aciuc.Visibility = Visibility.Visible;

                Information_Page.selectedIndex = 4;

                Information_Page.lv.SelectedIndex = 4;
            }
        }
        private void SubmitBtn_Click(object sender, RoutedEventArgs e)
        {
            // update BasicInfo variables to be current
            hsbi.lastName         = aLastName.Text.Trim();
            hsbi.firstName        = aFirstName.Text.Trim();
            hsbi.middleInitial    = aMiddleInitial.Text.Trim();
            hsbi.program          = aProgram.Text.Trim();
            hsbi.streetAddress    = aStudentStreetAddress.Text.Trim();
            hsbi.city             = aStudentCity.Text.Trim();
            hsbi.state            = aStudentState.Text;
            hsbi.zipCode          = aStudentZIP.Text.Trim();
            hsbi.primaryPhoneNum  = aStudentPrimaryPhone.Text.Trim();
            hsbi.cellPhoneNum     = aStudentCellPhone.Text.Trim();
            hsbi.hispanicOrLatino = aStudentLatino.Text;
            hsbi.race             = aStudentRace.Text;
            hsbi.gender           = aStudentGender.Text;
            hsbi.dateOfBirth      = aStudentDOB.SelectedDate;
            hsbi.sendingHS        = aSendingHighSchool.Text.Trim();
            hsbi.currentEdLevel   = aEducationLevel.Text;

            // update values of validCheck
            hsbiCheck.UpdateValues(hsbi);

            // update the datacontext to be validCheck if it was not already
            if (BasicInfoField.DataContext != hsbiCheck)
            {
                BasicInfoField.DataContext = hsbiCheck;
            }

            // update hsec to contain current information
            hsec.parentNameOne         = a1ParentName.Text.Trim();
            hsec.parentOneRelationship = a1ParentRelationship.Text.Trim();
            hsec.parentOneAddress      = a1ParentAddress.Text.Trim();
            hsec.parentOneCity         = a1ParentCity.Text.Trim();
            hsec.parentOneState        = a1ParentState.Text;
            hsec.parentOneZip          = a1ParentZIP.Text.Trim();
            hsec.parentOnePrimaryNum   = a1ParentPrimaryNumber.Text.Trim();
            hsec.parentOneCellNum      = a1ParentCellNumber.Text.Trim();
            hsec.parentOneEmail        = a1ParentEmail.Text.Trim();
            hsec.residesWithP1         = a1ParentResiding.IsChecked.ToString();
            hsec.parentNameTwo         = a2ParentName.Text.Trim();
            hsec.parentTwoRelationship = a2ParentRelationship.Text.Trim();
            hsec.parentTwoAddress      = a2ParentAddress.Text.Trim();
            hsec.parentTwoCity         = a2ParentCity.Text.Trim();
            hsec.parentTwoState        = a2ParentState.Text;
            hsec.parentTwoZip          = a2ParentZIP.Text.Trim();
            hsec.parentTwoPrimaryNum   = a2ParentPrimaryNumber.Text.Trim();
            hsec.parentTwoCellNum      = a2ParentCellNumber.Text.Trim();
            hsec.parentTwoEmail        = a2ParentEmail.Text.Trim();
            hsec.residesWithP2         = a2ParentResiding.IsChecked.ToString();
            hsec.EContactName          = ECName.Text.Trim();
            hsec.EContactRelationship  = ECRelationship.Text.Trim();
            hsec.EContactPrimaryNum    = ECPrimaryNum.Text.Trim();
            hsec.EContactCellNum       = ECCellNum.Text.Trim();


            // update the validCheck variable
            hsecCheck.UpdateValues(hsec);

            // update the datacontext to be hsecCheck if it was not already
            if (EmergencyContactField.DataContext != hsecCheck)
            {
                EmergencyContactField.DataContext = hsecCheck;
            }

            // assign stroke values to new byte array in order to later save the information to the database
            byte[] signature;
            using (MemoryStream ms = new MemoryStream())
            {
                HISignatureCanvas.Strokes.Save(ms);
                signature = ms.ToArray();
            }

            hshi.primaryPhysician   = primaryPhysicianText.Text.Trim();
            hshi.otherPhysician     = oPhysicianText.Text.Trim();
            hshi.pPhysicianPhoneNum = primaryPhysPhoneText.Text.Trim();
            hshi.oPhysicianPhoneNum = oPhysicianPhoneNum.Text.Trim();
            hshi.diabeticType       = diabetesCombo.Text;
            hshi.allergies          = allergiesText.Text.Trim();
            hshi.heartIssues        = heartConditionsText.Text.Trim();
            hshi.metabolic          = metabolicCheck.IsChecked.ToString();
            hshi.jointMuscle        = jointMuscleCheck.IsChecked.ToString();
            hshi.chronicIllness     = chronicIllnessCheck.IsChecked.ToString();
            hshi.migraines          = migrainesCheck.IsChecked.ToString();
            hshi.neurological       = neurologicalCheck.IsChecked.ToString();
            hshi.pulmonary          = pulmonaryCheck.IsChecked.ToString();
            hshi.asthma             = asthmaCheck.IsChecked.ToString();
            hshi.other                     = otherCheck.IsChecked.ToString();
            hshi.otherMeds                 = otherMedsText.Text.Trim();
            hshi.specificFirstAidNeeds     = specificNeedsText.Text.Trim();
            hshi.repPermissionForTreatment = treatmentPermissionCombo.Text;
            hshi.healthSignature           = signature;

            hiCheck.UpdateValues(hshi);

            // update the datacontext to be hiCheck if it was not already
            if (HealthInformationField.DataContext != hiCheck)
            {
                HealthInformationField.DataContext = hiCheck;
            }

            byte[] policySig;
            using (MemoryStream ms = new MemoryStream())
            {
                policySignatureCanvas.Strokes.Save(ms);
                policySig = ms.ToArray();
            }

            byte[] policyParentSig;
            using (MemoryStream ms = new MemoryStream())
            {
                parentSigPolicyCanvas.Strokes.Save(ms);
                policyParentSig = ms.ToArray();
            }

            // update hsp information to current values
            hsp.attendance            = attendanceCheck.IsChecked.ToString();
            hsp.tobacco               = tobaccoCheck.IsChecked.ToString();
            hsp.internetAccess        = internetCheck.IsChecked.ToString();
            hsp.studentInsurance      = insuranceCheck.IsChecked.ToString();
            hsp.fieldTrips            = fieldTripsCheck.IsChecked.ToString();
            hsp.drugTesting           = drugTestingCheck.IsChecked.ToString();
            hsp.noticeOfDisclosures   = noticeOfDisclosuresCheck.IsChecked.ToString();
            hsp.cellPhoneContact      = cellPhoneContactCheck.IsChecked.ToString();
            hsp.releaseForPhotography = photographyReleaseCheck.IsChecked.ToString();
            hsp.studentSignature      = policySig;
            hsp.parentSignature       = policyParentSig;

            pCheck.UpdateValues(hsp);

            // update the datacontext to be pCheck if it was not already
            if (StudentPolicyField.DataContext != pCheck)
            {
                StudentPolicyField.DataContext = pCheck;
            }

            // update ConfidentialInfo object to contain current values
            hsci.foodStamps           = foodStampsCheck.IsChecked.ToString();
            hsci.dependentChildrenAid = dependentChildrenCheck.IsChecked.ToString();
            hsci.supplementaryIncome  = SSIcheck.IsChecked.ToString();
            hsci.housingAssistance    = section8Check.IsChecked.ToString();
            hsci.none              = noneCheck.IsChecked.ToString();
            hsci.homeless          = homelessCheck.IsChecked.ToString();
            hsci.agedOutFosterCare = agedOutCheck.IsChecked.ToString();
            hsci.parentsActiveDuty = activeDutyCheck.IsChecked.ToString();
            hsci.reducedLunch      = reducedLunchCheck.IsChecked.ToString();

            DataAccess db = new DataAccess();

            OverwriteConfirmation ow = new OverwriteConfirmation("Some of the information for this student may have been changed. Invalid values will not be saved. Are you sure you want to overwrite the data for this user? The information may not be recovered.");

            ow.ShowDialog();

            if (overwrite == true)
            {
                db.SaveHSBI(hsbi, hsbiCheck);
                db.SaveHSEC(hsec, hsecCheck);
                db.SaveHSHI(hshi, hiCheck);
                db.SaveHSP(hsp, pCheck);
                db.SaveHSCI(hsci);
            }
        }