Ejemplo n.º 1
0
        public List<StudentAssessmentBDO> GetStudentAssessment(string studID, string sy)
        {
            string id = string.Empty;
            id = studID + sy;
            List<StudentAssessment> sa = null;
            List<StudentAssessmentBDO> sbList = new List<StudentAssessmentBDO>();
            try { 
            using (var DCEnt = new DCFIEntities())
            {
                sa = (from assess in DCEnt.StudentAssessments
                      where assess.StudentSY == id
                        select assess).ToList<StudentAssessment>();

            }
        
            foreach (StudentAssessment s in sa) {
                StudentAssessmentBDO assessBDO = new StudentAssessmentBDO();
                ConvertAssessToAssessBDO(s, assessBDO);
                sbList.Add(assessBDO);
            }
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                                validationError.PropertyName,
                                                validationError.ErrorMessage);
                    }
                }
            }
            return sbList;
        }
Ejemplo n.º 2
0
        public List<StudentAssessmentBDO> GetAllAssessments()
        {
            List<StudentAssessmentBDO> assessBDOList = new List<StudentAssessmentBDO>();
            List<StudentAssessment> assesList = new List<StudentAssessment>();
            try { 
            using (var DCEnt = new DCFIEntities())
            {
                var allAssessments = (DCEnt.StudentAssessments);
                assesList = allAssessments.ToList<StudentAssessment>();
            }

   
            foreach (StudentAssessment a in assesList)
            {
                StudentAssessmentBDO assessBDO = new StudentAssessmentBDO();
                ConvertAssessToAssessBDO(a, assessBDO);
                assessBDOList.Add(assessBDO);
            }
        }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                                validationError.PropertyName,
                                                validationError.ErrorMessage);
                    }
}
            }
            return assessBDOList;
        }
Ejemplo n.º 3
0
        public List<StudentAssessment> AssessMe(StudentEnrollment student)
        {
            FeeService fs = new FeeService();
            List<Fee> feeList = new List<Fee>();
            feeList = fs.GetAllFeesForGradeLevel(student.GradeLevel, student.SY);
            feeList.Add(fs.GetFeeForAll(student.SY));
            foreach (Fee f in feeList)
            {
                StudentAssessmentBDO sabdo = new StudentAssessmentBDO()
                {
                    StudentSY = student.StudentSY,
                    FeeID = f.FeeID,
                    DiscountId = student.DiscountId
                };

                sal.AssessStudent(sabdo);
            }
            return GetStudentAssessment(student.StudentId,student.SY);
        }
Ejemplo n.º 4
0
        public void ConvertAssessToAssessBDO(StudentAssessment a, StudentAssessmentBDO ab)
        {
            FeeDAO fd = new FeeDAO();
            FeeBDO fb = new FeeBDO();
            ScholarshipDAO sd = new ScholarshipDAO();
            ScholarshipDiscountBDO sb = new ScholarshipDiscountBDO();

            if (a.DiscountId.HasValue)
            {
                int d = (int)a.DiscountId;
                sb = sd.GetScholarship(d);
                ab.DiscountId = (int)a.DiscountId;
            }

            ab.StudentAssessmentId = a.StudentAssessmentId;
            ab.StudentSY = a.StudentSY;
            ab.FeeID = a.FeeID;
            ab.Fee = fd.GetFee((int)ab.FeeID);

            ab.ScholarshipDiscount = sb;
        }
Ejemplo n.º 5
0
        public Boolean CreateStudentAssessment(StudentAssessmentBDO student)
        {
            string message = "Student Successfully Assessed";
            bool ret = true;

            StudentAssessment sa = new StudentAssessment();
            try {
                ConvertAssessBDOToAssess(student, sa);
            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.StudentAssessments.Attach(sa);
                DCEnt.Entry(sa).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "Assessment Failed";
                }

            }
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                                validationError.PropertyName,
                                                validationError.ErrorMessage);
                    }
            }
            }
            return ret;
        }
Ejemplo n.º 6
0
 public void ConvertAssessBDOToAssess(StudentAssessmentBDO ab, StudentAssessment a)
 {
     a.StudentAssessmentId = ab.StudentAssessmentId;
     a.StudentSY = ab.StudentSY;
     a.FeeID = ab.FeeID;
 }
Ejemplo n.º 7
0
        public void AssessStudent(StudentAssessmentBDO sabdo) {
            sadao.CreateStudentAssessment(sabdo);

        }
Ejemplo n.º 8
0
 public void TranslatetAssessBDOToAssess(StudentAssessmentBDO ab, StudentAssessment a)
 {
     a.StudentAssessmentId = ab.StudentAssessmentId;
     a.StudentSY = ab.StudentSY;
     a.FeeID = (int)ab.FeeID;
     a.Amount = (double)ab.Fee.Amount;
     a.ScholarshipDiscountId = (int)ab.DiscountId;
     if (ab.ScholarshipDiscount.Discount.HasValue)
         a.Discount = (float)ab.ScholarshipDiscount.Discount;
 }