Пример #1
0
        public List <Question> getQuestionsByJobID(int?JobID)
        {
            using (DB_9E5950_aes01Entities db = new DB_9E5950_aes01Entities())
            {
                IQueryable <Question> query = from questions in db.QuestionLists
                                              where questions.JobApplications.Any(c => c.Id == JobID)
                                              select new Question()
                {
                    QuestionID    = questions.Id,
                    QuestionTitle = questions.Title,
                    FullQuestion  = questions.Question
                };

                return(query.ToList());
            }
        }
Пример #2
0
        public void removeQuestionFromJob(QuestionIDJobID questionIDjobID)
        {
            using (DB_9E5950_aes01Entities db = new DB_9E5950_aes01Entities())
            {
                var questionEntity = (from p in db.QuestionLists where p.Id == questionIDjobID.QuestionID select p).FirstOrDefault();

                var query =
                    from ja in db.JobApplications
                    where ja.Id == questionIDjobID.Job_ID
                    select ja;

                foreach (JobApplication japp in query)
                {
                    if (japp.Id == questionIDjobID.Job_ID)
                    {
                        japp.QuestionLists.Remove(questionEntity);
                    }
                }

                db.SaveChanges();
            }
        }
Пример #3
0
 public void Delete_Job_Template(int?value)
 {
     if (value != null)
     {
         try
         {
             DB_9E5950_aes01Entities db  = new DB_9E5950_aes01Entities();
             JobApplication          job = db.JobApplications.Find(value);
             db.JobApplications.Remove(job);
             db.SaveChanges();
         }
         catch
         {
             DB_9E5950_aes01Entities db  = new DB_9E5950_aes01Entities();
             JobApplication          job = db.JobApplications.Find(value);
             job.IsActive = FALSE;
             db.SaveChanges();
         }
     }
     else
     {
         throw new Exception("Jobs not Removed!!!");
     }
 }
Пример #4
0
 public void Delete_Job_Posting(int?value)
 {
     if (value != null)
     {
         try
         {
             DB_9E5950_aes01Entities db  = new DB_9E5950_aes01Entities();
             AvailableJob            job = db.AvailableJobs.Find(value);
             db.AvailableJobs.Remove(job);
             db.SaveChanges();
         }
         catch
         {
             DB_9E5950_aes01Entities db  = new DB_9E5950_aes01Entities();
             AvailableJob            job = db.AvailableJobs.Find(value);
             job.IsActive = FALSE;
             db.SaveChanges();
         }
     }
     else
     {
         throw new Exception("Jobs not Removed!!!");
     }
 }