Example #1
0
 public static StudentDto MapFromPrototype(this StudentPrototype student, IStudentMappingHelper helper)
 {
     var dto = new StudentDto()
     {
         AmountFromEnvelope = student.AmountFromEnvelope.CastToDecimal(),
         AmountFromWebsite = student.AmountFromWebsite.CastToDecimal(),
         FundraisingGoal = student.FundraisingGoal.CastToDecimal(),
         Comments = student.Comments,
         EnvelopeNumber = student.EnvelopeNumber,
         FirstName = student.FirstName,
         LastName = student.LastName,
         Grade = student.Grade,
         MinutesRead = student.MinutesRead.CastToInt(),
         PagesRead = student.PagesRead.CastToInt(),
         ReadingGoal = student.ReadingGoal.CastToInt(),
         SchoolName = helper.School.Name,
         ShirtSize = student.ShirtSize,
         Address1 = student.Address1,
         Address2 = student.Address2,
         City = student.City,
         State = student.State,
         Zip = student.Zip,
         Phone = student.Phone
     };
     if (helper.Teacher != null)
     {
         dto.TeacherId = helper.Teacher.Id;
     }
     return dto;
 }
 public StudentDownloadDto(StudentDto source, ContactDto teacher)
 {
     Address1 = source.Address1;
     Address2 = source.Address2;
     AmountFromWebsite = source.AmountFromWebsite;
     FirstName = source.FirstName;
     LastName = source.LastName;
     City = source.City;
     State = source.State;
     Zip = source.Zip;
     Phone = source.Phone;
     Grade = source.Grade;
     School = source.SchoolName;
     Teacher = string.Format("{0} {1}", teacher.FirstName, teacher.LastName).Trim();
 }
        private StudentPackage getStudentFromRow(XElement row)
        {
            var pkg = new StudentPackage();
            var elements = row.Elements("td");
            var arr = elements.ToArray();
            var s = new StudentDto();
            s.FirstName = arr[0].Value;
            s.LastName = arr[1].Value;
            s.AmountFromWebsite = arr[5].Value.CastToDecimal();
            s.Address1 = arr[8].Value;
            s.Address2 = arr[9].Value;
            s.City = arr[10].Value;
            s.State = arr[11].Value;
            s.Zip = arr[12].Value;
            s.Phone = arr[13].Value;
            var school = new SchoolDto() {Name = correctSchoolName(arr[14].Value)};
            var teacher = new ContactDto() { LastName = arr[15].Value, Title = "Teacher" };

            s.Grade = arr[16].Value;
            pkg.school = school;
            pkg.teacher = teacher;
            pkg.student = s;
            return pkg;
        }
Example #4
0
 public static StudentDto MergeWithModel(this Student student, StudentDto dto, 
     IStudentMappingHelper helper)
 {
     dto.Id = student.Id;
     dto.AmountFromEnvelope = student.AmountFromEnvelope.CastToDecimal();
     dto.AmountFromWebsite = student.AmountFromWebsite.CastToDecimal();
     dto.FundraisingGoal = student.FundraisingGoal.CastToDecimal();
     dto.EnvelopeNumber = student.EnvelopeNumber;
     dto.FirstName = student.FirstName;
     dto.LastName = student.LastName;
     dto.Grade = student.Grade;
     dto.MinutesRead = student.MinutesRead.CastToInt();
     dto.PagesRead = student.PagesRead.CastToInt();
     dto.ReadingGoal = student.ReadingGoal.CastToInt();
     dto.SchoolName = helper.School.Name;
     dto.ShirtSize = student.ShirtSize;
     dto.Address1 = student.Address1;
     dto.Address2 = student.Address2;
     dto.City = student.City;
     dto.State = student.State;
     dto.Zip = student.Zip;
     dto.Phone = student.Phone;
     dto.TeacherId = helper.Teacher.Id;
     dto.Comments = student.Comments;
     return dto;
 }