Esempio n. 1
0
        /// <summary>
        /// Добавить сотрудника
        /// </summary>
        /// <param name="addedEmployee">DTO добавляемого сотрудника</param>
        /// <returns>Сотрудник</returns>
        public Employee Add(EmployeeDto addedEmployee)
        {
            Contract.Argument.IsNotNull(addedEmployee, nameof(addedEmployee));

            var userId            = _userContextPrtovider.GetUserId();
            var contact           = _contactService.Add(addedEmployee.Contact);
            var passport          = _passportService.Add(addedEmployee.Passport);
            var organization      = _organizationService.Add(addedEmployee.Organization);
            var stateRegistration = _stateRegistrationService.Add(addedEmployee.StateRegistration);

            var newEmployee = _employeeRepository.Create(
                userId: userId,
                managerId: addedEmployee.ManagerId,
                contactId: contact.Id,
                passportId: passport.Id,
                invitationId: null,
                organizationId: organization.Id,
                stateRegistrationId: stateRegistration.Id,
                academicDegree: addedEmployee.AcademicDegree,
                academicRank: addedEmployee.AcademicRank,
                education: addedEmployee.Education,
                position: addedEmployee.Position,
                workPlace: addedEmployee.WorkPlace);

            return(newEmployee);
        }
Esempio n. 2
0
        /// <summary>
        /// Добавить организацию
        /// </summary>
        /// <param name="addedOrganization">DTO добавляемой организации</param>
        public Organization Add(OrganizationDto addedOrganization)
        {
            Contract.Argument.IsNotNull(addedOrganization, nameof(addedOrganization));

            var stateRegistration = _stateRegistrationService.Add(addedOrganization.StateRegistration);

            var organization = _organizationRepository.Create(
                stateRegistrationId: stateRegistration.Id,
                name: addedOrganization.Name,
                shortName: addedOrganization.ShortName,
                legalAddress: addedOrganization.LegalAddress,
                scientificActivity: addedOrganization.ScientificActivity);

            return(organization);
        }
Esempio n. 3
0
        /// <summary>
        /// Добавить иностранца
        /// </summary>
        /// <param name="addedAlien">DTO добавляемого иностранца</param>
        public Alien Add(AlienDto addedAlien)
        {
            Contract.Argument.IsNotNull(addedAlien, nameof(addedAlien));

            var alienContact           = _contactService.Add(addedAlien.Contact);
            var alienPassport          = _passportService.Add(addedAlien.Passport);
            var alienOrganization      = _organizationService.Add(addedAlien.Organization);
            var alienStateRegistration = _stateRegistrationService.Add(addedAlien.StateRegistration);

            var alien = _alienRepository.Create(
                invitationId: addedAlien.InvitationId,
                contactId: alienContact.Id,
                passportId: alienPassport.Id,
                organizationId: alienOrganization.Id,
                stateRegistrationId: alienStateRegistration.Id,
                position: addedAlien.Position,
                workPlace: addedAlien.WorkPlace,
                workAddress: addedAlien.WorkAddress,
                stayAddress: addedAlien.StayAddress);

            return(alien);
        }