public void Test_UpdateJobRequirement()
        {
            JobRequirementDAO JobReq3 = new JobRequirementDAO() { ID = 3, JobRequirementID = 2, JobOpeningID = 3, SkillID = 3, Notes = "Note 3" };

            Assert.IsTrue(JQService.UpdateJobRequirement(JobReq3));
            Assert.AreEqual(JQService.GetJobRequirementByID(2).SkillID, 3);
        }
        public void Test_CreateJobRequirement()
        {
            JobRequirementDAO JobReq3 = new JobRequirementDAO() { ID = 3, JobRequirementID = 3, JobOpeningID = 3, SkillID = 3, Notes = "Note 3" };

            Assert.IsTrue(JQService.CreateJobRequirement(JobReq3));
            Assert.AreEqual(JQService.GetJobRequirements().Count, 4);
        }
 private void Initialize( JobRequirementDAO jobRequirement, int id, int jobRequirementID, int jobOpeningID, int skillID, string note )
 {
     jobRequirement.ID = id;
     jobRequirement.JobRequirementID = jobRequirementID;
     jobRequirement.JobOpeningID = jobOpeningID;
     jobRequirement.SkillID = skillID;
     jobRequirement.Notes = note;
 }
        internal void SetUp()
        {
            JobRequirementDAO JobReq0 = new JobRequirementDAO() { ID = 0, JobRequirementID = 0, JobOpeningID = 0, SkillID = 0, Notes = "Note 0" };
            JobRequirementDAO JobReq1 = new JobRequirementDAO() { ID = 1, JobRequirementID = 1, JobOpeningID = 1, SkillID = 1, Notes = "Note 1" };
            JobRequirementDAO JobReq2 = new JobRequirementDAO() { ID = 2, JobRequirementID = 2, JobOpeningID = 2, SkillID = 2, Notes = "Note 2" };

            JobRequirements.Add(JobReq0);
            JobRequirements.Add(JobReq1);
            JobRequirements.Add(JobReq2);
        }
 public bool UpdateJobRequirement(JobRequirementDAO newJobRequirement)
 {
     foreach(var jq in JobRequirements)
         if(jq.JobRequirementID == newJobRequirement.JobRequirementID)
         {
             JobRequirements.Remove(jq);
             JobRequirements.Add(newJobRequirement);
             return true;
         }
     return false;
 }
 public bool CreateJobRequirement(JobRequirementDAO e)
 {
     JobRequirements.Add(e);
     return true;
 }
        public bool CreateJobRequirement(JobRequirementDAO jbReqt)
        {
            JobRequirement jobRequirement = new JobRequirement
            {
                JobOpening_ID = jbReqt.JobOpeningID,
                Skill_ID = jbReqt.SkillID,
                Notes = jbReqt.Notes
            };

            using (AESDatabaseDataContext db = new AESDatabaseDataContext())
            {
                db.JobRequirements.InsertOnSubmit(jobRequirement);
                try
                {
                    db.SubmitChanges();
                }
                catch (Exception e)
                {
                    throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message));
                }
            }

            return true;
        }
        public bool UpdateJobRequirement(JobRequirementDAO newJb)
        {
            using (AESDatabaseDataContext db = new AESDatabaseDataContext())
            {
                JobRequirement jobRequirement = db.JobRequirements.Single(jbReqt => jbReqt.JobRequirement_ID == newJb.JobRequirementID);
                jobRequirement.JobOpening_ID = newJb.JobOpeningID;
                jobRequirement.Skill_ID = newJb.SkillID;
                jobRequirement.Notes = newJb.Notes;

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

            return true;
        }
        public IList<JobRequirementDAO> GetJobRequirements()
        {
            try
            {
                using (AESDatabaseDataContext db = new AESDatabaseDataContext())
                {
                    IList<JobRequirement> jobRequirements = db.JobRequirements.ToList();
                    List<JobRequirementDAO> result = new List<JobRequirementDAO>();

                    foreach (var jobRequirement in jobRequirements)
                    {
                        JobRequirementDAO temp = new JobRequirementDAO
                        {
                            ID = jobRequirement.JobRequirement_ID,
                            JobRequirementID = jobRequirement.JobRequirement_ID,
                            JobOpeningID = jobRequirement.JobOpening_ID,
                            SkillID = jobRequirement.Skill_ID,
                            Notes = jobRequirement.Notes
                        };

                        result.Add(temp);
                    }

                    return (result != null ? result : null);
                }
            }
            catch (Exception e)
            {
                throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message));
            }
        }
Пример #10
0
 public JobRequirementDAO GetJobRequirementByID(int id)
 {
     try
     {
         using (AESDatabaseDataContext db = new AESDatabaseDataContext())
         {
             JobRequirement jobRequirement = (from jbReqt in db.JobRequirements where jbReqt.JobRequirement_ID == id select jbReqt).FirstOrDefault();
             JobRequirementDAO result = new JobRequirementDAO
             {
                 ID = jobRequirement.JobRequirement_ID,
                 JobRequirementID = jobRequirement.JobRequirement_ID,
                 JobOpeningID = jobRequirement.JobOpening_ID,
                 SkillID = jobRequirement.Skill_ID,
                 Notes = jobRequirement.Notes
             };
             return (result != null ? result : null);
         }
     }
     catch (Exception e)
     {
         throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message));
     }
 }