コード例 #1
0
        public static UserSkillModel ToModel(this UserSkill userSkill, IMediaService mediaService, MediaSettings mediaSettings, IWorkContext workContext, IStoreContext storeContext,
                                             ICustomerService customerService,
                                             ICustomerProfileViewService customerProfileViewService,
                                             ICustomerProfileService customerProfileService,
                                             IPictureService pictureService,
                                             UrlHelper url, IWebHelper webHelper, bool onlySkillData = false, bool firstMediaOnly = false, bool withNextAndPreviousMedia = false, bool withSocialInfo = false)
        {
            var entityMedias = mediaService.GetEntityMedia <UserSkill>(userSkill.Id, null, count: int.MaxValue).ToList();
            var customer     = onlySkillData ? null : customerService.GetCustomerById(userSkill.UserId);
            var model        = new UserSkillModel()
            {
                DisplayOrder = userSkill.Skill.DisplayOrder,
                SkillName    = userSkill.Skill.Name,
                UserSkillId  = userSkill.Id,
                Id           = userSkill.SkillId,
                User         = onlySkillData ? null : customer.ToPublicModel(workContext, customerProfileViewService, customerProfileService, pictureService, mediaSettings, url),
                Media        =
                    entityMedias.Take(firstMediaOnly ? 1 : 15)
                    .ToList()
                    .Select(
                        x =>
                        x.ToModel <UserSkill>(userSkill.Id, mediaService, mediaSettings, workContext, storeContext, customerService, customerProfileService, customerProfileViewService, pictureService, url, webHelper))
                    .ToList(),
                TotalMediaCount   = entityMedias.Count,
                TotalPictureCount = entityMedias.Count(x => x.MediaType == MediaType.Image),
                TotalVideoCount   = entityMedias.Count(x => x.MediaType == MediaType.Video),
                ExternalUrl       = userSkill.ExternalUrl,
                Description       = userSkill.Description,
                SeName            = userSkill.Skill.GetSeName(workContext.WorkingLanguage.Id, true, false)
            };

            return(model);
        }
コード例 #2
0
 public void AddUserSkill(Category skill, Server.Model.User.User user)
 {
     try
     {
         if (skill.Id == 0 && !string.IsNullOrEmpty(skill.Code))
         {
             if (Exists(skill, it => it.Code.Equals(skill.Code)))
             {
                 skill = Db.Set <Category>().Single(it => it.Code.Equals(skill.Code));
             }
             else
             {
                 Db.Set <Category>().Add(skill);
             }
         }
         var userSkill = new UserSkill
         {
             UserId  = user.Id,
             SkillId = skill.Id
         };
         Db.Set <UserSkill>().Add(userSkill);
         Db.SaveChanges();
     }
     catch (Exception ex)
     {
         LogEventManager.Logger.Error(ex.Message, ex);
         throw;
     }
 }
コード例 #3
0
        private void SliderUserSkill_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            //Code for the slider
            Slider s = (Slider)sender;
            string userSkill;

            switch (e.NewValue)
            {
            case double d when(e.NewValue >= 0 && e.NewValue <= 1): {
                s.Value   = 1.0;
                userSkill = "Beginner";
                s.ToolTip = userSkill;
                this.lblUserSkill.Content = $"How would you describe your knowledge of computers? {userSkill}";
                this.Skill = UserSkill.Beginner;
                break;
            }

            case double d when(e.NewValue > 1 && e.NewValue <= 2): {
                s.Value   = 2.0;
                userSkill = "Advanced";
                s.ToolTip = userSkill;
                this.lblUserSkill.Content = $"How would you describe your knowledge of computers? {userSkill}";
                this.Skill = UserSkill.Advanced;
                break;
            }
            }
        }
