public AdultStudentPolicyUC() { InitializeComponent(); // Data Access variable to retrieve and autofill stored information for the user DataAccess db = new DataAccess(); ap = db.GetAP(LoginPage.adultCheck.Id); // code avoids getting an error on data retrieval if the signature has not been filled out yet if (ap.studentSignature != null) { using (MemoryStream ms = new MemoryStream(ap.studentSignature)) { signatureCanvas.Strokes = new System.Windows.Ink.StrokeCollection(ms); ms.Close(); } } // set the datacontext of the text fields to be the AdultEmergencyContact variable textFields.DataContext = ap; // set border of signature to be base color sigCanBorder.BorderBrush = new SolidColorBrush(Color.FromRgb(33, 148, 243)); }
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 void UpdateValues(AdultPolicyClass ap) { _attendance = bool.Parse(ap.attendance); _tobacco = bool.Parse(ap.tobacco); _internetAccess = bool.Parse(ap.internetAccess); _studentInsurance = bool.Parse(ap.studentInsurance); _fieldTrips = bool.Parse(ap.fieldTrips); _drugTesting = bool.Parse(ap.drugTesting); _noticeOfDisclosures = bool.Parse(ap.noticeOfDisclosures); _cellPhoneContact = bool.Parse(ap.cellPhoneContact); _releaseForPhotography = bool.Parse(ap.releaseForPhotography); }
public void SaveAP(AdultPolicyClass ap, PolicyTextValidation pCheck) { string query = $"Update AdultPolicy Set "; List <string> listToSave = new List <string>(new string[] { "attendance = @Attendance", "tobacco = @Tobacco", "internetAccess = @InternetAccess", "studentInsurance = @StudentInsurance", "fieldTrips = @FieldTrips", "drugTesting = @DrugTesting", "noticeOfDisclosures = @NoticeOfDisclosures", "cellPhoneContact = @CellPhoneContact", "releaseForPhotography = @ReleaseForPhotography", "studentSignature = @signature" }); List <string> toRemove = pCheck.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 = ap.studentSignature, Attendance = ap.attendance, Tobacco = ap.tobacco, InternetAccess = ap.internetAccess, StudentInsurance = ap.studentInsurance, FieldTrips = ap.fieldTrips, DrugTesting = ap.drugTesting, NoticeOfDisclosures = ap.noticeOfDisclosures, CellPhoneContact = ap.cellPhoneContact, ReleaseForPhotography = ap.releaseForPhotography, id = ap.Id }); } }