Пример #1
0
 public void Add_Answer_To_Table(List <Answer> AnswerList)
 {
     using (DB_9E5950_aes01Entities db = new DB_9E5950_aes01Entities())
     {
         try
         {
             AnswerTable entry;
             foreach (Answer a in AnswerList)
             {
                 entry = new AnswerTable
                 {
                     ApplicationID = a.Application_ID,
                     QuestionID    = a.Question_ID,
                     Answer        = a.Answer_Text
                 };
                 db.AnswerTables.Add(entry);
                 db.SaveChanges();
             }
         }
         catch
         {
             throw new Exception("Error adding to database");
         }
     }
 }
Пример #2
0
        public void Create_Job_Posting(NewPosting posting)
        {
            using (db)
            {
                AvailableJob job = new AvailableJob
                {
                    LocationID = posting.Location_ID,
                    JobID      = posting.Job_ID,
                    CloseDate  = posting.Close_Date,
                    IsActive   = TRUE
                };

                db.AvailableJobs.Add(job);
                db.SaveChanges();
            }
        }
Пример #3
0
 public void deleteQuestionByID(int?value)
 {
     using (db)
     {
         try
         {
             QuestionList question = db.QuestionLists.Find(value);
             db.QuestionLists.Remove(question);
             db.SaveChanges();
         }
         catch
         {
             db = new DB_9E5950_aes01Entities();
             QuestionList q = db.QuestionLists.Find(value);
             q.IsActive = FALSE;
             db.SaveChanges();
         }
     }
 }
Пример #4
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();
            }
        }
Пример #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!!!");
     }
 }
Пример #6
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!!!");
     }
 }