示例#1
0
        public StudentEnrollmentBDO GetStudentEnrolment(string studID, string sy)
        {
            string id = String.Empty;

            id = studID + sy;
            StudentEnrollment    sa       = null;
            StudentEnrollmentBDO enrolBDO = new StudentEnrollmentBDO();

            try {
                using (var DCEnt = new DCFIEntities())
                {
                    sa = (from enrol in DCEnt.StudentEnrollments
                          where enrol.StudentSY == id
                          select enrol).FirstOrDefault();
                }

                ConvertEnrolToEnrolBDO(sa, enrolBDO);
            }
            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(enrolBDO);
        }
示例#2
0
 public void ConvertEnrolBDOToEnrol(StudentEnrollmentBDO seb, StudentEnrollment se)
 {
     se.StudentSY = seb.StudentSY;
     se.StudentId = seb.StudentId;
     se.SY = seb.SY;
     se.GradeLevel = seb.GradeLevel;
     se.GradeSectionCode = seb.GradeSectionCode;
     se.Dismissed = seb.Dismissed;
     se.Stat = seb.Stat;
     se.DiscountId = seb.DiscountId;
     se.StudentEnrollmentsID = seb.StudentEnrollmentsID;
 }
示例#3
0
 public void ConvertEnrolBDOToEnrol(StudentEnrollmentBDO seb, StudentEnrollment se)
 {
     se.StudentSY            = seb.StudentSY;
     se.StudentId            = seb.StudentId;
     se.SY                   = seb.SY;
     se.GradeLevel           = seb.GradeLevel;
     se.GradeSectionCode     = seb.GradeSectionCode;
     se.Dismissed            = seb.Dismissed;
     se.Stat                 = seb.Stat;
     se.DiscountId           = seb.DiscountId;
     se.StudentEnrollmentsID = seb.StudentEnrollmentsID;
 }
示例#4
0
 public void ConvertEnrolToEnrolBDO(StudentEnrollment se, StudentEnrollmentBDO seb)
 {
     StudentDAO sd = new StudentDAO();
     StudentBDO stu = new StudentBDO();
     stu = sd.GetStudentBDO(se.StudentId);
     seb.StudentSY = se.StudentSY;
     seb.StudentId = se.StudentId;
     seb.SY = se.SY;
     seb.GradeLevel = se.GradeLevel;
     seb.GradeSectionCode = se.GradeSectionCode;
     seb.Dismissed = se.Dismissed;
     seb.Stat = se.Stat;
     seb.DiscountId = se.DiscountId;
     seb.Student = stu;
     seb.StudentEnrollmentsID = se.StudentEnrollmentsID;
 }
示例#5
0
        public Boolean UpdateStudentSection(String studentSy, int gradeSectionCode)
        {
            try
            {
                using (var DCEnt = new DCFIEntities())
                {
                    var x = (from ss in DCEnt.StudentEnrollments
                             where ss.StudentSY == studentSy
                             select ss).FirstOrDefault();


                    StudentEnrollment s = new StudentEnrollment();
                    s.DiscountId           = x.DiscountId;
                    s.Dismissed            = x.Dismissed;
                    s.GradeLevel           = x.GradeLevel;
                    s.Stat                 = x.Stat;
                    s.StudentEnrollmentsID = x.StudentEnrollmentsID;
                    //s.SY = x.SY;

                    DCEnt.StudentEnrollments.Remove(x);
                    x.StudentId        = studentSy.Substring(0, 8);
                    x.GradeSectionCode = gradeSectionCode;
                    x.SY         = studentSy.Substring(8, 9);
                    x.DiscountId = s.DiscountId;
                    x.GradeLevel = s.GradeLevel;
                    x.Stat       = s.Stat;

                    DCEnt.StudentEnrollments.Attach(x);

                    DCEnt.Entry(x).State = System.Data.Entity.EntityState.Modified;
                    int num = DCEnt.SaveChanges();
                }
            }
            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(true);
        }
