public HighSchoolStudentPolicyUC()
        {
            InitializeComponent();

            // DataAccess variable to retrieve and autofill previously stored information for the user
            DataAccess db = new DataAccess();

            hsp = db.GetHSP(LoginPage.highschoolCheck.Id);

            // if signature fields have not been filled out yet, these code blocks avoid encountering an error
            if (hsp.studentSignature != null)
            {
                using (MemoryStream ms = new MemoryStream(hsp.studentSignature))
                {
                    signatureCanvas.Strokes = new System.Windows.Ink.StrokeCollection(ms);
                    ms.Close();
                }
            }

            if (hsp.parentSignature != null)
            {
                using (MemoryStream ms = new MemoryStream(hsp.parentSignature))
                {
                    parentSignatureCanvas.Strokes = new System.Windows.Ink.StrokeCollection(ms);
                    ms.Close();
                }
            }

            // set the datacontext of the text fields to be the AdultEmergencyContact variable
            textFields.DataContext = hsp;

            // set base colors of signature borders
            sigCanBorder.BorderBrush    = new SolidColorBrush(Color.FromRgb(33, 148, 243));
            parSigCanBorder.BorderBrush = new SolidColorBrush(Color.FromRgb(33, 148, 243));
        }
示例#2
0
 public void UpdateValues(HighSchoolPolicyClass hsp)
 {
     _attendance            = bool.Parse(hsp.attendance);
     _tobacco               = bool.Parse(hsp.tobacco);
     _internetAccess        = bool.Parse(hsp.internetAccess);
     _studentInsurance      = bool.Parse(hsp.studentInsurance);
     _fieldTrips            = bool.Parse(hsp.fieldTrips);
     _drugTesting           = bool.Parse(hsp.drugTesting);
     _noticeOfDisclosures   = bool.Parse(hsp.noticeOfDisclosures);
     _cellPhoneContact      = bool.Parse(hsp.cellPhoneContact);
     _releaseForPhotography = bool.Parse(hsp.releaseForPhotography);
 }
        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 SaveHSP(HighSchoolPolicyClass hsp, PolicyTextValidation pCheck)
        {
            string        query      = $"Update HighSchoolPolicy Set ";
            List <string> listToSave = new List <string>(new string[] { "parentSignature = @ParentSignature", "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 { ParentSignature = hsp.parentSignature, signature = hsp.studentSignature, Attendance = hsp.attendance, Tobacco = hsp.tobacco, InternetAccess = hsp.internetAccess, StudentInsurance = hsp.studentInsurance, FieldTrips = hsp.fieldTrips, DrugTesting = hsp.drugTesting, NoticeOfDisclosures = hsp.noticeOfDisclosures, CellPhoneContact = hsp.cellPhoneContact, ReleaseForPhotography = hsp.releaseForPhotography, id = hsp.Id });
            }
        }