コード例 #4
0
        public static UserSkillModel ToModel(this UserSkill userSkill, IMediaService mediaService, MediaSettings mediaSettings, GeneralSettings generalSettings, bool onlySkillData = false, bool firstMediaOnly = false, bool withNextAndPreviousMedia = false, bool withSocialInfo = false)
        {
            var entityMedias = mediaService.GetEntityMedia <UserSkill>(userSkill.Id, null, count: int.MaxValue).ToList();
            var model        = new UserSkillModel()
            {
                DisplayOrder = userSkill.Skill.DisplayOrder,
                Name         = userSkill.Skill.Name,
                UserSkillId  = userSkill.Id,
                Id           = userSkill.SkillId,
                User         = onlySkillData ? null : userSkill.User.ToModel(mediaService, mediaSettings),
                Media        =
                    entityMedias.Take(firstMediaOnly ? 1 : 15)
                    .ToList()
                    .Select(
                        x =>
                        x.ToModel <UserSkill>(userSkill.Id, mediaService, mediaSettings, generalSettings,
                                              withNextAndPreviousMedia: withNextAndPreviousMedia, withSocialInfo: withSocialInfo, avoidMediaTypeForNextAndPreviousMedia: true))
                    .ToList(),
                TotalMediaCount   = entityMedias.Count,
                TotalPictureCount = entityMedias.Count(x => x.MediaType == MediaType.Image),
                TotalVideoCount   = entityMedias.Count(x => x.MediaType == MediaType.Video),
                ExternalUrl       = userSkill.ExternalUrl,
                Description       = userSkill.Description,
                SeName            = userSkill.Skill.GetPermalink().ToString()
            };

            return(model);
        }
