Пример #1
0
 public StudentBDO GetStudentBDO(string studentID)
 {
     StudentBDO studentBDO = null;
     try { 
     using (var DCEnt = new DCFIEntities())
     {
         Student student = (from s in DCEnt.Students
                            where s.StudentId == studentID 
                            select s).FirstOrDefault();
         if (student != null)
         {
            // student.ranking = 0;
             studentBDO = new StudentBDO();
             ConvertStudentToStudentBDO(student, studentBDO);
         }
     }
 }
     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 studentBDO;
 }
Пример #2
0
        public String GetStudentName(string studentid)
        {
            StudentBDO stuBDO = new StudentBDO();
            stuBDO = stuLogic.GetStudent(studentid);

            return stuBDO.LastName + ", " + stuBDO.FirstName + " " + stuBDO.MiddleName;
        }
Пример #3
0
 public StudentBDO GetStudent(string studentID)
 {
     StudentBDO stuBDO = new StudentBDO();
     stuBDO = studentDAO.GetStudentBDO(studentID);
     //stuBDO.Siblings = studentDAO.GetSiblings(studentID);
     return stuBDO;
 }
Пример #4
0
 public Boolean UpdateStudent(ref Student student, ref string message)
 {
     message = String.Empty;
     StudentBDO studentBDO = new StudentBDO();
     TranslateStudentDTOToStudentBDO(student, studentBDO);
     return studentLogic.UpdateStudent(ref studentBDO, ref message);
 }
Пример #5
0
 public Boolean UpdateStudent(ref StudentBDO studentBDO, ref string message)
 {
     if (StudentExists(studentBDO.StudentId))
         return studentDAO.UpdateStudent(ref studentBDO, ref message);
     else
     {
         message = "Cannot get user for this ID";
         return false;
     }
 }
Пример #6
0
        public String[] GetStudentName(string studentid)
        {
            StudentBDO stuBDO = new StudentBDO();
            stuBDO = stuLogic.GetStudent(studentid);
            string[] arrStudent = new string[2];
            arrStudent[0] = stuBDO.LastName + ", " + stuBDO.FirstName + " " + stuBDO.MiddleName;
            arrStudent[1] = stuBDO.RunningBalance.ToString();

            return arrStudent;
        }
Пример #7
0
        public Boolean CreateStudent(ref StudentBDO studentBDO, ref string message)
        {
            Boolean ret = false;
            StudentBDO sBDO = GetStudent(studentBDO.StudentId);
            if (sBDO == null)
                ret = studentDAO.CreateStudent(ref studentBDO, ref message);
            else
                message = "Username already exists. Please select another username";

            return ret;
        }
Пример #8
0
 public Boolean CreateStudent(ref Student student, ref string message)
 {
     Boolean ret = false;
     message = String.Empty;
     StudentBDO studentBDO = new StudentBDO();
     TranslateStudentDTOToStudentBDO(student, studentBDO);
     ret = studentLogic.CreateStudent(ref studentBDO, ref message);
     //if (student.Siblings.Count > 0)
     //    studentLogic.CreateSibling(studentBDO.Siblings,studentBDO.StudentId);
     return ret;
 }
