private void Initialize(JobOpeningInterviewQuestionDAO JOIQ, int id, int joiqID, int jobOpeningID, int saQuestionID )
 {
     JOIQ.ID = id;
     JOIQ.JobOpeningInterviewQuestionID = joiqID;
     JOIQ.JobOpeningID = jobOpeningID;
     JOIQ.SAQuestionID = saQuestionID;
 }
        public void Test_CreateJobOpeningInterviewQuestion()
        {
            JobOpeningInterviewQuestionDAO JOIQ3 = new JobOpeningInterviewQuestionDAO() { ID = 3, JobOpeningInterviewQuestionID = 3, JobOpeningID = 3, SAQuestionID = 3 };

            Assert.IsTrue(jobOpenQuestionService.CreateJobOpeningInterviewQuestion(JOIQ3));
            Assert.AreEqual(jobOpenQuestionService.GetJobOpeningInterviewQuestionByID(3).JobOpeningInterviewQuestionID, 3);
        }
        public void Test_UpdateJobOpeningInterviewQuestion()
        {
            JobOpeningInterviewQuestionDAO JOIQ3 = new JobOpeningInterviewQuestionDAO() { ID = 3, JobOpeningInterviewQuestionID = 2, JobOpeningID = 3, SAQuestionID = 3 };

            Assert.IsTrue(jobOpenQuestionService.UpdateJobOpeningInterviewQuestion(JOIQ3));
            Assert.AreEqual(jobOpenQuestionService.GetJobOpeningInterviewQuestions().Count, 3);
            //Assert.AreEqual(jobOpenQuestionService.GetJobOpeningInterviewQuestionByID(2).ID, 3);
        }
        internal void SetUp()
        {
            JobOpeningInterviewQuestionDAO JOIQ0 = new JobOpeningInterviewQuestionDAO() { ID = 0, JobOpeningInterviewQuestionID = 0, JobOpeningID = 0, SAQuestionID = 0 };
            JobOpeningInterviewQuestionDAO JOIQ1 = new JobOpeningInterviewQuestionDAO() { ID = 1, JobOpeningInterviewQuestionID = 1, JobOpeningID = 1, SAQuestionID = 1 };
            JobOpeningInterviewQuestionDAO JOIQ2 = new JobOpeningInterviewQuestionDAO() { ID = 2, JobOpeningInterviewQuestionID = 2, JobOpeningID = 2, SAQuestionID = 2 };

            JOIQs.Add(JOIQ0);
            JOIQs.Add(JOIQ1);
            JOIQs.Add(JOIQ2);
        }
 public bool UpdateJobOpeningInterviewQuestion(JobOpeningInterviewQuestionDAO newJobOpeningQuestionData)
 {
     foreach(var joiq in JOIQs)
         if(joiq.JobOpeningInterviewQuestionID == newJobOpeningQuestionData.JobOpeningInterviewQuestionID)
         {
             JOIQs.Remove(joiq);
             JOIQs.Add(newJobOpeningQuestionData);
             return true;
         }
     return false;
 }
 public bool CreateJobOpeningInterviewQuestion(JobOpeningInterviewQuestionDAO e)
 {
     JOIQs.Add(e);
     return true;
 }
        public bool CreateJobOpeningInterviewQuestion(JobOpeningInterviewQuestionDAO s)
        {
            JobOpeningInterviewQuestion jobOpeningInterviewQuestion = new JobOpeningInterviewQuestion
            {
                JobOpeningInterviewQuestion_ID = s.JobOpeningInterviewQuestionID,
                JobOpening_ID = s.JobOpeningID,
                SAQuestion_ID = s.SAQuestionID
            };

            using (AESDatabaseDataContext db = new AESDatabaseDataContext())
            {
                db.JobOpeningInterviewQuestions.InsertOnSubmit(jobOpeningInterviewQuestion);

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

            return true;
        }
        public bool UpdateJobOpeningInterviewQuestion(JobOpeningInterviewQuestionDAO newJobOpeningInterviewQuestion)
        {
            using (AESDatabaseDataContext db = new AESDatabaseDataContext())
            {
                JobOpeningInterviewQuestion jobOpeningInterviewQuestion = db.JobOpeningInterviewQuestions.Single(s => s.JobOpeningInterviewQuestion_ID == newJobOpeningInterviewQuestion.JobOpeningInterviewQuestionID);
                jobOpeningInterviewQuestion.JobOpening_ID = newJobOpeningInterviewQuestion.JobOpeningID;
                jobOpeningInterviewQuestion.SAQuestion_ID = newJobOpeningInterviewQuestion.SAQuestionID;

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

            return true;
        }
        public IList<JobOpeningInterviewQuestionDAO> GetJobOpeningInterviewQuestions()
        {
            try
            {
                using (AESDatabaseDataContext db = new AESDatabaseDataContext())
                {
                    IList<JobOpeningInterviewQuestion> jobOpeningInterviewQuestions = db.JobOpeningInterviewQuestions.ToList();
                    List<JobOpeningInterviewQuestionDAO> result = new List<JobOpeningInterviewQuestionDAO>();

                    foreach (var jobOpeningInterviewQuestion in jobOpeningInterviewQuestions)
                    {
                        JobOpeningInterviewQuestionDAO temp = new JobOpeningInterviewQuestionDAO
                        {
                            ID = jobOpeningInterviewQuestion.JobOpeningInterviewQuestion_ID,
                            JobOpeningInterviewQuestionID = jobOpeningInterviewQuestion.JobOpeningInterviewQuestion_ID,
                            JobOpeningID = jobOpeningInterviewQuestion.JobOpening_ID,
                            SAQuestionID = jobOpeningInterviewQuestion.SAQuestion_ID
                        };

                        result.Add(temp);
                    }

                    return (result != null ? result : null);
                }
            }
            catch (Exception e)
            {
                throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message));
            }
        }
Пример #10
0
 public JobOpeningInterviewQuestionDAO GetJobOpeningInterviewQuestionByID(int id)
 {
     try
     {
         using (AESDatabaseDataContext db = new AESDatabaseDataContext())
         {
             JobOpeningInterviewQuestion jobOpeningInterviewQuestion = (from jbopinqu in db.JobOpeningInterviewQuestions where jbopinqu.JobOpeningInterviewQuestion_ID == id select jbopinqu).FirstOrDefault();
             JobOpeningInterviewQuestionDAO result = new JobOpeningInterviewQuestionDAO
             {
                 ID = jobOpeningInterviewQuestion.JobOpeningInterviewQuestion_ID,
                 JobOpeningInterviewQuestionID = jobOpeningInterviewQuestion.JobOpeningInterviewQuestion_ID,
                 JobOpeningID = jobOpeningInterviewQuestion.JobOpening_ID,
                 SAQuestionID = jobOpeningInterviewQuestion.SAQuestion_ID
             };
             return (result != null ? result : null);
         }
     }
     catch (Exception e)
     {
         throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message));
     }
 }