Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
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;
 }