Пример #9
0
 public void ConvertStudentToStudentBDO(Student s, StudentBDO sbdo)
 {
     sbdo.Average = s.Average;
     sbdo.BirthCertificate = s.BirthCertificate;
     sbdo.Card = s.Card;
     sbdo.DateAdmitted = s.DateAdmitted;
     sbdo.Dismissed = s.Dismissed;
     sbdo.DOB = s.DOB;
     sbdo.FathersAverageYearlyIncome = s.FathersAverageYearlyIncome;
     sbdo.FathersEducation = s.FathersEducation;
     sbdo.FathersName = s.FathersName;
     sbdo.FathersOccupation = s.FathersOccupation;
     sbdo.FirstName = s.FirstName;
     sbdo.GoodMoral = s.GoodMoral;
     sbdo.GradeLevel = s.GradeLevel;
     sbdo.Graduated = s.Graduated;
     sbdo.GuardiansAverageYearlyIncome = s.GuardiansAverageYearlyIncome;
     sbdo.GuardiansName = s.GuardiansName;
     sbdo.GuardiansOccupation = s.GuardiansOccupation;
     sbdo.HomeAddress = s.HomeAddress;
     sbdo.HomeBarangay = s.HomeBarangay;
     sbdo.HomeProvince = s.HomeProvince;
     sbdo.HomeTownCity = s.HomeTownCity;
     sbdo.Image = s.Image;
     sbdo.LastName = s.LastName;
     sbdo.LastSYAttendedDCFI = s.LastSYAttendedDCFI;
     sbdo.MadrasahEnrolled = s.MadrasahEnrolled;
     sbdo.MiddleName = s.MiddleName;
     sbdo.MothersAverageYearlyIncome = s.MothersAverageYearlyIncome;
     sbdo.MothersEducation = s.MothersEducation;
     sbdo.MothersMaidenName = s.MothersMaidenName;
     sbdo.MothersOccupation = s.MothersOccupation;
     sbdo.POBAddress = s.POBAddress;
     sbdo.POBBarangay = s.POBBarangay;
     sbdo.POBProvince = s.POBProvince;
     sbdo.POBTownCity = s.POBTownCity;
     sbdo.Religion = s.Religion;
     //sbdo.Scholarship = s.Scholarship;
     if (s.ScholarshipDiscountId == null)
         sbdo.ScholarshipDiscountId = null;
     else
         sbdo.ScholarshipDiscountId = (int)s.ScholarshipDiscountId;
     sbdo.SchoolLastAttended = s.SchoolLastAttended;
     // sbdo.Siblings = s.Siblings;
     sbdo.StudentId = s.StudentId;
     sbdo.Gender = s.Gender;
     sbdo.UnitsFailedLastYear = (decimal)s.UnitsFailedLastYear;
     sbdo.RunningBalance = (float)s.RunningBalance;
     sbdo.ranking = s.ranking;
     sbdo.Section = s.Section;
     sbdo.StudentLRN = s.StudentLRN;
 }
Пример #10
0
 public StudentBDO GetStudentBDO(string studentID)
 {
     StudentBDO studentBDO = null;
     using (var DCEnt = new DCFIEntities())
     {
         Student student = (from s in DCEnt.Students
                            where s.StudentId == studentID 
                            select s).FirstOrDefault();
         if (student != null)
         {
             studentBDO = new StudentBDO();
             ConvertStudentToStudentBDO(student, studentBDO);
         }
     }
     return studentBDO;
 }
Пример #11
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;
 }
Пример #12
0
        public void ConvertStuSubjectsToStuSubjectsBDO(StudentSubject s, StudentSubjectBDO sbdo)
        {
            StudentEnrolmentDAO sed = new StudentEnrolmentDAO();
            StudentEnrollmentBDO sedb = new StudentEnrollmentBDO();
            sed.ConvertEnrolToEnrolBDO(s.StudentEnrollment, sedb);
            sbdo.StudentEnrollment = sedb;

            StudentDAO sd = new StudentDAO();
            StudentBDO sb = new StudentBDO();
            sd.ConvertStudentToStudentBDO(s.StudentEnrollment.Student, sb);
            sbdo.StudentEnrollment.Student = sb;

            SubjectDAO subd = new SubjectDAO();
            SubjectBDO sbo = new SubjectBDO();
            subd.ConvertSubjectToSubjectBDO(s.Subject, sbo);
            sbdo.Subject = sbo;

            sbdo.StudentSY = s.StudentSY;
            sbdo.SubjectCode = s.SubjectCode;
            sbdo.StudentSubjectsID = s.StudentSubjectsID;
            sbdo.StudentEnrSubCode = s.StudentEnrSubCode;
            sbdo.Remarks = s.Remarks;

            sbdo.FirstPeriodicRating = s.FirstPeriodicRating;
            sbdo.SecondPeriodicRating = s.SecondPeriodicRating;
            sbdo.ThirdPeriodicRating = s.ThirdPeriodicRating;
            sbdo.FourthPeriodicRating = s.FourthPeriodicRating;

            sbdo.StudentEnrSubCode = s.StudentEnrSubCode;

            sbdo.SubjectAssignments = s.SubjectAssignments;

            sbdo.FirstEntered = s.FirstEntered;
            sbdo.SecondEntered = s.SecondEntered;
            sbdo.FourthEntered = s.FourthEntered;
            sbdo.ThirdEntered = s.ThirdEntered;

            sbdo.LockFirst = s.LockFirst;
            sbdo.LockSecond = s.LockSecond;
            sbdo.LockThird = s.LockThird;
            sbdo.LockFourth = s.LockFourth;

            sbdo.FirstLocked = s.FirstLocked;
            sbdo.SecondLocked = s.SecondLocked;
            sbdo.ThirdLocked = s.ThirdLocked;
            sbdo.FourthLocked = s.FourthLocked;
        }
