public void GetValueTest()
 {
     CommonPlaceholderHelper target = new CommonPlaceholderHelper(); // TODO: Initialize to an appropriate value
     string placeholder = string.Empty; // TODO: Initialize to an appropriate value
     string expected = string.Empty; // TODO: Initialize to an appropriate value
     string actual;
     actual = target.GetValue(placeholder);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
        public MemoryStream Process(ClassEnrollment enrollment, IEnumerable<StudentGrade> grades)
        {
            var gradeList = grades.ToList();
            var placeholderHelper = new CommonPlaceholderHelper();
            placeholderHelper.SetValues(enrollment.Student, enrollment.Class.Teacher);
            placeholderHelper.SetValues(Period, Period.ReportingPeriod, Period.School, Period.School.SchoolDistrict);

            //string filename = String.Format("{0}{2} {1}.pdf", @"d:\cards\", enrollment.Student.LastName, enrollment.Student.FirstName);

            //FileStream stream = new FileStream(filename, FileMode.Create);
            var stream = new MemoryStream();
            var reader = new PdfReader(Template);
            var stamper = new PdfStamper(reader, stream);

            var form = stamper.AcroFields;
            var fieldKeys = form.Fields.Keys;

            foreach (var fieldKey in fieldKeys)
            {
                var match = KeyPattern.Match(fieldKey);

                if (match.Success)
                {
                    var key = match.Groups["ph"].Value;
                    var term = 1;

                    var termGroup = match.Groups["term"];
                    if (termGroup.Success)
                    {
                        int.TryParse(termGroup.Value, out term);
                    }

                    var standard = Standards.FirstOrDefault(p => p.Placeholder == key);

                    if (standard == null)
                    {
                        form.SetField(fieldKey, placeholderHelper.GetValue(fieldKey));
                        continue;
                    }

                    var gradingTerm = Terms.FirstOrDefault(p => p.TermNum == term);

                    if (gradingTerm == null)
                    {
                        form.SetField(fieldKey, string.Empty);
                        continue;
                    }

                    var grade = gradeList.FirstOrDefault(p => p.GradingStandard == standard && p.GradingTermID == gradingTerm.GradingTermID);

                    if (grade == null)
                    {
                        form.SetField(fieldKey, string.Empty);
                        continue;
                    }

                    form.SetField(fieldKey, grade.Grade);
                }
                else
                {
                    form.SetField(fieldKey, string.Empty);
                }
            }

            // "Flatten" the form so it wont be editable/usable anymore
            stamper.FormFlattening = true;

            stamper.Close();
            reader.Close();

            return stream;
        }
 public void CommonPlaceholderHelperConstructorTest()
 {
     CommonPlaceholderHelper target = new CommonPlaceholderHelper();
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
 public void SetValueTest1()
 {
     CommonPlaceholderHelper target = new CommonPlaceholderHelper(); // TODO: Initialize to an appropriate value
     string placeholder = string.Empty; // TODO: Initialize to an appropriate value
     string value = string.Empty; // TODO: Initialize to an appropriate value
     target.SetValue(placeholder, value);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
 public void SetValuesTest1()
 {
     CommonPlaceholderHelper target = new CommonPlaceholderHelper(); // TODO: Initialize to an appropriate value
     Student student = null; // TODO: Initialize to an appropriate value
     Teacher teacher = null; // TODO: Initialize to an appropriate value
     target.SetValues(student, teacher);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
 public void SetValuesTest()
 {
     CommonPlaceholderHelper target = new CommonPlaceholderHelper(); // TODO: Initialize to an appropriate value
     SchoolPeriod schoolPeriod = null; // TODO: Initialize to an appropriate value
     ReportingPeriod reportingPeriod = null; // TODO: Initialize to an appropriate value
     School school = null; // TODO: Initialize to an appropriate value
     SchoolDistrict district = null; // TODO: Initialize to an appropriate value
     target.SetValues(schoolPeriod, reportingPeriod, school, district);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }