Beispiel #1
0
        public bool UpdatePerson(VmPerson vmPerson)
        {
            try
            {
                var personRepository   = UnitOfWork.GetRepository <PersonRepository>();
                var dietTypeRepository = UnitOfWork.GetRepository <DietTypeRepository>();

                var person = new Person
                {
                    Id                     = vmPerson.Id,
                    SizeId                 = vmPerson.SizeId,
                    Sex                    = vmPerson.Sex,
                    UniversityId           = vmPerson.UniversityId,
                    JacketSizeId           = vmPerson.JacketSizeId,
                    UserId                 = vmPerson.UserId,
                    ResumeUrl              = vmPerson.ResumeUrl,
                    FirstName              = vmPerson.FirstName,
                    LastName               = vmPerson.LastName,
                    StreetLine1            = vmPerson.StreetLine1,
                    StreetLine2            = vmPerson.StreetLine2,
                    City                   = vmPerson.City,
                    State                  = vmPerson.State,
                    ZipCode                = vmPerson.ZipCode,
                    EmgyPersonFirstName    = vmPerson.EmgyPersonFirstName,
                    EmgyPersonLastName     = vmPerson.EmgyPersonLastName,
                    EmgyPersonPhoneNumber  = vmPerson.EmgyPersonPhoneNumber,
                    EmgyPersonRelationship = vmPerson.EmgyPersonRelationship,
                    ShortBio               = vmPerson.ShortBio,

                    WelcomeDinner             = vmPerson.WelcomeDinner,
                    LunchOnMonday             = vmPerson.LunchOnMonday,
                    LunchOnTuesday            = vmPerson.LunchOnTuesday,
                    ReceptionNetworkOnTuesday = vmPerson.ReceptionNetworkOnTuesday,
                    AwardBanquet   = vmPerson.AwardBanquet,
                    NoneOfTheAbove = vmPerson.NoneOfTheAbove,
                    SecondaryEmail = vmPerson.SecondaryEmail,
                    Agreement      = vmPerson.Agreement,
                };

                if (vmPerson.DietTypeId == 5)
                {
                    var dietType = new DietType
                    {
                        Id      = dietTypeRepository.GetDietTypeNewId(),
                        Name    = vmPerson.DietType,
                        Display = true,
                    };

                    person.DietTypeId = dietType.Id;

                    dietTypeRepository.CreateDietType(dietType);
                }
                else
                {
                    person.DietTypeId = vmPerson.DietTypeId;
                }

                person.Allergies = vmPerson.Allergies;

                personRepository.UpdatePerson(person);

                //Do not delete its for next year
                //if (vmPerson.RoleId == "4d7951d8-8eda-4452-8ff1-dfc9076d8bbe")
                //{
                //    var userTaskRepository = UnitOfWork.GetRepository<UserTaskRepository>()

                //    userTaskRepository.DeleteUserTasks(vmPerson.UserId);
                //    userTaskRepository.CreateTasksUser(vmPerson.UserId, vmPerson.TaskIds);
                //}

                var teamMemberRepository = UnitOfWork.GetRepository <TeamMemberRepository>();

                var updateableTeamMember = new TeamMember
                {
                    MemberUserId       = vmPerson.UserId,
                    RegistrationStatus = true,
                };

                teamMemberRepository.UpdateTeamMemberRegistrationStatusByUserId(updateableTeamMember);


                UnitOfWork.Commit();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #2
0
 public static void EditTeamMemberLead(int id, TeamMember lead)
 {
     TryGet(id).Lead = lead;
 }