Пример #13
0
        public List<StudentBDO> GetAllStudents()
        {
            List<Student> studentList = new List<Student>();
            using (var DCEnt = new DCFIEntities())
            {
                var allStudents = (DCEnt.Students);
                studentList = allStudents.ToList<Student>();
            }
                //studentList = (from s in DCEnt.Students
                //               where s.Dismissed == false
                //               && s.LastSYAttendedDCFI == (DateTime.Now.Year - 1).ToString()
                //               select s).ToList<Student>();}

                List<StudentBDO> studentBDOList = new List<StudentBDO>();
            foreach (Student s in studentList)
            {
                StudentBDO studentBDO = new StudentBDO();
                ConvertStudentToStudentBDO(s, studentBDO);
                studentBDOList.Add(studentBDO);
            }
            return studentBDOList;
        }
Пример #14
0
        public Boolean CreateStudent(ref StudentBDO studentBDO, ref string message)
        {
            message = "Student Added Successfully";
            bool ret = true;

            Student s = new Student();
            ConvertStudentBDOToStudent(studentBDO, s);

            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.Students.Attach(s);
                DCEnt.Entry(s).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();
                studentBDO.StudentId = s.StudentId;

                if  (num != 1)
                {
                    ret = false;
                    message = "Adding of User failed";
                }
            }
            return ret;
        }
Пример #15
0
 private void ConvertStudentBDOToStudent(StudentBDO s, Student sbdo)
 {
     //ICollection<Sibling> sib = new List<Sibling>();
    // sib = ToSiblingList(s.Siblings);
     sbdo.FirstName = s.FirstName;
     sbdo.StudentId = s.StudentId;
     sbdo.Average = s.Average;
     sbdo.BirthCertificate = s.BirthCertificate;
     sbdo.Card = s.Card;
     sbdo.DateAdmitted = s.DateAdmitted;
     sbdo.Dismissed = s.Dismissed;
     sbdo.DOB = s.DOB;
     sbdo.FathersAverageYearlyIncome = s.FathersAverageYearlyIncome;
     sbdo.FathersEducation = s.FathersEducation;
     sbdo.FathersName = s.FathersName;
     sbdo.FathersOccupation = s.FathersOccupation;
     sbdo.GoodMoral = s.GoodMoral;
     sbdo.GradeLevel = s.GradeLevel;
     sbdo.Graduated = s.Graduated;
     sbdo.GuardiansAverageYearlyIncome = s.GuardiansAverageYearlyIncome;
     sbdo.GuardiansName = s.GuardiansName;
     sbdo.GuardiansOccupation = s.GuardiansOccupation;
     sbdo.HomeAddress = s.HomeAddress;
     sbdo.HomeBarangay = s.HomeBarangay;
     sbdo.HomeProvince = s.HomeProvince;
     sbdo.HomeTownCity = s.HomeTownCity;
     sbdo.Image = s.Image;
     sbdo.LastName = s.LastName;
     sbdo.LastSYAttendedDCFI = s.LastSYAttendedDCFI;
     sbdo.MadrasahEnrolled = s.MadrasahEnrolled;
     sbdo.MiddleName = s.MiddleName;
     sbdo.MothersAverageYearlyIncome = s.MothersAverageYearlyIncome;
     sbdo.MothersEducation = s.MothersEducation;
     sbdo.MothersMaidenName = s.MothersMaidenName;
     sbdo.MothersOccupation = s.MothersOccupation;
     sbdo.POBAddress = s.POBAddress;
     sbdo.POBBarangay = s.POBBarangay;
     sbdo.POBProvince = s.POBProvince;
     sbdo.POBTownCity = s.POBTownCity;
     sbdo.Religion = s.Religion;
     //sbdo.Scholarship = s.Scholarship;
     //sbdo.ScholarshipCode = s.ScholarshipCode;
     sbdo.SchoolLastAttended = s.SchoolLastAttended;
     sbdo.Gender = s.Gender;
 }
