Exemplo n.º 1
0
        private void SetProfessionalExperience(Konsultant newConsultant, ProfessionalExperienceViewModel exper)
        {
            ProfessionalExperience current = null;

            if (!string.IsNullOrEmpty(exper.Id))
            {
                //update values if exists
                current            = _expService.GetById(Guid.Parse(exper.Id));
                current.IsRelevant = exper.IsRelevant;
                current.Position   = exper.Position;
                current.StartDate  = exper.StartDate;
                current.EndDate    = exper.EndDate;
                current.Summary    = exper.Summary;
            }
            else
            {
                //create a new one
                current = new ProfessionalExperience(exper, newConsultant.Id);
            }

            foreach (var acc in exper.Accomplishments)
            {
                SetAccomplishment(current, acc);
            }

            foreach (var tech in exper.TechnicalEnvironments)
            {
                SetTechnicalEnvironment(current, tech);
            }

            newConsultant.ProfessionalExperiences.Add(current);
        }
Exemplo n.º 2
0
 public ProfessionalExperience(ProfessionalExperienceViewModel exper, Guid konsultantId)
 {
     Position     = exper.Position;
     Summary      = exper.Summary;
     Customer     = exper.Customer;
     StartDate    = exper.StartDate;
     EndDate      = exper.EndDate;
     IsRelevant   = exper.IsRelevant;
     KonsultantId = konsultantId;
 }
Exemplo n.º 3
0
        public KonsultantCreationModel toViewModel(Konsultant source)
        {
            if (source == null)
            {
                return(new KonsultantCreationModel());
            }

            var result = new KonsultantCreationModel
            {
                Id           = source.Id.ToString(),
                Name         = source.Name,
                Surname      = source.Surname,
                Function     = source.Function,
                Availability = source.Availability.Date,
            };


            foreach (var comp in source.Competences)
            {
                var current = new CompetenceViewModel
                {
                    Id         = comp.CompetenceId.ToString(),
                    Name       = comp.Competence?.Name,
                    Rating     = (int)comp.Rating,
                    IsRelevant = comp.IsRelevant
                };

                result.Competences.Add(current);

                result.Competences = result.Competences.OrderByDescending(x => x.Rating).ToList();
            }

            foreach (var lang in source.Languages)
            {
                var current = new LanguageViewModel
                {
                    Id         = lang.LanguageId.ToString(),
                    Name       = lang.Language?.Name,
                    Fluency    = (int)lang.Fluency,
                    IsRelevant = lang.IsRelevant,
                };

                result.Languages.Add(current);
            }

            foreach (var edu in source.Educations)
            {
                var current = new EducationViewModel
                {
                    Id         = edu.EducationId.ToString(),
                    Name       = edu.Education?.Name,
                    StartDate  = edu.StartDate.Date,
                    EndDate    = edu.EndDate.Date,
                    IsRelevant = edu.IsRelevant
                };

                result.Educations.Add(current);
            }

            foreach (var cert in source.Certificates)
            {
                var current = new CertificateViewModel
                {
                    Id            = cert.CertificateId.ToString(),
                    Name          = cert.Certificate?.Name,
                    Obtension     = cert.Obtension,
                    EndOfValidity = cert.EndOfValidity,
                    IsRelevant    = cert.IsRelevant
                };

                result.Certificates.Add(current);
            }

            foreach (var exp in source.ProfessionalExperiences)
            {
                var curr = new ProfessionalExperienceViewModel
                {
                    Id         = exp.Id.ToString(),
                    Position   = exp.Position,
                    Summary    = exp.Summary,
                    Customer   = exp.Customer,
                    StartDate  = exp.StartDate.Date,
                    EndDate    = exp.EndDate.Date,
                    IsRelevant = exp.IsRelevant
                };

                foreach (var acc in exp.Accomplishments)
                {
                    var accomplished = new AccomplishmentViewModel
                    {
                        Id         = acc.Id.ToString(),
                        Title      = acc.Title,
                        IsRelevant = acc.IsRelevant
                    };
                    curr.Accomplishments.Add(accomplished);
                }
                ;

                foreach (var tech in exp.TechnicalEnvironments)
                {
                    var technical = new TechnicalEnvironmentViewModel
                    {
                        Id         = tech.Id.ToString(),
                        Name       = tech.Name,
                        IsRelevant = tech.IsRelevant
                    };

                    curr.TechnicalEnvironments.Add(technical);
                }
                ;

                result.ProfessionalExperiences.Add(curr);
            }

            foreach (var refer in source.ProfessionalReferences)
            {
                var current = new ProfessionalReferenceViewModel
                {
                    Id       = refer.Id.ToString(),
                    Name     = refer.Name,
                    Surname  = refer.Surname,
                    Function = refer.Function,
                    Mail     = refer.Contacts?.Mail,
                    Phone    = refer.Contacts?.Phone
                };

                result.ProfessionalReferences.Add(current);
            }

            return(result);
        }