Exemple #1
0
        public List <DTO_CORE_Student> GetStudentByName(DTO_CORE_Student request)
        {
            //Create a list of type DTO_CORE_Student
            DB_connection context = new DB_connection();

            var resultList = context.CORE_Students.Where(student => student.LastName == request.LastName || student.FirstName == student.FirstName); //Needs to also recognize a full name (Firt Last and Last First)
            List <DTO_CORE_Student> result = new List <DTO_CORE_Student>();

            foreach (CORE_Students student in resultList)
            {
                DTO_CORE_Student studentByName = new DTO_CORE_Student
                {
                    StudentID   = student.StudentID,
                    FirstName   = student.FirstName,
                    LastName    = student.LastName,
                    Email       = student.Email,
                    Employed    = (bool)student.Employed,
                    Employer    = student.Employer,
                    MajorID     = student.MajorID,
                    CollegeID   = student.CollegeID,
                    Pass        = student.Pass,
                    Gender      = student.Gender,
                    PhoneNumber = student.PhoneNumber,
                    Active      = (bool)student.Active
                };
                result.Add(studentByName);
            }

            return(result);
        }
Exemple #2
0
        public List <DTO_CORE_Student> GetStudentByEmail(DTO_CORE_Student request)
        {
            //Create a list of type DTO_CORE_Student
            DB_connection context = new DB_connection();

            var resultList = context.CORE_Students.Where(student => student.Email == request.Email || student.Email.Contains(request.Email)).ToList();
            List <DTO_CORE_Student> result = new List <DTO_CORE_Student>();

            foreach (CORE_Students student in resultList)
            {
                DTO_CORE_Student studentByEmail = new DTO_CORE_Student
                {
                    StudentID   = student.StudentID,
                    FirstName   = student.FirstName,
                    LastName    = student.LastName,
                    Email       = student.Email,
                    Employed    = (bool)student.Employed,
                    Employer    = student.Employer,
                    MajorID     = student.MajorID,
                    CollegeID   = student.CollegeID,
                    Pass        = student.Pass,
                    Gender      = student.Gender,
                    PhoneNumber = student.PhoneNumber,
                    Active      = (bool)student.Active
                };
                result.Add(studentByEmail);
            }

            return(result);
        }
Exemple #3
0
        }//end method AddClient

        public DTO_CORE_Student AddStudent(DTO_CORE_Student request)
        {
            DB_connection context = new DB_connection();

            var outputParameter = new System.Data.Entity.Core.Objects.ObjectParameter("new_identity", typeof(int));

            var id = context.proc_AddStudent(request.FirstName, request.LastName,
                                             request.Email, request.Pass, request.MajorID, request.CollegeID,
                                             request.Gender, request.Employed, request.Employer, request.PhoneNumber,
                                             outputParameter);

            id = (int)outputParameter.Value;

            if (id == -1)
            {
                return(null);//client is already in the system
            }
            else if (id >= 1)
            {
                return(request);
            }
            else
            {
                //issue adding client
                return(null);
            }
        }//end method AddStudent
Exemple #4
0
        }//end method AddStudent

        public List <DTO_CORE_Student> GetStudentByID(DTO_CORE_Student request)
        {
            using (DB_connection context = new DB_connection())
            {
                var resultList = context.CORE_Students.Where(student => student.StudentID == request.StudentID).ToList();
                var result     = new List <DTO_CORE_Student>();

                foreach (var student in resultList)
                {
                    var studentByID = new DTO_CORE_Student
                    {
                        StudentID   = student.StudentID,
                        FirstName   = student.FirstName,
                        LastName    = student.LastName,
                        Email       = student.Email,
                        Employed    = (bool)student.Employed,
                        Employer    = student.Employer,
                        MajorID     = student.MajorID,
                        CollegeID   = student.CollegeID,
                        Pass        = student.Pass,
                        Gender      = student.Gender,
                        PhoneNumber = student.PhoneNumber,
                        Active      = (bool)student.Active
                    };
                    result.Add(studentByID);
                }

                return(result);
            }
        }
Exemple #5
0
        public List <DTO_CORE_Student> GetStudentAccount(DTO_CORE_Student request)
        {
            GigALoan_DAL.DB_connection context = new GigALoan_DAL.DB_connection();

            List <DTO_CORE_Student> returnObject = new List <DTO_CORE_Student>();



            var studentList = context.CORE_Students.ToList();

            DTO_CORE_Student successfulMatchedStudent = null;

            foreach (var student in studentList)
            {
                if (request.Email.ToLower() == student.Email.ToLower())
                {
                    if (request.Pass == student.Pass)
                    {
                        successfulMatchedStudent = new DTO_CORE_Student();

                        successfulMatchedStudent.StudentID  = student.StudentID;
                        successfulMatchedStudent.FirstName  = student.FirstName;
                        successfulMatchedStudent.LastName   = student.LastName;
                        successfulMatchedStudent.DateJoined = student.DateJoined;
                        successfulMatchedStudent.Email      = student.Email;
                        successfulMatchedStudent.Pass       = student.Pass;
                        successfulMatchedStudent.MajorID    = student.MajorID;
                        successfulMatchedStudent.CollegeID  = student.CollegeID;
                        successfulMatchedStudent.Gender     = student.Gender;

                        if (student.Employed != null)
                        {
                            successfulMatchedStudent.Employed = (bool)student.Employed;
                        }

                        successfulMatchedStudent.Employer    = student.Employer;
                        successfulMatchedStudent.PhoneNumber = student.PhoneNumber;

                        returnObject.Add(successfulMatchedStudent);

                        return(returnObject);
                    }
                }
            }
            return(null);
        }
Exemple #6
0
        public List <DTO_CHLD_StudentImage> GetStudentImages(DTO_CORE_Student request)
        {
            using (var context = new DB_connection())
            {
                var imageList = context.proc_GetStudentImages(request.StudentID).ToList();

                List <DTO_CHLD_StudentImage> results = new List <DTO_CHLD_StudentImage>();

                foreach (var image in imageList)
                {
                    results.Add(new DTO_CHLD_StudentImage
                    {
                        ImageID   = image.ImageID,
                        ImageName = image.ImageName,
                        ImageURL  = image.ImageURL,
                        ImageUUID = image.ImageUUID
                    });
                }

                return(results);
            }
        }
Exemple #7
0
        public List <DTO_CORE_Gig> FindGigsByStudentID(DTO_CORE_Student request)
        {
            List <DTO_CORE_Gig> results = new List <DTO_CORE_Gig>();

            using (DB_connection context = new GigALoan_DAL.DB_connection())
            {
                var gigList = context.CORE_Gigs.Where(g => g.StudentID == request.StudentID);

                foreach (CORE_Gigs gig in gigList)
                {
                    DTO_CORE_Gig result = new DTO_CORE_Gig
                    {
                        GigID           = gig.GigID,
                        StudentID       = gig.StudentID,
                        AlertID         = gig.AlertID,
                        DateAccepted    = gig.DateAccepted,
                        StudentComments = gig.StudentComments,
                        ClientComments  = gig.ClientComments
                    };

                    if (gig.DateClosed != null)
                    {
                        result.DateClosed = (DateTime)gig.DateClosed;
                    }
                    if (gig.StudentRating != null)
                    {
                        result.StudentRating = (double)gig.StudentRating;
                    }
                    if (gig.ClientRating != null)
                    {
                        result.ClientRating = (double)gig.ClientRating;
                    }

                    results.Add(result);
                }
                return(results);
            }
        }