コード例 #5
0
ファイル: UserSkillsController.cs プロジェクト: war-man/EC
        public ActionResult updateSkills(int userID, string SkillsTitle, string yearExp, string monthExp)
        {
            try
            {
                UserProjectdetailsEntity sessId = new UserProjectdetailsEntity();
                // int userID = sessId.User_ID;


                string yearMonth = yearExp + "." + monthExp;
                EvolutyzCornerDataEntities evolutyzData = new EvolutyzCornerDataEntities();

                UserSkill skills = evolutyzData.UserSkills.SingleOrDefault(u => u.Usr_UserId == userID);
                skills.SkillId    = Convert.ToInt32(SkillsTitle);
                skills.Experience = yearMonth;

                int response = evolutyzData.SaveChanges();

                if (response > 0)
                {
                    return(Json("Data Updated Successfully", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json("Updation Failed and Please Try Again!!", JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #6
0
        public void Seed()
        {
            var skill1 = new Skill {
                Id = 1, SkillName = "Java"
            };
            var skill2 = new Skill {
                Id = 2, SkillName = "C#"
            };

            this.skills = new List <Skill>()
            {
                skill1, skill2
            };


            var userSkill1 = new UserSkill {
                UserId = "1", Skill = skill1
            };
            var userSkill2 = new UserSkill {
                UserId = "1", Skill = skill2
            };

            this.userSkills = new List <UserSkill>()
            {
                userSkill1, userSkill2
            };
        }
コード例 #7
0
ファイル: UserSkillsController.cs プロジェクト: war-man/EC
        public ActionResult DeleteSkills(int id)
        {
            try
            {
                UserProjectdetailsEntity sessId = new UserProjectdetailsEntity();
                int userID = sessId.User_ID;


                EvolutyzCornerDataEntities evolutyzData = new EvolutyzCornerDataEntities();

                UserSkill skills = evolutyzData.UserSkills.SingleOrDefault(u => u.Usr_UserId == id);
                if (userID == id)
                {
                    evolutyzData.UserSkills.Remove(skills);

                    evolutyzData.SaveChanges();
                    return(Json("Removed Successfully", JsonRequestBehavior.AllowGet));
                }

                else
                {
                    return(Json("Deletion Failed and Please Try Again", JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #8
0
        public ActionResult AddSkill([FromBody] AddSkillViewModel skill)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    String id       = "";
                    String talentId = String.IsNullOrWhiteSpace(id) ? _userAppContext.CurrentUserId : id;
                    var    addSkill = new UserSkill
                    {
                        Id              = ObjectId.GenerateNewId().ToString(),
                        UserId          = _userAppContext.CurrentUserId,
                        Skill           = skill.Name,
                        ExperienceLevel = skill.Level,
                        IsDeleted       = false
                    };
                    var result = _userRepository.GetByIdAsync(talentId).Result;
                    result.Skills.Add(addSkill);
                    _userRepository.Update(result);
                    return(Json(new { Success = true }));
                }

                return(Json(new { Success = false }));
            }
            catch (Exception e)
            {
                return(Json(new { Success = false, e.Message }));
            }
        }
コード例 #9
0
        public IActionResult UpdateOrCreate([FromBody] UserSkillDto userSkill)
        {
            UserSkill skillEntity = this.mapper.Map <UserSkill>(userSkill);

            this.service.Update(skillEntity);
            return(this.Ok(skillEntity));
        }
コード例 #10
0
ファイル: PetSkillDatabase.cs プロジェクト: skstbdl/Tera
        public PetSkillDatabase(string folder, string language)
        {
            StreamReader reader;

            try
            {
                reader = new StreamReader(File.OpenRead(Path.Combine(folder, $"skills\\pets-skills-{language}.tsv")));
            }
            catch
            {
                return;
            }
            while (!reader.EndOfStream)
            {
                var line = reader.ReadLine();
                if (line == null)
                {
                    continue;
                }
                var values = line.Split('\t');

                var petName   = values[0];
                var skillId   = int.Parse(values[1]);
                var skillName = values[2];

                var skill = new UserSkill(skillId, PlayerClass.Common, petName, skillName, null);
                if (!_petSkilldata.ContainsKey(petName))
                {
                    _petSkilldata[petName] = new List <UserSkill>();
                }
                _petSkilldata[petName].Add(skill);
            }
        }
コード例 #11
0
        public AboutUserModel UserInfo(int userId)
        {
            User user = this.repository.FirstOrDefault <User>(x => x.Id == userId);

            if (user != null)
            {
                UserModel userModel = new UserModel();
                userModel.Id        = user.Id;
                userModel.Email     = user.UserEmail;
                userModel.Birthdate = user.UserBirthdate;
                userModel.RoleId    = user.RoleId;

                var userMaterial = this.repository.Where <CompletedUserMaterial>(x => x.Id == userId);

                var materials = this.repository.Join <CompletedUserMaterial, Material, int, Material>(userMaterial, x => true, cum => cum.MaterialId, m => m.Id, (cum, m) => m);

                var skills = this.repository.Join <Material, Skill, int, Skill>(materials, x => true, m => m.SkillId, s => s.Id, (m, s) => s).GroupBy(x => x.SkillName).Select(x => x.FirstOrDefault()).ToList();

                UserSkill userSkill = this.repository.FirstOrDefault <UserSkill>(x => x.Id == userId);

                return(new AboutUserModel {
                    UserModel = userModel, Skills = skills, TotalUserSkill = userSkill
                });
            }
            return(null);
        }
コード例 #12
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,UserId,SkillName,SkillDescritpion,SelfRating,Current")] UserSkill userSkill)
        {
            if (id != userSkill.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(userSkill);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserSkillExists(userSkill.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(userSkill));
        }
コード例 #13
0
ファイル: ProfileController.cs プロジェクト: war-man/EC
        public string updateSkills(string SkillsTitle, string yearExp, string monthExp, int userskillid)
        {
            try
            {
                UserProjectdetailsEntity sessId = new UserProjectdetailsEntity();
                int    userID    = sessId.User_ID;
                int    skillid   = Convert.ToInt32(SkillsTitle);
                string yearMonth = yearExp + "." + monthExp;
                EvolutyzCornerDataEntities evolutyzData = new EvolutyzCornerDataEntities();
                UserSkill skillcheck = evolutyzData.Set <UserSkill>().Where(s => (s.SkillId == skillid && s.Usr_UserId == userID && s.Is_Deleted == false && s.Usr_SkillId != userskillid)).FirstOrDefault <UserSkill>();
                if (skillcheck != null)
                {
                    return("Skill Already Exist");
                }
                UserSkill skills = evolutyzData.UserSkills.SingleOrDefault(u => u.Usr_SkillId == userskillid);
                skills.SkillId    = Convert.ToInt32(SkillsTitle);
                skills.Experience = yearMonth;


                int response = evolutyzData.SaveChanges();

                if (response > 0)
                {
                    return("Data Updated Successfully");
                }
                else
                {
                    return("Try Again!!");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #14
0
        private void Seed()
        {
            var projectSkill1 = new ProjectSkill {
                ProjectId = 1, SkillId = 1
            };
            var projectSkill2 = new ProjectSkill {
                ProjectId = 2, SkillId = 2
            };

            this._projectSkillRepository.Insert(projectSkill1);
            this._projectSkillRepository.Insert(projectSkill2);


            var userSkill1 = new UserSkill {
                UserId = "1", SkillId = 1
            };
            var userSkill2 = new UserSkill {
                UserId = "2", SkillId = 2
            };

            this._userSkillRepository.Insert(userSkill1);
            this._userSkillRepository.Insert(userSkill2);


            this._skillRepository.Insert(new Skill {
                Id = 1, SkillName = "Java", Users = new List <UserSkill> {
                    userSkill1
                }
            });
            this._skillRepository.Insert(new Skill {
                Id = 2, SkillName = "C++", Projects = new List <ProjectSkill> {
                    projectSkill1
                }
            });
        }
コード例 #15
0
        public ActionResult HandleRating(int eventId, int userId, int skillId, IEnumerable <RatingToSendVM> ratings)
        {
            var userToRate = Context.Users.FirstOrDefault(x => x.Id == userId);
            var user       = UserHelper.GetCurrentDbUser(Context);
            var userSkill  = userToRate.UserSkills.Where(s => s.Skill.Id == skillId).FirstOrDefault();

            //Adding the rating to the database.
            if (userSkill == null)
            {
                userSkill = new UserSkill
                {
                    Skill = Context.Skills.FirstOrDefault(x => x.Id == skillId)
                };
                userToRate.UserSkills.Add(userSkill);
            }

            foreach (var rating in ratings)
            {
                userSkill.Ratings.Add(new Rating
                {
                    Mark    = rating.Rating,
                    RatedAt = DateTime.Now,
                    RatedBy = user,
                    Comment = rating.Comment,
                });
            }
            Context.SaveChanges();
            return(View("RateTeamMembers", new { state = "success" }));
        }
コード例 #16
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,SkillId,ApplicationUserId")] UserSkill userSkill)
        {
            if (id != userSkill.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(userSkill);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserSkillExists(userSkill.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            var skillsList = _context.Skills
                             .Where(e => string.IsNullOrEmpty(e.ApplicationUserId));

            ViewData["SkillId"] = new SelectList(skillsList, "Id", "Name", userSkill.SkillId);
            return(View(userSkill));
        }
コード例 #17
0
        public async Task <IActionResult> PutUserSkill(int id, UserSkill userSkill)
        {
            if (id != userSkill.UserId)
            {
                return(BadRequest());
            }

            _context.Entry(userSkill).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserSkillExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #18
0
        public async Task <bool> AddSkill(SkillToAddDto skillToAdd)
        {
            var skill = await _context.Skills.FirstOrDefaultAsync(s => s.SkillName == skillToAdd.SkillName);

            if (skill == null)
            {
                var newSkill = new Skill();
                newSkill.SkillName = skillToAdd.SkillName;
                this.Add <Skill>(newSkill);
                await SaveAll();

                skill = await _context.Skills.FirstOrDefaultAsync(s => s.SkillName == skillToAdd.SkillName);
            }

            var userSkill = await _context.UserSkills.FirstOrDefaultAsync(us => us.UserId == skillToAdd.UserId && us.SkillId == skill.SkillId);

            if (userSkill != null)
            {
                return(false);
            }
            var newUserSkill = new UserSkill();

            newUserSkill.SkillId = skill.SkillId;
            newUserSkill.UserId  = skillToAdd.UserId;
            newUserSkill.Score   = skillToAdd.SkillScore;

            this.Add <UserSkill>(newUserSkill);

            return(await this.SaveAll());
        }
コード例 #19
0
        public bool PostUserSkills(string UserId, int[] skills)
        {
            try
            {
                if (skills != null)
                {
                    List <UserSkill> newSkills = new List <UserSkill>();
                    foreach (int x in skills)
                    {
                        var cur = new UserSkill();
                        cur.UserId  = UserId;
                        cur.SkillId = x;
                        newSkills.Add(cur);
                    }
                    foreach (UserSkill temp in newSkills)
                    {
                        if (this._userSkillRepository.Insert(temp) == null)
                        {
                            return(false);
                        }
                    }
                    if (this._userSkillRepository.Save() == 0)
                    {
                        return(false);
                    }
                }


                return(true);
            }
            catch (Exception e)
            {
                throw new Exception("Failed to create a new project: " + e.Message);
            }
        }
コード例 #20
0
        public async Task <bool> AddNewSkill(AddSkillViewModel skill)
        {
            try
            {
                var  userId      = _userAppContext.CurrentUserId;
                User userProfile = await _userRepository.GetByIdAsync(userId);

                if (userProfile == null)
                {
                    return(false);
                }

                var newSkill = new UserSkill
                {
                    Id        = ObjectId.GenerateNewId().ToString(),
                    IsDeleted = false,
                    UserId    = userId
                };
                UpdateSkillFromView(skill, newSkill);
                userProfile.Skills.Add(newSkill);
                await _userRepository.Update(userProfile);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
コード例 #21
0
        public UserSkill AddUserSkill(UserSkill userSkill)
        {
            var userSkillId = _repo.Add(this.ConvertUserSkillToListItem(userSkill), ListNames.USER_SKILLS_LIST).Id;

            userSkill.Id = userSkillId;
            return(userSkill);
        }
コード例 #22
0
 private void InitializeUserSkillRepositoryData()
 {
     UserSkill = new UserSkill
     {
         Id      = 1,
         UserId  = 1,
         SkillId = 1
     };
     UserSkills = new UserSkill[]
     {
         UserSkill,
         new UserSkill
         {
             Id      = 2,
             UserId  = 1,
             SkillId = 2
         },
         new UserSkill
         {
             Id      = 3,
             UserId  = 2,
             SkillId = 2
         }
     };
 }
コード例 #23
0
        public IActionResult EditKeahlian(CreateSkill model)
        {
            var getSkill = _context.skillcategorymapping.Where(m => m.IdMember == model.IdMember).ToList();

            foreach (var item in getSkill)
            {
                var deleteSkill = _context.skillcategorymapping.FirstOrDefault(m => m.Id == item.Id);
                _context.skillcategorymapping.Remove(deleteSkill);
                _context.SaveChanges();
            }

            var Parent = new UserSkill {
                IdCategory = model.ParentSkill, IdMember = model.IdMember, Status = "Parent"
            };

            _context.skillcategorymapping.Add(Parent);
            _context.SaveChanges();

            foreach (var item in model.ChildSkill)
            {
                var Child = new UserSkill {
                    IdCategory = item, IdMember = model.IdMember, Status = "Child"
                };
                _context.skillcategorymapping.Add(Child);
                _context.SaveChanges();
            }

            return(RedirectToAction("Keahlian", "Profile", new { Id = model.IdMember }));
        }
コード例 #24
0
        private ListItem ConvertUserSkillToListItemUpdate(int id, UserSkill userSkill)
        {
            var      list    = _repo.GetClientContext().Web.Lists.GetByTitle(ListNames.USER_SKILLS_LIST);
            ListItem newItem = list.GetItemById(id);

            var lookupValuesActionPoints = new List <FieldLookupValue>();

            foreach (UserActionPoint element in userSkill.ActionPoints)
            {
                lookupValuesActionPoints.Add(new FieldLookupValue {
                    LookupId = element.Id
                });
            }

            var lookupValuesSubSkills = new List <FieldLookupValue>();

            foreach (UserSkill element in userSkill.SubSkills)
            {
                lookupValuesSubSkills.Add(new FieldLookupValue {
                    LookupId = element.Id
                });
            }

            newItem[SiteColumnNames.TITLE]            = userSkill.Title;
            newItem[SiteColumnNames.DESCRIPTION]      = userSkill.Description;
            newItem[SiteColumnNames.USERSUBSKILLS]    = lookupValuesSubSkills;
            newItem[SiteColumnNames.USERACTIONPOINTS] = lookupValuesActionPoints;
            newItem[SiteColumnNames.LEVEL]            = userSkill.Level;
            newItem[SiteColumnNames.STATUS]           = userSkill.Status.Value;
            newItem.Update();

            return(newItem);
        }
コード例 #25
0
        public ActionResult SubmitRating(RateVM vm)
        {
            //Gets the user and skill that needs to be rated.
            var userToRate  = Context.Users.GetById(vm.UserToRateId);
            var skillToRate = Context.Skills.FirstOrDefault(x => x.Id == vm.SkillToRateId);
            var userSkill   = userToRate.UserSkills.Where(s => s.Skill.Id == skillToRate.Id).FirstOrDefault();

            //Adding the rating to the database.
            if (userSkill == null)
            {
                userSkill = new UserSkill
                {
                    Skill = skillToRate
                };

                userToRate.UserSkills.Add(userSkill);
            }

            userSkill.Ratings.Add(new Rating
            {
                Mark    = vm.Rating,
                RatedAt = DateTime.Now,
                RatedBy = UserHelper.GetCurrentDbUser(Context),
                Comment = vm.RateComment
            });

            Context.SaveChanges();
            return(RedirectToAction("Index", "Group"));
        }
コード例 #26
0
        public ActionResult DeleteConfirmed(int id)
        {
            UserSkill userSkill = db.UserSkills.Find(id);

            db.UserSkills.Remove(userSkill);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #27
0
        public async Task <int> Handle(UserSkillCommand request, CancellationToken cancellationToken)
        {
            var userSkill = new UserSkill(request.IdUser, request.IdSkill);

            await _userSkillRepository.AddAsync(userSkill);

            return(userSkill.Id);
        }
コード例 #28
0
        public void UserSkill_ParentId_Is_Null_By_Default()
        {
            //Arrange
            UserSkill userSkill = new UserSkill();

            //Assert
            Assert.IsTrue(userSkill.ParentId == null);
        }
コード例 #29
0
        private static SkillDto ConvertSkill(UserSkill userSkill)
        {
            var skill  = userSkill.Skill;
            var config = new MapperConfiguration(cfg => cfg.CreateMap <Skill, SkillDto>());
            var mapper = new Mapper(config);

            return(mapper.Map <Skill, SkillDto>(skill));
        }
コード例 #30
0
 public void Setup(UserSkill addSkill)
 {
     userSkill  = addSkill;
     title.text = Skill.Title;
     img.gameObject.SetActive(true);
     img.sprite = Skill.Icon;
     CoolDownHandler();
 }
コード例 #31
0
        public static string AddUserSkill(string[] Skills, string[] LanuagesKnown)
        {
            UserProfileInfo userProfileInfo = new UserProfileInfo();
            string          message         = Constant.CONST_SKILL_INFORMATION_FAILURE;

            if (SessionWrapper.LoggedUser == null)
            {
                return(message = Constant.SESSION_EXPIRE);
            }
            int count = 0;

            try
            {
                UserSkill userSkill = new UserSkill();
                userSkill.UserId = SessionWrapper.LoggedUser.UserId;

                userSkill.UserAdditionalSkills = new List <UserAdditionalSkill>();
                UserAdditionalSkill userAdditional;
                while (count < Skills.Length)
                {
                    if (!String.IsNullOrEmpty(Skills[count]))
                    {
                        userAdditional       = new UserAdditionalSkill();
                        userAdditional.Skill = Skills[count].Trim();
                        userSkill.UserAdditionalSkills.Add(userAdditional);
                    }
                    count++;
                }


                userSkill.UserLanuagesKnowns = new List <UserLanuagesKnown>();
                UserLanuagesKnown userLanguages;
                count = 0;
                while (count < LanuagesKnown.Length)
                {
                    if (!String.IsNullOrEmpty(LanuagesKnown[count]))
                    {
                        userLanguages         = new UserLanuagesKnown();
                        userLanguages.Lanuage = LanuagesKnown[count].Trim();
                        userSkill.UserLanuagesKnowns.Add(userLanguages);
                    }
                    count++;
                }
                userProfileInfo = UserSkillHelper.SaveUserSkill(userSkill);
            }
            catch { }

            if (userProfileInfo.IsFirstRecord)
            {
                message = Constant.CONST_SKILL_ADD_SUCCESS;
            }
            else
            {
                message = Constant.CONST_SKILL_SUCCESS;
            }

            return(message);
        }
コード例 #32
0
 private static void CreateUserSkill(UserSkill userSkill, string color, Technology technology)
 {
     userSkill.Color = color;
     userSkill.Name = technology.Name;
     userSkill.Percentage = technology.Percentage;
     userSkill.Extension = technology.Extension;
     userSkill.Categories = technology.Categories;
     userSkill.Width = (int)( technology.Percentage * 3 );
 }
コード例 #33
0
ファイル: Spell.cs プロジェクト: xclouder/godbattle
	void OnEnable()
	{
		enterTime = Time.time;

		var userSkillName = blackboard.GetStringVar("SkillName").Value;
		userSkill = UserSkillMgr.Instance.GetSkill(userSkillName);
		var skillInfo = userSkill.Skill;
		CharAnimCtrl.Play(skillInfo.AnimationClipName, userSkill.Duration, ()=>{
			SendEvent("Finish");
		});
	}
コード例 #34
0
        public void UserSkill_ParentId_May_Be_Null()
        {
            //Arrange
            UserSkill userSkill = new UserSkill();

            //Act
            userSkill.ParentId = null;

            //Assert
            Assert.IsNull(userSkill.ParentId);
        }
コード例 #35
0
        public void UserSkill_Has_A_Parent_Id()
        {
            //Arrange
            UserSkill userSkill = new UserSkill();

            //Act
            Guid parentId = Guid.NewGuid();
            userSkill.ParentId = parentId;

            //Assert
            Assert.AreEqual(parentId, userSkill.ParentId);
        }
コード例 #36
0
        public void UserSkill_ParentId_May_Be_Changed()
        {
            UserSkill userSkill = new UserSkill();

            Guid parentId = Guid.NewGuid();
            userSkill.ParentId = parentId;
            Assert.AreEqual(parentId, userSkill.ParentId);

            Guid parentId2 = Guid.NewGuid();
            userSkill.ParentId = parentId2;
            Assert.AreEqual(parentId2, userSkill.ParentId);
        }
コード例 #37
0
        public void UserSkill_Has_A_List_Of_Child_User_Skills()
        {
            //Arrange
            UserSkill userSkill = new UserSkill();
            userSkill.Children.Add(new UserSkill() { SkillId = 5});
            userSkill.Children.Add(new UserSkill() { SkillId = 6 });
            userSkill.Children.Add(new UserSkill() { SkillId = 7 });
            userSkill.Children.Add(new UserSkill() { SkillId = 8 });
            userSkill.Children.Add(new UserSkill() { SkillId = 9 });

            //Act

            //Assert
            for (int i = 5; i < 10; i++) {
                Assert.That(userSkill.Children.Any(x => x.SkillId == i));
            }
        }
コード例 #38
0
        public ActionResult DoAction(SkillProfile skillProfile, string selectedAction, Guid[] selectedItems, string rootId)
        {
            switch (selectedAction.ToUpper()) {

                case "MOVE":
                    #region Get List of skills to display from the root

                    UserSkill rootSkillToDisplay = null;

                    Guid displayRootId;
                    if (!string.IsNullOrEmpty(rootId) && Guid.TryParse(rootId, out displayRootId)) {
                        rootSkillToDisplay = skillProfile.FirstOrDefault(s => s.Id == displayRootId);
                        rootSkillToDisplay.Children.AddRange(skillProfile.FindAll(s => s.ParentId == displayRootId));
                    }
                    else {
                        rootSkillToDisplay = new UserSkill();
                        var childSkills = skillProfile.FindAll(s => s.ParentId == null || s.ParentId == Guid.Empty);
                        rootSkillToDisplay.Children.AddRange(childSkills);
                    }

                    #endregion
                    #region Construct ViewModel with list of skills to display and selected skills to move

                    _moveSkillViewModel = new MoveSkillViewModel {Root = rootSkillToDisplay, SelectedItems = selectedItems};

                    #endregion
                    return RedirectToAction("Move");
                case "DELETE":

                    // return delete view to confirm deletion

                    //foreach (Guid guid in selectedItems)
                    //{
                    //    skillProfile.RemoveAll(s => s.Id.Equals(guid));
                    //}

                    break;
            }

            return View("YourProfile", new SkillProfileViewModelBase { SkillProfile = skillProfile });
        }
コード例 #39
0
 public UserSkillViewModelItem(UserSkill userSkill, SkillProfile skillProfile)
 {
     UserSkill = userSkill;
     SkillProfile = skillProfile;
 }
コード例 #40
0
 public void User_SkillId_May_Not_Be_Changed()
 {
     UserSkill userSkill = new UserSkill();
     Type t = userSkill.GetType();
     PropertyInfo pi = t.GetProperty("Id");
     Assert.IsNull(pi.GetSetMethod());
 }
コード例 #41
0
        public void User_Skill_Cannot_Be_A_Child_Of_Itself()
        {
            //Arrange
            UserSkill userSkill = new UserSkill();

            //Act

            //Assert
            Assert.Throws<InvalidOperationException>(() => userSkill.ParentId = userSkill.Id);
        }
コード例 #42
0
 private UserSkill GetUserSkillFrom(int index)
 {
     string color = string.Empty;
     var technology = UserData.ByTechnologies[index];
     color = GetColor(index, color);
     var userSkill = new UserSkill();
     CreateUserSkill(userSkill, color, technology);
     return userSkill;
 }
コード例 #43
0
 public void New_User_Skill_Gets_Auto_Generated_Id()
 {
     UserSkill userSkill = new UserSkill();
     Assert.AreNotEqual(Guid.Empty, userSkill.Id);
 }
コード例 #44
0
        private void LoadUserSkills()
        {
            var skills = new List<UserSkill>();
            var otherSkills = new UserSkill();
            otherSkills.Name = "Other";
            for ( int index = 0; index < UserData.ByTechnologies.Count; index++ )
            {
                if ( UserData.ByTechnologies[index].Name == "Other" )
                    otherSkills.Percentage += UserData.ByTechnologies[index].Percentage;
                else
                    skills.Add(GetUserSkillFrom(index));

            }
            skills.Add(otherSkills);
            skills = skills.OrderByDescending(s => s.Percentage).Where(s => s.Percentage > 0).Take(5).ToList();
            UserSkills = skills;
        }