private void ViewAndEditBtnHS_Click(object sender, RoutedEventArgs e)
        {
            HighSchoolBasicInfoClass hsbi = myHSDataGrid.SelectedItem as HighSchoolBasicInfoClass;

            AdminStudentInformationWindowHS asiw = new AdminStudentInformationWindowHS(hsbi.Id);

            asiw.ShowDialog();
        }
Exemple #2
0
        public HighSchoolBasicInformationUC()
        {
            InitializeComponent();

            // DataAccess variable to retrieve and autofill previously saved information
            DataAccess db = new DataAccess();

            hbi = db.GetHSBI(LoginPage.highschoolCheck.Id);

            textFields.DataContext = hbi;
        }
        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();
                }
            }
        }
 public void UpdateValues(HighSchoolBasicInfoClass hbi)
 {
     _lastName         = hbi.lastName;
     _firstName        = hbi.firstName;
     _middleInitial    = hbi.middleInitial;
     _program          = hbi.program;
     _streetAddress    = hbi.streetAddress;
     _city             = hbi.city;
     _state            = hbi.state;
     _zip              = hbi.zipCode;
     _primaryPhoneNum  = hbi.primaryPhoneNum;
     _cellPhoneNum     = hbi.cellPhoneNum;
     _hispanicOrLatino = hbi.hispanicOrLatino;
     _race             = hbi.race;
     _gender           = hbi.gender;
     _dateOfBirth      = hbi.dateOfBirth;
     _currentEdLevel   = hbi.currentEdLevel;
     _sendingHS        = hbi.sendingHS;
 }
        public void SaveHSBI(HighSchoolBasicInfoClass hsbi, HighSchoolBasicInfoTextValidation hsbiCheck)
        {
            string        query      = $"Update HighSchoolBasicInfo 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", "currentEdLevel = @CurrentEdLevel", "sendingHS = @SendingHS" });

            List <string> toRemove = hsbiCheck.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 = hsbi.lastName, FirstName = hsbi.firstName, MiddleInitial = hsbi.middleInitial, PreferredName = hsbi.preferredName, Program = hsbi.program, StreetAddress = hsbi.streetAddress, City = hsbi.city, State = hsbi.state, ZipCode = hsbi.zipCode, PrimaryPhoneNum = hsbi.primaryPhoneNum, CellPhoneNum = hsbi.cellPhoneNum, HispanicOrLatino = hsbi.hispanicOrLatino, Race = hsbi.race, Gender = hsbi.gender, DateOfBirth = hsbi.dateOfBirth, CurrentEdLevel = hsbi.currentEdLevel, SendingHS = hsbi.sendingHS, id = hsbi.Id });
            }
        }