Пример #16
0
        public Boolean UpdateStudent(ref StudentBDO studentBDO, ref string message)
        {
            message = "Student updated successfully.";
            Boolean ret = true;
            try {
            using (var DCEnt = new DCFIEntities())
            {
                var studentID = studentBDO.StudentId;
                Student studentInDB = (from s in DCEnt.Students
                                       where s.StudentId == studentID
                                       select s).FirstOrDefault();
                if (studentInDB == null)
                {
                    throw new Exception("No student with ID " + studentBDO.StudentId);

                }

                DCEnt.Students.Remove(studentInDB);

                studentInDB.StudentId = studentBDO.StudentId;
                studentInDB.LastName = studentBDO.LastName;
                studentInDB.FirstName = studentBDO.FirstName;
                studentInDB.MiddleName = studentBDO.MiddleName;
                studentInDB.DOB = studentBDO.DOB;
                studentInDB.POBAddress = studentBDO.POBAddress;
                studentInDB.POBBarangay = studentBDO.POBBarangay;
                studentInDB.POBTownCity = studentBDO.POBTownCity;
                studentInDB.POBProvince = studentBDO.POBProvince;
                studentInDB.HomeAddress = studentBDO.HomeAddress;
                studentInDB.HomeBarangay = studentBDO.HomeBarangay;
                studentInDB.HomeTownCity = studentBDO.HomeTownCity;
                studentInDB.HomeProvince = studentBDO.HomeProvince;
                studentInDB.SchoolLastAttended = studentBDO.SchoolLastAttended;
                studentInDB.FathersName = studentBDO.FathersName;
                studentInDB.FathersOccupation = studentBDO.FathersOccupation;
                studentInDB.FathersAverageYearlyIncome = studentBDO.FathersAverageYearlyIncome;
                studentInDB.FathersEducation = studentBDO.FathersEducation;
                studentInDB.MothersMaidenName = studentBDO.MothersMaidenName;
                studentInDB.MothersOccupation = studentBDO.MothersOccupation;
                studentInDB.MothersAverageYearlyIncome = studentBDO.MothersAverageYearlyIncome;
                studentInDB.MothersEducation = studentBDO.MothersEducation;
                studentInDB.GuardiansName = studentBDO.GuardiansName;
                studentInDB.GuardiansOccupation = studentBDO.GuardiansOccupation;
                studentInDB.GuardiansAverageYearlyIncome = studentBDO.GuardiansAverageYearlyIncome;
                studentInDB.MadrasahEnrolled = studentBDO.MadrasahEnrolled;
                studentInDB.DateAdmitted = studentBDO.DateAdmitted;
                studentInDB.GradeLevel = studentBDO.GradeLevel;
                studentInDB.Average = studentBDO.Average;
                studentInDB.Card = studentBDO.Card;
                studentInDB.GoodMoral = studentBDO.GoodMoral;
                studentInDB.BirthCertificate = studentBDO.BirthCertificate;
                studentInDB.ScholarshipDiscountId = studentBDO.ScholarshipDiscountId;
                studentInDB.LastSYAttendedDCFI = studentBDO.LastSYAttendedDCFI;
                studentInDB.Dismissed = studentBDO.Dismissed;
                studentInDB.Graduated = studentBDO.Dismissed;
                studentInDB.Religion = studentBDO.Religion;
                studentInDB.Image = studentBDO.Image;
                studentInDB.UnitsFailedLastYear = studentBDO.UnitsFailedLastYear;
                studentInDB.RunningBalance = studentBDO.RunningBalance;
                studentInDB.Section = studentBDO.Section;
                studentInDB.ranking = studentBDO.ranking;
                studentInDB.StudentLRN = studentBDO.StudentLRN;

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

                if (num != 1)
                {
                    ret = false;
                    message = "No student is updated.";
                }
            }
            }
            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;
        }
