public HealthInfoUC()
        {
            InitializeComponent();

            // DataAccess variable to be used to retrieve and autofill information stored in the database for the user
            DataAccess db = new DataAccess();

            // initialize previously declared values to null for later checking
            hshi = null;
            ahi  = null;

            // check what type of student logged in
            // then query database and pull student info, assigning values to the proper HealthInfo object
            // then assign the datacontext for the text fields in the UC to the newly reassigned variable
            if (LoginPage.highschoolCheck != null)
            {
                hshi = db.GetHSHI(LoginPage.highschoolCheck.Id);


                if (hshi.healthSignature != null)
                {
                    using (MemoryStream ms = new MemoryStream(hshi.healthSignature))
                    {
                        signatureCanvas.Strokes = new System.Windows.Ink.StrokeCollection(ms);
                        ms.Close();
                    }
                }


                textFields.DataContext = hshi;

                siglabel.Text = "Parent/Guardian Signature: ";
            }

            else
            {
                ahi = db.GetAHI(LoginPage.adultCheck.Id);

                if (ahi.healthSignature != null)
                {
                    using (MemoryStream ms = new MemoryStream(ahi.healthSignature))
                    {
                        signatureCanvas.Strokes = new System.Windows.Ink.StrokeCollection(ms);
                        ms.Close();
                    }
                }

                textFields.DataContext = ahi;

                siglabel.Text = "Student Signature: ";
            }

            // set signature border to base color
            sigCanBorder.BorderBrush = new SolidColorBrush(Color.FromRgb(33, 148, 243));
        }
        private void Load()
        {
            DataAccess db = new DataAccess();

            hsbi = db.GetHSBI(Id);
            hsec = db.GetHSEC(Id);
            hshi = db.GetHSHI(Id);
            hsp  = db.GetHSP(Id);
            hsci = db.GetHSCI(Id);

            BasicInfoField.DataContext         = hsbi;
            EmergencyContactField.DataContext  = hsec;
            HealthInformationField.DataContext = hshi;
            StudentPolicyField.DataContext     = hsp;
            ConfidentialInfoField.DataContext  = hsci;

            if (hshi.healthSignature != null)
            {
                using (MemoryStream ms = new MemoryStream(hshi.healthSignature))
                {
                    HISignatureCanvas.Strokes = new System.Windows.Ink.StrokeCollection(ms);
                    ms.Close();
                }
            }

            if (hsp.parentSignature != null)
            {
                using (MemoryStream ms = new MemoryStream(hsp.parentSignature))
                {
                    parentSigPolicyCanvas.Strokes = new System.Windows.Ink.StrokeCollection(ms);
                    ms.Close();
                }
            }

            if (hsp.studentSignature != null)
            {
                using (MemoryStream ms = new MemoryStream(hsp.studentSignature))
                {
                    policySignatureCanvas.Strokes = new System.Windows.Ink.StrokeCollection(ms);
                    ms.Close();
                }
            }

            if (hsci.parentSignature != null)
            {
                using (MemoryStream ms = new MemoryStream(hsci.parentSignature))
                {
                    parentSigCanvas.Strokes = new System.Windows.Ink.StrokeCollection(ms);
                    ms.Close();
                }
            }
        }
 public void UpdateValues(HighSchoolHealthInfoClass hshi)
 {
     _primaryPhysician   = hshi.primaryPhysician;
     _otherPhysician     = hshi.otherPhysician;
     _pPhysicianPhoneNum = hshi.pPhysicianPhoneNum;
     _oPhysicianPhoneNum = hshi.oPhysicianPhoneNum;
     _diabeticType       = hshi.diabeticType;
     _allergies          = hshi.allergies;
     _heartIssues        = hshi.heartIssues;
     _metabolic          = bool.Parse(hshi.metabolic);
     _jointMuscle        = bool.Parse(hshi.jointMuscle);
     _chronicIllness     = bool.Parse(hshi.chronicIllness);
     _migraines          = bool.Parse(hshi.migraines);
     _neurological       = bool.Parse(hshi.neurological);
     _pulmonary          = bool.Parse(hshi.pulmonary);
     _asthma             = bool.Parse(hshi.asthma);
     _other                     = bool.Parse(hshi.other);
     _otherMeds                 = hshi.otherMeds;
     _specificFirstAidNeeds     = hshi.specificFirstAidNeeds;
     _repPermissionForTreatment = hshi.repPermissionForTreatment;
 }
Exemplo n.º 4
0
        public void SaveHSHI(HighSchoolHealthInfoClass hshi, HealthInfoTextValidation hiCheck)
        {
            string        query      = $"Update HighSchoolHealthInfo Set ";
            List <string> listToSave = new List <string>(new string[] { "primaryPhysician = @PrimaryPhysician", "otherPhysician = @OtherPhysician", "pPhysicianPhoneNum = @PphysicianPhoneNum", "oPhysicianPhoneNum = @OphysicianPhoneNum", "diabeticType = @DiabeticType", "allergies = @Allergies", "heartIssues = @HeartIssues", "metabolic = @Metabolic", "jointMuscle = @JointMuscle", "chronicIllness = @ChronicIllness", "migraines = @Migraines", "neurological = @Neurological", "pulmonary = @Pulmonary", "asthma = @Asthma", "other = @Other", "otherMeds = @OtherMeds", "specificFirstAidNeeds = @SpecificFirstAidNeeds", "repPermissionForTreatment = @RepPermissionForTreatment", "healthSignature = @signature" });
            List <string> toRemove   = hiCheck.IsValid;

            foreach (var v in toRemove)
            {
                for (int i = 0; i < listToSave.Count; i++)
                {
                    if (listToSave[i].Contains(v))
                    {
                        listToSave.RemoveAt(i);
                        i--;
                    }
                }
            }

            foreach (var s in listToSave)
            {
                if (listToSave.IndexOf(s) != listToSave.Count - 1)
                {
                    query += s + ",";
                }

                else
                {
                    query += s;
                }
            }

            query += " Where Id = @id";

            using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnVal("EnrollmentDB")))
            {
                connection.Execute(query,
                                   new { signature = hshi.healthSignature, PrimaryPhysician = hshi.primaryPhysician, OtherPhysician = hshi.otherPhysician, PphysicianPhoneNum = hshi.pPhysicianPhoneNum, OphysicianPhoneNum = hshi.oPhysicianPhoneNum, DiabeticType = hshi.diabeticType, Allergies = hshi.allergies, HeartIssues = hshi.heartIssues, Metabolic = hshi.metabolic, JointMuscle = hshi.jointMuscle, ChronicIllness = hshi.chronicIllness, Migraines = hshi.migraines, Neurological = hshi.neurological, Pulmonary = hshi.pulmonary, Asthma = hshi.asthma, Other = hshi.other, OtherMeds = hshi.otherMeds, SpecificFirstAidNeeds = hshi.specificFirstAidNeeds, RepPermissionForTreatment = hshi.repPermissionForTreatment, id = hshi.Id });
            }
        }