public HighSchoolConfidentialInfoUC() { InitializeComponent(); // DataAccess variable to retrieve and autofill previously saved information for the user DataAccess db = new DataAccess(); hsci = db.GetHSCI(LoginPage.highschoolCheck.Id); // code avoids an error when retrieving data to autofill if the signature has not been filled out yet if (hsci.parentSignature != null) { using (MemoryStream ms = new MemoryStream(hsci.parentSignature)) { signatureCanvas.Strokes = new System.Windows.Ink.StrokeCollection(ms); ms.Close(); } } // set datacontext textFields.DataContext = hsci; // set base color for signature border sigCanBorder.BorderBrush = new SolidColorBrush(Color.FromRgb(33, 148, 243)); }
public void SaveHSCI(HighSchoolConfidentialInfoClass hsci) { using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnVal("EnrollmentDB"))) { connection.Execute($"Update HighSchoolConfidentialInfo Set formCompletionDate = @FormCompletionDate, foodStamps = @FoodStamps, dependentChildrenAid = @DependentChildrenAid, supplementaryIncome = @SupplementaryIncome, housingAssistance = @HousingAssistance, none = @None, homeless = @Homeless, agedOutFosterCare = @AgedOutFosterCare, parentsActiveDuty = @ParentsActiveDuty, reducedLunch = @ReducedLunch, parentSignature = @parentSig Where Id = @id", new { FormCompletionDate = hsci.formCompletionDate, parentSig = hsci.parentSignature, FoodStamps = hsci.foodStamps, DependentChildrenAid = hsci.dependentChildrenAid, SupplementaryIncome = hsci.supplementaryIncome, HousingAssistance = hsci.housingAssistance, None = hsci.none, Homeless = hsci.homeless, AgedOutFosterCare = hsci.agedOutFosterCare, ParentsActiveDuty = hsci.parentsActiveDuty, ReducedLunch = hsci.reducedLunch, id = hsci.Id }); connection.Execute($"Update HighSchoolLogins Set submitted = @Submitted, dateSubmitted = @DateSubmitted Where Id = @id", new { Submitted = "Yes", DateSubmitted = DateTime.Now, id = hsci.Id }); } }
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(); } } }