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 AdultECUC() { InitializeComponent(); // create DataAccess variable to retrieve stored information for the user, and autofill DataAccess db = new DataAccess(); aec = db.GetAEC(LoginPage.adultCheck.Id); // set the datacontext of the text fields textFields.DataContext = aec; }
public void UpdateValues(AdultEmergencyContactClass aec) { _contactName = aec.contactName; _relationship = aec.relationship; _primaryNum = aec.primaryNum; _alternateNum = aec.alternateNum; _nameNearestRelative = aec.nameNearestRelative; _NRrelationship = aec.nameNearestRelative; _NRstreetAddress = aec.NRstreetAddress; _NRcity = aec.NRcity; _NRstate = aec.NRstate; _NRzip = aec.NRzip; _NRprimaryNum = aec.NRprimaryNum; _NRworkNum = aec.NRworkNum; _NRcellNum = aec.NRcellNum; }
public void SaveAEC(AdultEmergencyContactClass aec, AdultECUCTextValidation aecCheck) { string query = $"Update AdultEmergencyContact Set "; List <string> listToSave = new List <string>(new string[] { "contactName = @ContactName", "relationship = @Relationship", "primaryNum = @PrimaryNum", "alternateNum = @AlternateNum", "nameNearestRelative = @NameNearestRelative", "NRrelationship = @nrRelationship", "NRstreetAddress = @nrStreetAddress", "NRcity = @nrCity", "NRstate = @nrState", "NRzip = @nrZip", "NRprimaryNum = @nrPrimaryNum", "NRworkNum = @nrWorkNum", "NRcellNum = @nrCellNum" }); List <string> toRemove = aecCheck.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"; if (query.Contains("Set Where")) { return; } using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnVal("EnrollmentDB"))) { connection.Execute(query, new { ContactName = aec.contactName, Relationship = aec.relationship, PrimaryNum = aec.primaryNum, AlternateNum = aec.alternateNum, NameNearestRelative = aec.nameNearestRelative, nrRelationship = aec.NRrelationship, nrStreetAddress = aec.NRstreetAddress, nrCity = aec.NRcity, nrState = aec.NRstate, nrZip = aec.NRzip, nrPrimaryNum = aec.NRprimaryNum, nrWorkNum = aec.NRworkNum, nrCellNum = aec.NRcellNum, id = aec.Id }); } }