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(); } } }
private void ViewAndEditBtn_Click(object sender, RoutedEventArgs e) { AdultBasicInfoClass abi = myDataGrid.SelectedItem as AdultBasicInfoClass; AdminStudentInformationWindowA asiwA = new AdminStudentInformationWindowA(abi.Id); asiwA.ShowDialog(); }
public AdultBasicInformationUC() { InitializeComponent(); // create DataAccess object to pull all the information stored in the database for this user and autofill fields DataAccess db = new DataAccess(); abi = db.GetABI(LoginPage.adultCheck.Id); textFields.DataContext = abi; }
public void SaveABI(AdultBasicInfoClass abi, AdultBasicInfoTextValidation abiCheck) { string query = $"Update AdultBasicInfo Set "; List <string> listToSave = new List <string>(new string[] { "lastName = @LastName", "firstName = @FirstName", "middleInitial = @MiddleInitial", "preferredName = @PreferredName", "program = @Program", "streetAddress = @StreetAddress", "city = @City", "state = @State", "zipCode = @ZipCode", "primaryPhoneNum = @PrimaryPhoneNum", "cellPhoneNum = @CellPhoneNum", "hispanicOrLatino = @HispanicOrLatino", "race = @Race", "gender = @Gender", "dateOfBirth = @DateOfBirth", "SSN = @ssn", "completedEdLevel = @CompletedEdLevel", "attendedCollegeOrTech = @AttendedCollegeOrTech", "liveWithParent = @LiveWithParent" }); List <string> toRemove = abiCheck.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 { LastName = abi.lastName, FirstName = abi.firstName, MiddleInitial = abi.middleInitial, PreferredName = abi.preferredName, Program = abi.program, StreetAddress = abi.streetAddress, City = abi.city, State = abi.state, ZipCode = abi.zipCode, PrimaryPhoneNum = abi.primaryPhoneNum, CellPhoneNum = abi.cellPhoneNum, HispanicOrLatino = abi.hispanicOrLatino, Race = abi.race, Gender = abi.gender, DateOfBirth = abi.dateOfBirth, ssn = abi.SSN, CompletedEdLevel = abi.completedEdLevel, AttendedCollegeOrTech = abi.attendedCollegeOrTech, LiveWithParent = abi.liveWithParent, id = abi.Id }); } }
public void UpdateValues(AdultBasicInfoClass abi) { _lastName = abi.lastName; _firstName = abi.firstName; _middleInitial = abi.middleInitial; _program = abi.program; _streetAddress = abi.streetAddress; _city = abi.city; _state = abi.state; _zip = abi.zipCode; _primaryPhoneNum = abi.primaryPhoneNum; _cellPhoneNum = abi.cellPhoneNum; _hispanicOrLatino = abi.hispanicOrLatino; _race = abi.race; _gender = abi.gender; _dateOfBirth = abi.dateOfBirth; _completedEdLevel = abi.completedEdLevel; _attendedCollegeOrTech = abi.attendedCollegeOrTech; _liveWithParent = abi.liveWithParent; _SSN = abi.SSN; _Id = abi.Id; }