示例#6
0
        public void ConvertEnrolToEnrolBDO(StudentEnrollment se, StudentEnrollmentBDO seb)
        {
            StudentDAO sd  = new StudentDAO();
            StudentBDO stu = new StudentBDO();

            stu                      = sd.GetStudentBDO(se.StudentId);
            seb.StudentSY            = se.StudentSY;
            seb.StudentId            = se.StudentId;
            seb.SY                   = se.SY;
            seb.GradeLevel           = se.GradeLevel;
            seb.GradeSectionCode     = se.GradeSectionCode;
            seb.Dismissed            = se.Dismissed;
            seb.Stat                 = se.Stat;
            seb.DiscountId           = se.DiscountId;
            seb.Student              = stu;
            seb.StudentEnrollmentsID = se.StudentEnrollmentsID;
        }
示例#7
0
        public Boolean EnrolStudent(StudentEnrollmentBDO studentBDO, ref string message)
        {
            message = "Successful registering student";
            Boolean           ret     = true;
            StudentEnrollment student = new StudentEnrollment();

            ConvertEnrolBDOToEnrol(studentBDO, student);
            string sid = studentBDO.StudentId;

            try{
                using (var DCEnt = new DCFIEntities())
                {
                    DCEnt.StudentEnrollments.Attach(student);
                    DCEnt.Entry(student).State = System.Data.Entity.EntityState.Added;

                    Student inDB = (from s in DCEnt.Students
                                    where s.StudentId.Equals(sid)
                                    select s).FirstOrDefault();

                    inDB.ScholarshipDiscountId = studentBDO.DiscountId;

                    DCEnt.SaveChanges();
                }
            }
            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);
        }
示例#8
0
        public Boolean EnrolStudent(StudentEnrollmentBDO studentBDO, ref string message)
        {
            message = "Successful registering student";
            Boolean ret = true;
            StudentEnrollment student = new StudentEnrollment();
            ConvertEnrolBDOToEnrol(studentBDO, student);
            string sid = studentBDO.StudentId;
            try{
                using (var DCEnt = new DCFIEntities())
                {
                    DCEnt.StudentEnrollments.Attach(student);
                    DCEnt.Entry(student).State = System.Data.Entity.EntityState.Added;

                    Student inDB = (from s in DCEnt.Students
                                    where s.StudentId.Equals(sid)
                                    select s).FirstOrDefault();

                    inDB.ScholarshipDiscountId = studentBDO.DiscountId;

                    DCEnt.SaveChanges();

                }
            }
            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;
        }
示例#9
0
        public Boolean UpdateStudentSection(String studentSy, int gradeSectionCode) {
             try
            {
                using (var DCEnt = new DCFIEntities())
                {
                    var x = (from ss in DCEnt.StudentEnrollments
                             where ss.StudentSY == studentSy
                             select ss).FirstOrDefault();


                    StudentEnrollment s = new StudentEnrollment();
                    s.DiscountId = x.DiscountId;
                    s.Dismissed = x.Dismissed;
                    s.GradeLevel = x.GradeLevel;
                    s.Stat = x.Stat;
                    s.StudentEnrollmentsID = x.StudentEnrollmentsID;
                    //s.SY = x.SY;
                    
                    DCEnt.StudentEnrollments.Remove(x);
                    x.StudentId = studentSy.Substring(0, 8);
                    x.GradeSectionCode = gradeSectionCode;
                    x.SY = studentSy.Substring(8,9);
                    x.DiscountId = s.DiscountId;
                    x.GradeLevel = s.GradeLevel;
                    x.Stat = s.Stat;

                    DCEnt.StudentEnrollments.Attach(x);

                    DCEnt.Entry(x).State = System.Data.Entity.EntityState.Modified;
                    int num = DCEnt.SaveChanges();

                }
            }
            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 true;
        }