예제 #1
0
 public void Test_UpdateSKill()
 {
     SkillDAO skill4 = new SkillDAO() { ID = 3, SkillID = 3, SkillName = "testskillname" };
     skillService.UpdateSkill(skill4);
     Assert.AreEqual(skillService.GetSkillByID(3).SkillName, "testskillname");
     Assert.AreEqual(skillService.GetSkills().Count, 3);
 }
예제 #2
0
 public void Test_CreateSkill()
 {
     SkillDAO skill4 = new SkillDAO() { ID = 4, SkillID = 4, SkillName = "skillname4" };
     skillService.CreateSkill(skill4);
     Assert.IsNotNull(skillService.GetSkillByID(3));
     Assert.AreEqual(skillService.GetSkills().Count, 4);
 }
예제 #3
0
        internal void SetUp()
        {
            SkillDAO skill1 = new SkillDAO() { ID = 1, SkillID = 1, SkillName = "skillname1" };
            SkillDAO skill2 = new SkillDAO() { ID = 2, SkillID = 2, SkillName = "skillname2" };
            SkillDAO skill3 = new SkillDAO() { ID = 3, SkillID = 3, SkillName = "skillname3" };

            Skills.Add(skill1);
            Skills.Add(skill2);
            Skills.Add(skill3);
        }
예제 #4
0
 public bool UpdateSkill(SkillDAO newEmp)
 {
     foreach(var skill in Skills)
         if(skill.SkillID == newEmp.SkillID)
         {
             Skills.Remove(skill);
             Skills.Add(newEmp);
             return true;
         }
     return false;
 }
        public bool CreateSkill(SkillDAO s)
        {
            Skill skill = new Skill
            {
                Skill_ID = s.SkillID,
                SkillName = s.SkillName
            };

            using (AESDatabaseDataContext db = new AESDatabaseDataContext())
            {
                db.Skills.InsertOnSubmit(skill);

                try
                {
                    db.SubmitChanges();
                }
                catch (Exception e)
                {
                    throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message));
                }
            }

            return true;
        }
        public bool UpdateSkill(SkillDAO newSkill)
        {
            using (AESDatabaseDataContext db = new AESDatabaseDataContext())
            {
                Skill skill = db.Skills.Single(s => s.Skill_ID == newSkill.SkillID);
                skill.SkillName = newSkill.SkillName;

                try
                {
                    db.SubmitChanges();
                }
                catch (Exception e)
                {
                    throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message));
                }
            }

            return true;
        }
        public IList<SkillDAO> GetSkills()
        {
            try
            {
                using (AESDatabaseDataContext db = new AESDatabaseDataContext())
                {
                    IList<Skill> skills = (from sk in db.Skills select sk).OrderBy(o => o.Skill_ID).ToList();
                    List<SkillDAO> result = new List<SkillDAO>();

                    foreach (var skill in skills)
                    {
                        SkillDAO temp = new SkillDAO
                        {
                            ID = skill.Skill_ID,
                            SkillID = skill.Skill_ID,
                            SkillName = skill.SkillName
                        };

                        result.Add(temp);
                    }

                    return (result != null ? result : null);
                }
            }
            catch (Exception e)
            {
                throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message));
            }
        }
 public SkillDAO GetSkillByID(int id)
 {
     try
     {
         using (AESDatabaseDataContext db = new AESDatabaseDataContext())
         {
             Skill skill = (from sk in db.Skills where sk.Skill_ID == id select sk).FirstOrDefault();
             SkillDAO result = new SkillDAO
             {
                 ID = skill.Skill_ID,
                 SkillID = skill.Skill_ID,
                 SkillName = skill.SkillName
             };
             return (result != null ? result : null);
         }
     }
     catch (Exception e)
     {
         throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message));
     }
 }
예제 #9
0
 private void Initialize( SkillDAO skill, int id, int skillID, string skillName )
 {
     skill.ID = id;
     skill.SkillID = skillID;
     skill.SkillName = skillName;
 }
예제 #10
0
 public bool CreateSkill(SkillDAO e)
 {
     Skills.Add(e);
     return true;
 }