public static Student MapToModel(this StudentDto student, ContactDto teacher)
        {
            var stu = new Student()
                       {
                           Id = student.Id,
                           AmountFromEnvelope = student.AmountFromEnvelope,
                           AmountFromWebsite = student.AmountFromWebsite,
                           Comments = student.Comments,
                           EnvelopeNumber = student.EnvelopeNumber,
                           FirstName = student.FirstName,
                           LastName = student.LastName,
                           Grade = student.Grade,
                           MinutesRead = student.MinutesRead,
                           PagesRead = student.PagesRead,
                           SchoolName = student.SchoolName,
                           ShirtSize = student.ShirtSize,
                           Address1 = student.Address1,
                           Address2 = student.Address2,
                           City = student.City,
                           State = student.State,
                           Zip = student.Zip,
                           Phone = student.Phone,
                           TeacherId = student.TeacherId,
                           ReadingGoal = student.ReadingGoal,
                           FundraisingGoal = student.FundraisingGoal,

                       };
            if (teacher != null)
                stu.TeacherName = teacher.LastName;
            return stu;
        }
 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();
 }
 public void LoadPrototype(Student prototype)
 {
     School = _schoolRepo.Find(s => s.Name == prototype.SchoolName);
     Teacher = getContactDto(prototype);
 }
 public void LoadPrototype(StudentPrototype prototype)
 {
     School = _schoolRepo.Find(s => s.Id == prototype.SchoolId);
     prototype.SchoolName = School.Name;
     Teacher = getContactDto(prototype);
 }
        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;
        }
Exemple #6
0
 private static SelectListItem getContactListItem(ContactDto contact)
 {
     var display = contact.DisplayName();
     var item = new SelectListItem { Text = display, Value = contact.Id.ToString() };
     return item;
 }
 private static string DisplayName(ContactDto contact)
 {
     if (contact.FirstName == null)
             return contact.LastName;
         return contact.LastName + ", " + contact.FirstName;
 }
 public void AddContact(SchoolDto school, ContactDto contactDto)
 {
     contactDto.Id =  (long) _session.Save(contactDto);
     school.Contacts.Add(contactDto);
     _session.Flush();
 }