예제 #1
0
        public List <QuestionForm> Get_Question_Form(int?value)
        {
            using (DB_9E5950_aes01Entities db = new DB_9E5950_aes01Entities())
            {
                List <Question> JobQlist = getQuestionsByJobID(value);
                var             qList    = db.QuestionLists.ToList().Where(x => x.Type == "APP").Select(x => new QuestionForm
                {
                    question        = new Question(x.Id, x.Title, x.Question, x.Type),
                    checkedQuestion = false
                }).ToList();

                //List<QuestionForm> qList = questionEntity.ToList();


                foreach (QuestionForm item in qList)
                {
                    foreach (Question q in JobQlist)
                    {
                        if (q.QuestionID == item.question.QuestionID)
                        {
                            item.checkedQuestion = true;
                        }
                    }
                }
                //List<QuestionForm> qList = questionEntity.ToList();
                return(qList);
            }
        }
예제 #2
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());
            }
        }
예제 #3
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();
            }
        }
예제 #4
0
 public void Delete_Job_Template(int?value)
 {
     if (value != null)
     {
         try
         {
             db = new DB_9E5950_aes01Entities();
             JobApplication job = db.JobApplications.Find(value);
             db.JobApplications.Remove(job);
             db.SaveChanges();
         }
         catch
         {
             db = new DB_9E5950_aes01Entities();
             JobApplication job = db.JobApplications.Find(value);
             job.IsActive = FALSE;
             db.SaveChanges();
         }
     }
     else
     {
         throw new Exception("Jobs not Removed!!!");
     }
 }
예제 #5
0
 public void Delete_Job_Posting(int?value)
 {
     if (value != null)
     {
         try
         {
             db = new DB_9E5950_aes01Entities();
             AvailableJob job = db.AvailableJobs.Find(value);
             db.AvailableJobs.Remove(job);
             db.SaveChanges();
         }
         catch
         {
             db = new DB_9E5950_aes01Entities();
             AvailableJob job = db.AvailableJobs.Find(value);
             job.IsActive = FALSE;
             db.SaveChanges();
         }
     }
     else
     {
         throw new Exception("Jobs not Removed!!!");
     }
 }