private void Load() { DataAccess db = new DataAccess(); abi = db.GetABI(Id); aec = db.GetAEC(Id); ahi = db.GetAHI(Id); ap = db.GetAP(Id); aci = db.GetACI(Id); BasicInfoField.DataContext = abi; EmergencyContactField.DataContext = aec; HealthInformationField.DataContext = ahi; StudentPolicyField.DataContext = ap; ConfidentialInfoField.DataContext = aci; if (ahi.healthSignature != null) { using (MemoryStream ms = new MemoryStream(ahi.healthSignature)) { HISignatureCanvas.Strokes = new System.Windows.Ink.StrokeCollection(ms); ms.Close(); } } if (ap.studentSignature != null) { using (MemoryStream ms = new MemoryStream(ap.studentSignature)) { policySignatureCanvas.Strokes = new System.Windows.Ink.StrokeCollection(ms); ms.Close(); } } }
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)); }
public void UpdateValues(AdultHealthInfoClass ahi) { _primaryPhysician = ahi.primaryPhysician; _otherPhysician = ahi.otherPhysician; _pPhysicianPhoneNum = ahi.pPhysicianPhoneNum; _oPhysicianPhoneNum = ahi.oPhysicianPhoneNum; _diabeticType = ahi.diabeticType; _allergies = ahi.allergies; _heartIssues = ahi.heartIssues; _metabolic = bool.Parse(ahi.metabolic); _jointMuscle = bool.Parse(ahi.jointMuscle); _chronicIllness = bool.Parse(ahi.chronicIllness); _migraines = bool.Parse(ahi.migraines); _neurological = bool.Parse(ahi.neurological); _pulmonary = bool.Parse(ahi.pulmonary); _asthma = bool.Parse(ahi.asthma); _other = bool.Parse(ahi.other); _otherMeds = ahi.otherMeds; _specificFirstAidNeeds = ahi.specificFirstAidNeeds; _repPermissionForTreatment = ahi.repPermissionForTreatment; }
public void SaveAHI(AdultHealthInfoClass ahi, HealthInfoTextValidation hiCheck) { string query = $"Update AdultHealthInfo 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 = ahi.healthSignature, PrimaryPhysician = ahi.primaryPhysician, OtherPhysician = ahi.otherPhysician, PphysicianPhoneNum = ahi.pPhysicianPhoneNum, OphysicianPhoneNum = ahi.oPhysicianPhoneNum, DiabeticType = ahi.diabeticType, Allergies = ahi.allergies, HeartIssues = ahi.heartIssues, Metabolic = ahi.metabolic, JointMuscle = ahi.jointMuscle, ChronicIllness = ahi.chronicIllness, Migraines = ahi.migraines, Neurological = ahi.neurological, Pulmonary = ahi.pulmonary, Asthma = ahi.asthma, Other = ahi.other, OtherMeds = ahi.otherMeds, SpecificFirstAidNeeds = ahi.specificFirstAidNeeds, RepPermissionForTreatment = ahi.repPermissionForTreatment, id = ahi.Id }); } }