コード例 #1
0
        public bool CreateSkillQuestionBank(SkillQuestionBankDAO s)
        {
            SkillQuestionBank skillQuestionBank = new SkillQuestionBank
            {
                SkillQuestionBank_ID = s.SkillQuestionBankID,
                Skill_ID = s.SkillID,
                QuestionBank_ID = s.QuestionBankID
            };

            using (AESDatabaseDataContext db = new AESDatabaseDataContext())
            {
                db.SkillQuestionBanks.InsertOnSubmit(skillQuestionBank);

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

            return true;
        }
コード例 #2
0
        public IList<SkillQuestionBankDAO> GetSkillQuestionBanks()
        {
            try
            {
                using (AESDatabaseDataContext db = new AESDatabaseDataContext())
                {
                    IList<SkillQuestionBank> skillQuestionBanks = db.SkillQuestionBanks.ToList();
                    List<SkillQuestionBankDAO> result = new List<SkillQuestionBankDAO>();

                    foreach (var skillQuestionBank in skillQuestionBanks)
                    {
                        SkillQuestionBankDAO temp = new SkillQuestionBankDAO
                        {
                            ID = skillQuestionBank.SkillQuestionBank_ID,
                            SkillQuestionBankID = skillQuestionBank.SkillQuestionBank_ID,
                            SkillID = skillQuestionBank.Skill_ID,
                            QuestionBankID = skillQuestionBank.QuestionBank_ID
                        };

                        result.Add(temp);
                    }

                    return (result != null ? result : null);
                }
            }
            catch (Exception e)
            {
                throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message));
            }
        }
コード例 #3
0
        public bool UpdateSkillQuestionBank(SkillQuestionBankDAO newSkillQuestionBank)
        {
            using (AESDatabaseDataContext db = new AESDatabaseDataContext())
            {
                SkillQuestionBank skillQuestionBank = db.SkillQuestionBanks.Single(s => s.SkillQuestionBank_ID == newSkillQuestionBank.SkillQuestionBankID);
                skillQuestionBank.Skill_ID = newSkillQuestionBank.SkillID;
                skillQuestionBank.QuestionBank_ID = newSkillQuestionBank.QuestionBankID;

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

            return true;
        }
コード例 #4
0
 public SkillQuestionBankDAO GetSkillQuestionBankByID(int id)
 {
     try
     {
         using (AESDatabaseDataContext db = new AESDatabaseDataContext())
         {
             SkillQuestionBank skillQuestionBank = (from sk in db.SkillQuestionBanks where sk.SkillQuestionBank_ID == id select sk).FirstOrDefault();
             SkillQuestionBankDAO result = new SkillQuestionBankDAO
             {
                 ID = skillQuestionBank.SkillQuestionBank_ID,
                 SkillQuestionBankID = skillQuestionBank.SkillQuestionBank_ID,
                 SkillID = skillQuestionBank.Skill_ID,
                 QuestionBankID = skillQuestionBank.QuestionBank_ID
             };
             return (result != null ? result : null);
         }
     }
     catch (Exception e)
     {
         throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message));
     }
 }