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 }));
        }
示例#2
0
        public async Task BuySkill([Remainder] string Input = null)
        {
            if (Input == null)
            {
                await Context.Channel.SendMessageAsync("Gotta tell me what kind of skill you want to buy first. !nep Buy Skill (Skill name)");

                return;
            }
            ulong       su = Context.User.Id;
            PlayerData  pd = PlayerD(su);
            UserData    ud = FindPerson(su);
            CreateSkill cs = pd.FindSkillByName(Input);

            if (ud.Pudding < (ulong)cs.PuddingCost)
            {
                await Context.Channel.SendMessageAsync("Ehh you don't have enough pudding to buy this skill! Earn more and come back later!");

                return;
            }
            //ud.Pudding -= (ulong)cs.PuddingCost;
            if (cs.BuySkill(ud.Pudding, pd.CurrentJob.JobLevel) == 1)
            {
                await Context.Channel.SendMessageAsync($"Your job level needs to be at {cs.requiredJobLevel} to buy this skill!");

                return;
            }
            await Context.Channel.SendMessageAsync(string.Concat("Congratulations! You are the proud owner of the skill: ", cs.SkillName, ". Just to remind you what this skill does: ", cs.SkillDescription));
        }
示例#3
0
        public void should_throw_error_if_skill_source_not_found()
        {
            var cmd = new CreateSkill {
                ownerId = 100, skillSourceId = 55
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message
                        .EqualTo("StaticSkill Source with Id 55 could not be found"));
        }
        public OperationResult Create(CreateSkill command)
        {
            var operation = new OperationResult();

            var skill = new Skills(command.SkillName, command.SkillPercent, command.Description, command.ShowOrder);

            _skillRepository.Create(skill);
            _skillRepository.SaveChanges();

            return(operation.Succedded());
        }
示例#5
0
        public static Skill Create(Player player, SkillSource skillSource, CreateSkill cmd)
        {
            var newSkill = new Skill
            {
                Owner       = player,
                SkillSource = skillSource,
                IsArchived  = false,
            };

            return(newSkill);
        }
示例#6
0
        public int createskill(string skillname, string skillDesc, int catid, int createdBy)
        {
            CreateSkill cs = new CreateSkill()
            {
                SkillName        = skillname,
                SkillDescription = skillDesc,
                CategoryId       = catid,
                CreatedBy        = createdBy
            };

            return(new ProjectManagerCSD().createskill(cs));
        }
示例#7
0
        public void should_throw_error_if_player_not_found()
        {
            new SkillSourceBuilder()
            .With(ss => ss.Id, 55)
            .BuildAndSave();

            var cmd = new CreateSkill {
                ownerId = 100, skillSourceId = 55
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("Player with Id 100 could not be found"));
        }
示例#8
0
        /// <summary>
        /// Inserts new Skill Name and its description in Skill Table.
        /// </summary>
        /// <param name="cs"></param>
        /// <returns></returns>
        public int createskill(CreateSkill cs)
        {
            SqlParameter[] param = new SqlParameter[4];
            param[0]       = new SqlParameter("@skillName", SqlDbType.VarChar);
            param[0].Value = cs.SkillName;
            param[1]       = new SqlParameter("@skillDesc", SqlDbType.VarChar);
            param[1].Value = cs.SkillDescription;
            param[2]       = new SqlParameter("@categoryId", SqlDbType.Int);
            param[2].Value = cs.CategoryId;
            param[3]       = new SqlParameter("@createdBy", SqlDbType.Int);
            param[3].Value = cs.CreatedBy;
            int i = Convert.ToInt32(SqlHelper.ExecuteNonQuery("Data Source=.;Initial Catalog=HRS;Integrated Security=True", CommandType.StoredProcedure, "[dbo].[spCreateSkill]", param));

            return(i);
        }
示例#9
0
        public void can_create_skill()
        {
            new PlayerBuilder()
            .With(p => p.Id, 100)
            .BuildAndSave();

            new SkillSourceBuilder()
            .With(ss => ss.Id, 55)
            .BuildAndSave();

            var cmd = new CreateSkill {
                ownerId = 100, skillSourceId = 55
            };

            Assert.That(() => DomainRegistry.Repository.Execute(cmd), Throws.Nothing);

            Assert.That(DataContext.AsQueryable <Skill>().Where(p =>
                                                                p.Owner.Id == 100 &&
                                                                p.SkillSource.Id == 55), Has.Exactly(1).Items);
        }
        public async Task <IActionResult> TambahKeahlian(CreateSkill model)
        {
            ViewBag.navigation = "Keahlian";
            var Parent = new UserSkill {
                IdCategory = model.ParentSkill, IdMember = model.IdMember, Status = "Parent"
            };

            _context.skillcategorymapping.Add(Parent);
            await _context.SaveChangesAsync();

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



            return(RedirectToAction("Keahlian", "Profile", new { Id = model.IdMember }));
        }
 public int createskill(CreateSkill cs)
 {
     return(new CreateSkilldao().createskill(cs));
 }
示例#12
0
 public int createskill(CreateSkill cs)
 {
     return(new CreateSkillBusinessComponent().createskill(cs));
 }
        public JsonResult OnPostCreate(CreateSkill command)
        {
            var result = _skillApplication.Create(command);

            return(new JsonResult(result));
        }
        public IActionResult OnGetCreate()
        {
            var command = new CreateSkill();

            return(Partial("./Create", command));
        }
示例#15
0
        private void btAdminSkill_Click(object sender, RoutedEventArgs e)
        {
            CreateSkill cs = new CreateSkill();

            cs.ShowDialog();
        }