Пример #17
0
        public List<StudentBDO> GetAllStudents()
        {
            List<Student> studentList = new List<Student>();
            List<StudentBDO> studentBDOList = new List<StudentBDO>();
            try {
            using (var DCEnt = new DCFIEntities())
            {
                    var allStudents = (from s in DCEnt.Students
                                       where s.Dismissed == false
                                       select s);
                studentList = allStudents.ToList<Student>();

                foreach (Student s in studentList)
                {
                    s.ranking = 0;
                    StudentBDO studentBDO = new StudentBDO();
                    ConvertStudentToStudentBDO(s, studentBDO);
                    studentBDOList.Add(studentBDO);
                }
            }
            }
            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 studentBDOList;
        }
Пример #18
0
        public Boolean CreateStudent(ref StudentBDO studentBDO, ref string message)
        {
            message = "Student Added Successfully";
            bool ret = true;

            Student s = new Student();
            try {
            ConvertStudentBDOToStudent(studentBDO, s);

            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.Students.Attach(s);
                DCEnt.Entry(s).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();
                studentBDO.StudentId = s.StudentId;

                if  (num != 1)
                {
                    ret = false;
                    message = "Adding of User 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;
        }
Пример #19
0
        public void TranslateStudentDTOToStudentBDO(Student student, StudentBDO studentBDO)
        {
            //ScholarshipBDO scho = new ScholarshipBDO();
            //TranslateScholarshipToScholarshipBDO(student.Scholarships, scho);

            //List<SiblingBDO> sibList = ToSiblingBDOList(student.Siblings);

            studentBDO.StudentId = student.StudentId;
            studentBDO.LastName = student.LastName;
            studentBDO.FirstName = student.FirstName;
            studentBDO.MiddleName = student.MiddleName;
            studentBDO.DOB = student.DOB;
            studentBDO.POBAddress = student.POBAddress;
            studentBDO.POBBarangay = student.POBBarangay;
            studentBDO.POBTownCity = student.POBTownCity;
            studentBDO.POBProvince = student.POBProvince;
            studentBDO.HomeAddress = student.HomeAddress;
            studentBDO.HomeBarangay = student.HomeBarangay;
            studentBDO.HomeTownCity = student.HomeTownCity;
            studentBDO.HomeProvince = student.HomeProvince;
            studentBDO.SchoolLastAttended = student.SchoolLastAttended;
            studentBDO.FathersName = student.FathersName;
            studentBDO.FathersOccupation = student.FathersOccupation;
            studentBDO.FathersAverageYearlyIncome = student.FathersAverageYearlyIncome;
            studentBDO.FathersEducation = student.FathersEducation;
            studentBDO.MothersMaidenName = student.MothersMaidenName;
            studentBDO.MothersOccupation = student.MothersOccupation;
            studentBDO.MothersAverageYearlyIncome = student.MothersAverageYearlyIncome;
            studentBDO.MothersEducation = student.MothersEducation;
            studentBDO.GuardiansName = student.GuardiansName;
            studentBDO.GuardiansOccupation = student.GuardiansOccupation;
            studentBDO.GuardiansAverageYearlyIncome = student.GuardiansAverageYearlyIncome;
            studentBDO.MadrasahEnrolled = student.MadrasahEnrolled;
            studentBDO.DateAdmitted = student.DateAdmitted;
            studentBDO.GradeLevel = student.GradeLevel;
            studentBDO.Average = student.Average;
            studentBDO.Card = student.Card;
            studentBDO.GoodMoral = student.GoodMoral;
            studentBDO.BirthCertificate = student.BirthCertificate;
            //studentBDO.ScholarshipCode = student.ScholarshipCode;
            studentBDO.LastSYAttendedDCFI = student.LastSYAttendedDCFI;
            studentBDO.Dismissed = student.Dismissed;
            studentBDO.Graduated = student.Graduate;
            studentBDO.Religion = student.Religion;
            //studentBDO.Scholarship = scho;
            studentBDO.Gender = student.Gender;
            //studentBDO.Siblings = sibList;


            studentBDO.Image = student.Image;
        }
Пример #20
0
        public List<StudentBDO> GetAllScholarsofScholarship(int scholarshipCode)
        {
            StudentDAO sd = new StudentDAO();
            List<Student> scholars = null;
            List<StudentBDO> sbdoList = new List<StudentBDO>();
            try {
            using (var DCEnt = new DCFIEntities())
            {
                scholars = (from s in DCEnt.Students
                            where s.ScholarshipDiscountId == scholarshipCode
                            select s).ToList<Student>();

            }
            foreach (Student s in scholars)
            {
                StudentBDO studentBDO = new StudentBDO();
                sd.ConvertStudentToStudentBDO(s, studentBDO);
                sbdoList.Add(studentBDO);
            }
            }
            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 sbdoList;
        }
Пример #21
0
        public void TranslateStudentBDOToStudentDTO(StudentBDO studentBDO, Student student)
        {
            List<Sibling> sibList = new List<Sibling>();
            foreach (SiblingBDO s in studentBDO.Siblings) {
                Sibling sib = new Sibling();
                TranslateSiblingBDOToSibling(s, sib);
                sibList.Add(sib);
            }

            student.StudentId = studentBDO.StudentId;
            student.LastName = studentBDO.LastName;
            student.FirstName = studentBDO.FirstName;
            student.MiddleName = studentBDO.MiddleName;
            student.DOB = studentBDO.DOB;
            student.POBAddress = studentBDO.POBAddress;
            student.POBBarangay = studentBDO.POBBarangay;
            student.POBTownCity = studentBDO.POBTownCity;
            student.POBProvince = studentBDO.POBProvince;
            student.HomeAddress = studentBDO.HomeAddress;
            student.HomeBarangay = studentBDO.HomeBarangay;
            student.HomeTownCity = studentBDO.HomeTownCity;
            student.HomeProvince = studentBDO.HomeProvince;
            student.SchoolLastAttended = studentBDO.SchoolLastAttended;
            student.FathersName = studentBDO.FathersName;
            student.FathersOccupation = studentBDO.FathersOccupation;
            student.FathersAverageYearlyIncome = studentBDO.FathersAverageYearlyIncome;
            student.FathersEducation = studentBDO.FathersEducation;
            student.MothersMaidenName = studentBDO.MothersMaidenName;
            student.MothersOccupation = studentBDO.MothersOccupation;
            student.MothersAverageYearlyIncome = studentBDO.MothersAverageYearlyIncome;
            student.MothersEducation = studentBDO.MothersEducation;
            student.GuardiansName = studentBDO.GuardiansName;
            student.GuardiansOccupation = studentBDO.GuardiansOccupation;
            student.GuardiansAverageYearlyIncome = studentBDO.GuardiansAverageYearlyIncome;
            student.MadrasahEnrolled = studentBDO.MadrasahEnrolled;
            student.DateAdmitted = studentBDO.DateAdmitted;
            student.GradeLevel = studentBDO.GradeLevel;
            student.Average = studentBDO.Average;
            student.Card = studentBDO.Card;
            student.GoodMoral = studentBDO.GoodMoral;
            student.BirthCertificate = studentBDO.BirthCertificate;
            student.ScholarshipCode = studentBDO.ScholarshipCode;
            student.LastSYAttendedDCFI = studentBDO.LastSYAttendedDCFI;
            student.Dismissed = studentBDO.Dismissed;
            student.Graduate = studentBDO.Dismissed;
            student.Religion = studentBDO.Religion;
            student.Image = studentBDO.Image;
            student.Gender = studentBDO.Gender;
            student.Siblings = sibList;
        }
Пример #22
0
        public List<StudentBDO> GetAllScholars()
        {
            List<Student> scholars = null;
            List<StudentBDO> sbdoList = new List<StudentBDO>();
            using (var DCEnt = new DCFIEntities())
            {
                scholars = (from s in DCEnt.Students
                            select s).ToList<Student>();

            }
            foreach (Student s in scholars)
            {
                StudentBDO studentBDO = new StudentBDO();
                ConvertStudentToStudentBDO(s, studentBDO);
                sbdoList.Add(studentBDO);
            }
            return sbdoList;
        }
Пример #23
0
        public void TranslateStudentBDOToStudentDTO(StudentBDO studentBDO, Student student)
        {
            List<Sibling> sibList = new List<Sibling>();
            foreach (SiblingBDO s in studentBDO.Siblings)
            {
                Sibling sib = new Sibling();
                TranslateSiblingBDOToSibling(s, sib);
                sibList.Add(sib);
            }

            student.StudentId = studentBDO.StudentId;
            student.LastName = studentBDO.LastName;
            student.FirstName = studentBDO.FirstName;
            student.MiddleName = studentBDO.MiddleName;
            student.DOB = studentBDO.DOB;
            student.POBAddress = studentBDO.POBAddress;
            student.POBBarangay = studentBDO.POBBarangay;
            student.POBTownCity = studentBDO.POBTownCity;
            student.POBProvince = studentBDO.POBProvince;
            student.HomeAddress = studentBDO.HomeAddress;
            student.HomeBarangay = studentBDO.HomeBarangay;
            student.HomeTownCity = studentBDO.HomeTownCity;
            student.HomeProvince = studentBDO.HomeProvince;
            student.SchoolLastAttended = studentBDO.SchoolLastAttended;
            student.FathersName = studentBDO.FathersName;
            student.FathersOccupation = studentBDO.FathersOccupation;
            student.FathersAverageYearlyIncome = studentBDO.FathersAverageYearlyIncome;
            student.FathersEducation = studentBDO.FathersEducation;
            student.MothersMaidenName = studentBDO.MothersMaidenName;
            student.MothersOccupation = studentBDO.MothersOccupation;
            student.MothersAverageYearlyIncome = studentBDO.MothersAverageYearlyIncome;
            student.MothersEducation = studentBDO.MothersEducation;
            student.GuardiansName = studentBDO.GuardiansName;
            student.GuardiansOccupation = studentBDO.GuardiansOccupation;
            student.GuardiansAverageYearlyIncome = studentBDO.GuardiansAverageYearlyIncome;
            student.MadrasahEnrolled = studentBDO.MadrasahEnrolled;
            student.DateAdmitted = studentBDO.DateAdmitted;
            student.GradeLevel = studentBDO.GradeLevel;
            student.Average = studentBDO.Average;
            student.Card = studentBDO.Card;
            student.GoodMoral = studentBDO.GoodMoral;
            student.BirthCertificate = studentBDO.BirthCertificate;
            if (studentBDO.ScholarshipDiscountId == null)
                student.ScholarshipDiscountId = null;
            else student.ScholarshipDiscountId = (int)studentBDO.ScholarshipDiscountId;
            student.LastSYAttendedDCFI = studentBDO.LastSYAttendedDCFI;
            student.Dismissed = studentBDO.Dismissed;
            student.Graduate = studentBDO.Dismissed;
            student.Religion = studentBDO.Religion;
            student.Image = studentBDO.Image;
            student.Gender = studentBDO.Gender;
            student.Siblings = sibList;
            student.UnitsFailedLastYear = (decimal)studentBDO.UnitsFailedLastYear;
            student.RunningBalance = (float)studentBDO.RunningBalance;
            student.ranking = studentBDO.ranking;
            student.Section = studentBDO.Section;
            student.StudentLRN = studentBDO.StudentLRN;
            student.GradeBeforeDC = studentBDO.GradeBeforeDC;

        }
Пример #24
0
 public Student StudentInfoWithRank(string StudentId, string gradeLevel, string gender)
 {
     Student s = new Student();
     StudentBDO sbdo = new StudentBDO();
     sbdo= studentLogic.GetStudentWithRank( StudentId, gradeLevel, gender);
     TranslateStudentBDOToStudentDTO(sbdo, s);
     return s;
 }
Пример #25
0
        public Boolean UpdateStudent(ref StudentBDO studentBDO, ref string message)
        {
            message = "Student updated successfully.";
            Boolean ret = true;
            using (var DCEnt = new DCFIEntities())
            {
                var studentID = studentBDO.StudentId;
                Student studentInDB = (from s in DCEnt.Students
                                       where s.StudentId == studentID
                                       select s).FirstOrDefault();
                if (studentInDB == null)
                {
                    throw new Exception("No student with ID " + studentBDO.StudentId);

                }

                DCEnt.Students.Remove(studentInDB);

                studentInDB.StudentId = studentBDO.StudentId;
                studentInDB.LastName = studentBDO.LastName;
                studentInDB.FirstName = studentBDO.FirstName;
                studentInDB.MiddleName = studentBDO.MiddleName;
                studentInDB.DOB = studentBDO.DOB;
                studentInDB.POBAddress = studentBDO.POBAddress;
                studentInDB.POBBarangay = studentBDO.POBBarangay;
                studentInDB.POBTownCity = studentBDO.POBTownCity;
                studentInDB.POBProvince = studentBDO.POBProvince;
                studentInDB.HomeAddress = studentBDO.HomeAddress;
                studentInDB.HomeBarangay = studentBDO.HomeBarangay;
                studentInDB.HomeTownCity = studentBDO.HomeTownCity;
                studentInDB.HomeProvince = studentBDO.HomeProvince;
                studentInDB.SchoolLastAttended = studentBDO.SchoolLastAttended;
                studentInDB.FathersName = studentBDO.FathersName;
                studentInDB.FathersOccupation = studentBDO.FathersOccupation;
                studentInDB.FathersAverageYearlyIncome = studentBDO.FathersAverageYearlyIncome;
                studentInDB.FathersEducation = studentBDO.FathersEducation;
                studentInDB.MothersMaidenName = studentBDO.MothersMaidenName;
                studentInDB.MothersOccupation = studentBDO.MothersOccupation;
                studentInDB.MothersAverageYearlyIncome = studentBDO.MothersAverageYearlyIncome;
                studentInDB.MothersEducation = studentBDO.MothersEducation;
                studentInDB.GuardiansName = studentBDO.GuardiansName;
                studentInDB.GuardiansOccupation = studentBDO.GuardiansOccupation;
                studentInDB.GuardiansAverageYearlyIncome = studentBDO.GuardiansAverageYearlyIncome;
                studentInDB.MadrasahEnrolled = studentBDO.MadrasahEnrolled;
                studentInDB.DateAdmitted = studentBDO.DateAdmitted;
                studentInDB.GradeLevel = studentBDO.GradeLevel;
                studentInDB.Average = studentBDO.Average;
                studentInDB.Card = studentBDO.Card;
                studentInDB.GoodMoral = studentBDO.GoodMoral;
                studentInDB.BirthCertificate = studentBDO.BirthCertificate;
                studentInDB.ScholarshipCode = studentBDO.ScholarshipCode;
                studentInDB.LastSYAttendedDCFI = studentBDO.LastSYAttendedDCFI;
                studentInDB.Dismissed = studentBDO.Dismissed;
                studentInDB.Graduated = studentBDO.Dismissed;
                studentInDB.Religion = studentBDO.Religion;
                studentInDB.Image = studentBDO.Image;
                
                DCEnt.Students.Attach(studentInDB);
                DCEnt.Entry(studentInDB).State = System.Data.Entity.EntityState.Modified;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "No student is updated.";
                }
            }
            return ret;

        }