Example #1
0
 public int UpdateTestSchedule(TestSchedule testSchedule)//update test
 {
     try
     {
         using (ExaminationSystemEntities db = new ExaminationSystemEntities())
         {
             TestSchedule t = db.TestSchedules.SingleOrDefault(x => x.ID == testSchedule.ID);
             t.CandidateID       = testSchedule.CandidateID;
             t.BatchID           = testSchedule.BatchID;
             t.TestName          = testSchedule.TestName;
             t.TimeAllowed       = testSchedule.TimeAllowed;
             t.NumberOfQuestions = testSchedule.NumberOfQuestions;
             t.TestStartDate     = testSchedule.TestStartDate;
             t.TestEndDate       = testSchedule.TestEndDate;
             t.MaxMarks          = testSchedule.MaxMarks;
             t.PassMarks         = testSchedule.PassMarks;
             db.SaveChanges();
             return(testSchedule.ID);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #2
0
 public void SaveBatch(Batch batch)//Save method.
 {
     try
     {
         using (ExaminationSystemEntities db = new ExaminationSystemEntities())
         {
             db.Batches.Add(batch);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #3
0
 public void SaveTestSchedule(TestSchedule testSchedule)//Save candidate.
 {
     try
     {
         using (ExaminationSystemEntities db = new ExaminationSystemEntities())
         {
             db.TestSchedules.Add(testSchedule);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void SaveCandidate(Candidate candidate)//Save candidate.
 {
     try
     {
         using (ExaminationSystemEntities db = new ExaminationSystemEntities())
         {
             db.Candidates.Add(candidate);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #5
0
 public List <TestSchedule> GetTestSchedulesByID(string testScheduleID)//Get data by id
 {
     try
     {
         List <TestSchedule> testSchedules = null;
         using (ExaminationSystemEntities db = new ExaminationSystemEntities())
         {
             testSchedules = (from c in db.TestSchedules where c.ID.ToString() == testScheduleID select c).ToList();
         }
         return(testSchedules);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public List <Candidate> GetCandidatesByID(string candidateID)
 {
     try
     {
         List <Candidate> candidates = null;
         using (ExaminationSystemEntities db = new ExaminationSystemEntities())
         {
             candidates = (from c in db.Candidates where c.ID.ToString() == candidateID select c).ToList();
         }
         return(candidates);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #7
0
        public List <Batch> GetBatchesByID(string batchID)
        {
            try
            {
                List <Batch> batches = null;
                using (ExaminationSystemEntities db = new ExaminationSystemEntities())
                {
                    batches = (from c in db.Batches where c.ID.ToString() == batchID select c).ToList();
                }
                return(batches);

                ;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #8
0
 public void DeleteBatch(string batchID)
 {
     try
     {
         using (ExaminationSystemEntities db = new ExaminationSystemEntities())
         {
             Batch b = db.Batches.SingleOrDefault(x => x.ID.ToString().Trim() == batchID.Trim());
             if (b != null)
             {
                 db.Batches.Remove(b);
                 db.SaveChanges();
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #9
0
 public int UpdateBatch(Batch batch)
 {
     try
     {
         using (ExaminationSystemEntities db = new ExaminationSystemEntities())
         {
             Batch b = db.Batches.SingleOrDefault(x => x.ID == batch.ID);
             b.BatchName     = batch.BatchName;
             b.Course        = batch.Course;
             b.NoOfCandidate = batch.NoOfCandidate;
             db.SaveChanges();
             return(batch.ID);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #10
0
 public void DeleteTestSchedule(string testScheduleID)//delete method
 {
     try
     {
         using (ExaminationSystemEntities db = new ExaminationSystemEntities())
         {
             TestSchedule t = db.TestSchedules.SingleOrDefault(x => x.ID.ToString().Trim() == testScheduleID.Trim());
             if (t != null)
             {
                 db.TestSchedules.Remove(t);
                 db.SaveChanges();
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void DeleteCandidate(string candidateID)
 {
     try
     {
         using (ExaminationSystemEntities db = new ExaminationSystemEntities())
         {
             Candidate c = db.Candidates.SingleOrDefault(x => x.ID.ToString().Trim() == candidateID.Trim());
             if (c != null)
             {
                 db.Candidates.Remove(c);
                 db.SaveChanges();
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public int UpdateCandidate(Candidate candidate)
 {
     try
     {
         using (ExaminationSystemEntities db = new ExaminationSystemEntities())
         {
             Candidate c = db.Candidates.SingleOrDefault(x => x.ID == candidate.ID);
             c.CandidateName   = candidate.CandidateName;
             c.RegisterationID = candidate.RegisterationID;
             c.FatherName      = candidate.FatherName;
             c.MotherName      = candidate.MotherName;
             c.Mobile          = candidate.Mobile;
             db.SaveChanges();
             return(candidate.ID);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }