Ejemplo n.º 1
0
 public bool Create(MST_EXAM exam)
 {
     try
     {
         unitOfWork.ExamRepository.Create(exam);
         unitOfWork.Save();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Ejemplo n.º 2
0
 public bool Update(MST_EXAM examData)
 {
     try
     {
         unitOfWork.ExamRepository.Update(examData);
         unitOfWork.Save();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
 public bool Delete(MST_EXAM Exam)
 {
     try
     {
         List <MST_EXAM_REPORT> ExamReports = unitOfWork.ExamReportRepository.Filter(x => x.ExamId == Exam.ExamId).ToList();
         foreach (var ExamReport in ExamReports)
         {
             unitOfWork.ExamReportRepository.Delete(ExamReport);
             unitOfWork.Save();
         }
         unitOfWork.ExamRepository.Delete(Exam);
         unitOfWork.Save();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         List <MST_EXAM> NEWEXAM = new List <MST_EXAM>();
         List <MST_EXAM> OLDEXAM = new List <MST_EXAM>();
         int?            SubjectId, SubSubjectId;
         byte            ExamTypeId, Fin_Id;
         foreach (var item in lvExam.Items)
         {
             SubjectId    = lvExam.DataKeys[item.DisplayIndex].Values["SUBJECTID"] as int?;
             SubSubjectId = lvExam.DataKeys[item.DisplayIndex].Values["SUBSUBJECTID"] as int?;
             ExamTypeId   = Convert.ToByte(ddlExamType.SelectedValue);
             Fin_Id       = Convert.ToByte(uc_finyear.FinyearValue);
             //if (SubjectId!= null && SubSubjectId!= null)
             //{
             //    var data =ExamDTO.GetExamSubSubjectId(Convert.ToInt32(SubjectId), ExamTypeId, Fin_Id);
             //    if(data!=null)
             //    {
             //        ExamDTO.Delete(data);
             //        continue;
             //    }
             //}
             int ExamId   = Convert.ToInt32(lvExam.DataKeys[item.DisplayIndex].Values["EXAMID"].ToString().Trim() != "" ? lvExam.DataKeys[item.DisplayIndex].Values["EXAMID"].ToString() : "0");
             var ExamData = ExamDTO.GetById(ExamId);
             if (ExamData != null)
             {
                 ExamData.MaximumMarks = Convert.ToByte(((TextBox)(item.FindControl("txtMaximumMarks"))).Text);
                 ExamData.PassingMarks = Convert.ToByte(((TextBox)(item.FindControl("txtPassingMarks"))).Text);
                 ExamData.ExamTypeId   = ExamTypeId;
                 ExamData.Fin_ID       = Fin_Id;
                 OLDEXAM.Add(ExamData);
             }
             else
             {
                 MST_EXAM NewExamData = new MST_EXAM();
                 NewExamData.SubjectId    = SubjectId;
                 NewExamData.SubSubjectId = SubSubjectId;
                 NewExamData.MaximumMarks = Convert.ToByte(((TextBox)(item.FindControl("txtMaximumMarks"))).Text);
                 NewExamData.PassingMarks = Convert.ToByte(((TextBox)(item.FindControl("txtPassingMarks"))).Text);
                 NewExamData.ExamTypeId   = ExamTypeId;
                 NewExamData.Fin_ID       = Fin_Id;
                 NEWEXAM.Add(NewExamData);
             }
         }
         foreach (var Exam in NEWEXAM)
         {
             if (!ExamDTO.Create(Exam))
             {
                 throw new Exception();
             }
         }
         foreach (var Exam in OLDEXAM)
         {
             if (!ExamDTO.Update(Exam))
             {
                 throw new Exception();
             }
         }
         uc_sucess.VisibleError = false;
         BindClassExam();
         uc_sucess.SuccessMessage = "Saved Successfully!";
         uc_sucess.Visible        = true;
     }
     catch (Exception ex)
     {
         uc_sucess.ErrorMessage = ex.Message;
         uc_sucess.VisibleError = true;
     }
 }
Ejemplo n.º 5
0
        public MST_EXAM GetById(int id)
        {
            MST_EXAM data = unitOfWork.ExamRepository.Filter(x => x.ExamId == id).SingleOrDefault();

            return(data);
        }