Ejemplo n.º 1
0
        public override employee ToDto(Employee model)
        {
            employee em = new employee()
            {
                address       = model.Address,
                birthday      = model.BirthDay,
                code          = model.Code,
                birthdayType  = model.BirthDayType,
                description   = model.Description,
                education     = model.Education,
                email         = model.Email,
                id            = model.Id,
                idCardCode    = model.IdCardCode,
                isVirtual     = model.IsVirtual,
                mobileNumber  = model.MobileNumber,
                name          = model.Name,
                passWord      = model.Passwrod,
                serveState    = model.ServeState,
                sex           = model.Sex,
                nationality   = model.Nationality,
                userId        = model.UserId,
                pictureUrl    = model.PictureUrl,
                QQ            = model.QQ,
                WeChat        = model.WeChat,
                userRoleIds   = model.UserRoleIds == null?null:model.UserRoleIds.Split(','),
                permissionIds = model.PermissionIds == null ? null : model.PermissionIds.Split(','),
            };

            if (model.Department != null)
            {
                em.departmentId   = model.Department.Id;
                em.departmentName = model.Department.Name;
            }
            if (model.ServingRecords != null)
            {
                var jpC = new JobPositionConverter(DbContext);
                List <servingRecord> list = new List <servingRecord>();
                foreach (var item in model.ServingRecords)
                {
                    servingRecord record = new servingRecord
                    {
                        beginTime    = item.BeginTime,
                        employeeId   = item.Employee.Id,
                        endTime      = item.EndTime,
                        id           = item.Id,
                        isConcurrent = item.IsConcurrent,
                        isCurrent    = item.IsCurrent,
                        jobPosition  = jpC.ToDto(item.JobPosition)
                    };
                    list.Add(record);
                }
                em.servingRecords = list.ToArray();
            }
            if (model.Image != null)
            {
                em.image = Convert.ToBase64String(model.Image);
            }
            return(em);
        }
Ejemplo n.º 2
0
        public static ServingRecordVM FromDto(servingRecord dto)
        {
            ServingRecordVM vm = new ServingRecordVM()
            {
                BeginTime    = dto.beginTime,
                EndTime      = dto.endTime,
                Id           = dto.id,
                IsConcurrent = dto.isConcurrent,
                IsCurrent    = dto.isCurrent,
                JobPosition  = dto.jobPosition == null ? null : JobPositionConvertUtil.FromDto(dto.jobPosition),
            };

            return(vm);
        }
Ejemplo n.º 3
0
        public static servingRecord ToDto(ServingRecordVM vm)
        {
            servingRecord dto = new servingRecord()
            {
                beginTime    = vm.BeginTime,
                employeeId   = vm.Employee?.Id,
                endTime      = vm.EndTime,
                id           = vm.Id,
                isConcurrent = vm.IsConcurrent,
                isCurrent    = vm.IsCurrent,
                jobPosition  = vm.JobPosition == null ? null : JobPositionConvertUtil.ToDto(vm.JobPosition),
            };

            return(dto);
        }