Пример #1
0
        public ProfileReviewViewModel ToProfileReviewViewModel(
            TraineeProfile profile,
            double traineeRating,
            bool isTraineeHavingMentorReview,
            bool isTraineeHavingScrumReview,
            bool isTraineeHavingTeamReview)
        {
            var profileReviewViewModel = new ProfileReviewViewModel
            {
                TraineeId                   = profile.Id,
                TraineeFullName             = profile.Trainee.User.FullName,
                ProjectId                   = profile.Trainee.Group.Project.Id,
                ProjectName                 = profile.Trainee.Group.Project.Name,
                SpecializationId            = profile.Trainee.Specialization.Id,
                SpecializationName          = profile.Trainee.Specialization.Name,
                GpoupId                     = profile.Trainee.Group.Id,
                GroupNumber                 = profile.Trainee.Group.Number,
                Rating                      = traineeRating,
                HasReviews                  = profile.Trainee.ReviewsOnMe.Any(),
                IsTraineeHavingMentorReview = isTraineeHavingMentorReview,
                IsTraineeHavingScrumReview  = isTraineeHavingScrumReview,
                IsTraineeHavingTeamReview   = isTraineeHavingTeamReview
            };

            return(profileReviewViewModel);
        }
        public ActionResult Create(TraineeProfile traineeProfile)
        {
            if (!ModelState.IsValid)
            {
                return(View("~/Views/CheckTraineeProfileConditions/CreateNullTraineeProfile.cshtml"));
            }

            //Check if Trainee Profile existed or not
            if (_context.TraineeToCourses.Any(c => c.TraineeId == traineeProfile.TraineeId))
            {
                return(View("~/Views/CheckTraineeProfileConditions/CreateExistTraineeProfile.cshtml"));
            }

            var getTraineeProfile = new TraineeProfile
            {
                TraineeId            = traineeProfile.TraineeId,
                Full_Name            = traineeProfile.Full_Name,
                Education            = traineeProfile.Education,
                Programming_Language = traineeProfile.Programming_Language,
                Experience_Details   = traineeProfile.Experience_Details,
                Location             = traineeProfile.Location
            };

            _context.TraineeProfiles.Add(getTraineeProfile);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
        /// <summary>
        /// Attaches the given entity to the context underlying the set
        /// and updates changed fields in appropriate database entity
        /// that searches by the primary key value.
        /// </summary>
        /// <param name="profileToUpdate">Entity to update main information. Id must be declared.</param>
        /// <returns>Updated entity if exists or null.</returns>
        public TraineeProfile UpdateMainInfo(TraineeProfile profileToUpdate)
        {
            if (profileToUpdate == null)
            {
                return(null);
            }

            var profile = _context.TraineeProfiles.Find(profileToUpdate.Id);

            // Expectations
            profile.DesirablePosition    = profileToUpdate.DesirablePosition;
            profile.ExperienceAtITLab    = profileToUpdate.ExperienceAtITLab;
            profile.ProfessionalPurposes = profileToUpdate.ProfessionalPurposes;

            // Experience
            profile.CurrentPosition    = profileToUpdate.CurrentPosition;
            profile.CurrentWork        = profileToUpdate.CurrentWork;
            profile.EmploymentDuration = profileToUpdate.EmploymentDuration;
            profile.JobDuties          = profileToUpdate.JobDuties;

            // Contacts
            var newContacts     = profileToUpdate.Trainee.User.Contacts;
            var updatedContacts = profile.Trainee.User.Contacts;

            updatedContacts.Email    = newContacts.Email;
            updatedContacts.Phone    = newContacts.Phone;
            updatedContacts.Skype    = newContacts.Skype;
            updatedContacts.LinkedIn = newContacts.LinkedIn;

            _context.SaveChanges();

            return(profile);
        }
Пример #4
0
        public ProfileViewModel ToProfileViewModel(TraineeProfile profile, double traineeRating)
        {
            var profileViewModel = new ProfileViewModel
            {
                Id                 = profile.Id,
                TraineeId          = profile.Trainee.Id,
                TraineeFullName    = profile.Trainee.User.FullName,
                ProjectId          = profile.Trainee.Group.Project.Id,
                ProjectName        = profile.Trainee.Group.Project.Name,
                SpecializationId   = profile.Trainee.Specialization.Id,
                SpecializationName = profile.Trainee.Specialization.Name,
                GpoupId            = profile.Trainee.Group.Id,
                GroupNumber        = profile.Trainee.Group.Number,
                Rating             = traineeRating,
                HasReviews         = profile.Trainee.ReviewsOnMe.Any(),

                Contacts      = ToContactsViewModel(profile),
                Position      = ToPositionViewModel(profile),
                Job           = ToJobViewModel(profile),
                Qualification = ToQualificationViewModel(profile),

                Artefacts = ToArtefactsViewModel(profile)
            };

            return(profileViewModel);
        }
Пример #5
0
        public void addTraineeProfile(int TraineeID, LookUpEdit cmbOffers, DateEdit dtBegin, DateEdit dtEnd, TextEdit txtPrice, TextEdit txtPaid, TextEdit txtCarry, int sessionNum,
                                      int freezing, int invitations, int spa, int massage, int others, int inbody, RadioGroup RGpaymentMethod, string type, ref int LogID, SearchLookUpEdit cmbTrainers, SearchLookUpEdit cmbEmployee)
        {
            TraineeProfile tp = new TraineeProfile()
            {
                TraineeID     = TraineeID,
                OfferID       = Convert.ToInt32(cmbOffers.EditValue),
                From          = Convert.ToDateTime(dtBegin.EditValue),
                To            = Convert.ToDateTime(dtEnd.EditValue),
                Price         = Convert.ToDouble(txtPrice.Text),
                Paid          = Convert.ToDouble(txtPaid.Text),
                Carry         = Convert.ToDouble(txtCarry.Text),
                SessionsNum   = sessionNum,
                Freezing      = freezing,
                Invitations   = invitations,
                SPA           = spa,
                Massage       = massage,
                Others        = others,
                Inbody        = inbody,
                Active        = true,
                Frozen        = false,
                Canceled      = false,
                Transfered    = false,
                PaymentMethod = RGpaymentMethod.Text,
                Type          = type,
                TrainerID     = Convert.ToInt32(cmbTrainers.EditValue),
                EmployeeID    = Convert.ToInt32(cmbEmployee.EditValue),
            };

            db.TraineeProfiles.Add(tp);
            db.SaveChanges();
            LogID = tp.LogID;
        }
Пример #6
0
        public void UpdateSelectedMainSkills(int profileId, List <int> mainSkillsId)
        {
            TraineeProfile   profile             = _context.TraineeProfiles.Find(profileId);
            List <MainSkill> availableMainSkills = GetAvailableMainSkills(profileId);

            if (mainSkillsId == null || mainSkillsId.Count == 0)
            {
                profile.MainSkills.Clear();
            }
            else
            {
                var deletingSkills = profile.MainSkills.Where(skill => !mainSkillsId.Contains(skill.Id)).ToList();

                foreach (var skill in deletingSkills)
                {
                    profile.MainSkills.Remove(skill);
                }

                var addingSkills = availableMainSkills.Where(skill => mainSkillsId.Contains(skill.Id) && !profile.MainSkills.Any(s => s.Id == skill.Id));

                foreach (var skill in addingSkills)
                {
                    profile.MainSkills.Add(skill);
                }
            }

            _context.SaveChanges();
        }
Пример #7
0
        public ProfileMainInfoJson ToJsonProfileMainInfoModel(TraineeProfile profile)
        {
            var profileJson = _mapper.Map <TraineeProfile, ProfileMainInfoJson>(profile);

            _mapper.Map(profile.Trainee.User.Contacts, profileJson);

            return(profileJson);
        }
Пример #8
0
        public JsonResult EditMainInfo(ProfileMainInfoJson profileMainInfoJson)
        {
            profileMainInfoJson.TrimAndUppercaseFirst();

            TraineeProfile      editingProfileWithMainInfo = _profileMapper.FromProfileMainInfoJsonModel(profileMainInfoJson);
            TraineeProfile      editedProfile = _profileProvider.UpdateMainInfo(editingProfileWithMainInfo);
            ProfileMainInfoJson updatedProfileMainInfoJson = _profileMapper.ToJsonProfileMainInfoModel(editedProfile);

            return(Json(updatedProfileMainInfoJson, JsonRequestBehavior.AllowGet));
        }
Пример #9
0
        public ArtefactsViewModel ToArtefactsViewModel(TraineeProfile profile)
        {
            var filesViewModel = profile.Files.Select(ToFileViewModel).ToList();
            var linksViewModel = profile.Links.Select(ToLinkViewModel).ToList();

            var artefactsViewModel = new ArtefactsViewModel
            {
                Files = filesViewModel,
                Links = linksViewModel
            };

            return(artefactsViewModel);
        }
        /// <summary>
        /// Attaches the given entity to the context underlying the set
        /// and updates changed fields in appropriate database entity
        /// that searches by the primary key value.
        /// </summary>
        /// <param name="profileToUpdate">Entity to update qualification information. Id must be declared.</param>
        /// <returns>Updated entity if exists or null.</returns>
        public TraineeProfile UpdateQualification(TraineeProfile profileToUpdate)
        {
            if (profileToUpdate != null)
            {
                _context.TraineeProfiles.Attach(profileToUpdate);

                var entry = _context.Entry(profileToUpdate);
                entry.Property(p => p.Strengths).IsModified  = true;
                entry.Property(p => p.Weaknesses).IsModified = true;

                _context.SaveChanges();
            }

            return(profileToUpdate);
        }
        public ActionResult Create()
        {
            //Get Account Trainee
            var roleInDb = (from r in _context.Roles where r.Name.Contains("Trainee") select r)
                           .FirstOrDefault();

            var users = _context.Users.Where(x => x.Roles.Select(y => y.RoleId)
                                             .Contains(roleInDb.Id))
                        .ToList();

            var traineeProfiles = _context.TraineeProfiles.ToList();

            var traineeProfile = new TraineeProfile
            {
                Trainees = users,
            };

            return(View(traineeProfile));
        }
        public ActionResult Edit(TraineeProfile traineeProfile)
        {
            if (!ModelState.IsValid)
            {
                return(View("~/Views/CheckTraineeProfileConditions/EditNullTraineeProfile.cshtml"));
            }

            var traineeProfileInDb = _context.TraineeProfiles.SingleOrDefault(trdb => trdb.Id == traineeProfile.Id);

            if (traineeProfileInDb == null)
            {
                return(HttpNotFound());
            }

            traineeProfileInDb.TraineeId            = traineeProfile.TraineeId;
            traineeProfileInDb.Full_Name            = traineeProfile.Full_Name;
            traineeProfileInDb.Education            = traineeProfile.Education;
            traineeProfileInDb.Programming_Language = traineeProfile.Programming_Language;
            traineeProfileInDb.Experience_Details   = traineeProfile.Experience_Details;
            traineeProfileInDb.Location             = traineeProfile.Location;

            _context.SaveChanges();
            return(View("~/Views/CheckTraineeProfileConditions/EditTraineeProfileSuccess.cshtml"));
        }
Пример #13
0
        public QualificationViewModel ToQualificationViewModel(TraineeProfile profile)
        {
            var qualificationViewModel = _mapper.Map <TraineeProfile, QualificationViewModel>(profile);

            return(qualificationViewModel);
        }
Пример #14
0
        public JobViewModel ToJobViewModel(TraineeProfile profile)
        {
            var jobViewModel = _mapper.Map <TraineeProfile, JobViewModel>(profile);

            return(jobViewModel);
        }
Пример #15
0
        public PositionViewModel ToPositionViewModel(TraineeProfile profile)
        {
            var positionViewModel = _mapper.Map <TraineeProfile, PositionViewModel>(profile);

            return(positionViewModel);
        }
Пример #16
0
        public ContactsViewModel ToContactsViewModel(TraineeProfile profile)
        {
            var contactsViewModel = _mapper.Map <Contacts, ContactsViewModel>(profile.Trainee.User.Contacts);

            return(contactsViewModel);
        }
Пример #17
0
        public ProfileQualificationJson ToProfileQualificationJsonModel(TraineeProfile updatedProfile)
        {
            var profileJson = _mapper.Map <TraineeProfile, ProfileQualificationJson>(updatedProfile);

            return(profileJson);
        }