public static List <Campus> GetCampuses()
        {
            List <Campus> campuses = new List <Campus>();

            Files.dbConnection con = new Files.dbConnection();
            //[dbo].[sp_getCourses]

            string    sqlCampuses = string.Concat("[dbo].[sp_getAllCampus]");
            DataTable tempTable   = null;

            tempTable = con.executeSelectNoParameter(sqlCampuses); //con.executeSelectQueryWithSP(sclearsql, parameter);
            if ((tempTable == null) || (tempTable.Rows.Count == 0))
            {
                //string a = tempTable.Rows[0][0].ToString();
            }
            else
            {
                foreach (DataRow drr in tempTable.Rows)
                {
                    Campus campus = new Campus();
                    campus.campusID   = Convert.ToInt32(drr["CampusID"].ToString());
                    campus.campusName = drr["Campus"].ToString();
                    campuses.Add(campus);
                }
            }

            return(campuses);
        }
Beispiel #2
0
        public static List <Student> GetStudentsOnLoad()
        {
            //////////////////////////////////////////////////////
            //////////////////////////////////////////////////////
            //          DO NOT WORK FOR MORE THAN 300 - 400 RECORDS         // Failed under 500 records
            //////////////////////////////////////////////////////
            //////////////////////////////////////////////////////

            Files.dbConnection con = new Files.dbConnection();
            //List<Student> studentCollection = new List<Student>(100000);
            List <Student> studentCollection = new List <Student>();
            //var model = null;
            DataTable tempTable = null;

            string sclearsql = string.Concat(@"[dbo].[sp_getAllStudents]");

            tempTable = con.executeSelectNoParameter(sclearsql);

            if ((tempTable == null) || (tempTable.Rows.Count == 0))
            {
            }
            else
            {
                foreach (DataRow dr in tempTable.Rows)
                {
                    Student st = new Student();
                    st.Login             = dr["Login"].ToString();
                    st.Title             = dr["Title"].ToString();
                    st.Initials          = dr["Initials"].ToString();
                    st.FirstName         = dr["FirstName"].ToString();
                    st.LastName          = dr["LastName"].ToString();
                    st.PreferredName     = dr["PreferredName"].ToString();
                    st.EmailInstitute    = dr["EmailInstitute"].ToString();
                    st.EnrolmentDate     = dr["EnrolmentDate"].ToString();
                    st.Gender            = dr["Gender"].ToString();
                    st.DateOfBirth       = dr["DateOfBirth"].ToString();
                    st.EmailPersonal     = dr["EmailPersonal"].ToString();
                    st.TelephonePersonal = dr["TelephonePersonal"].ToString();
                    st.MobilePersonal    = dr["MobilePersonal"].ToString();
                    st.USI = dr["USI"].ToString();
                    studentCollection.Add(st);
                }
            }



            var model = new List <Student>()
            {
                new Student {
                    FirstName = "vaibhav", LastName = "sharma"
                },
                new Student {
                    FirstName = "Van", LastName = "phan"
                },
                new Student {
                    FirstName = "Akshay", LastName = "narang"
                }
            };


            //return model;
            return(studentCollection);
        }
        public static StudentApplicationDataLookup GetApplicationAllLookups()
        {
            HttpResponse response = HttpContext.Current.Response;

            //response.AppendHeader("Access-Control-Allow-Origin", "*");
            //response.AppendHeader("Access-Control-Allow-Methods", "*");
            //headers.set('Access-Control-Allow-Headers', 'true');
            //headers.set('Access-Control-Allow-Methods','GET, POST, PATCH, PUT, DELETE, OPTIONS');
            //headers.set('Access-Control-Allow-Credentials', 'Origin, Content-Type, X-Auth-Token');

            Files.dbConnection           con = new Files.dbConnection();
            StudentApplicationDataLookup lkp = new StudentApplicationDataLookup();

            try
            {
                #region Course List
                List <Course> courses = new List <Course>();

                string    sqlCourses      = string.Concat("[dbo].[sp_getCourses]");
                DataTable tempTableCourse = null;
                tempTableCourse = con.executeSelectNoParameter(sqlCourses); //con.executeSelectQueryWithSP(sclearsql, parameter);
                if ((tempTableCourse != null) || (tempTableCourse.Rows.Count >= 0))
                {
                    foreach (DataRow drr in tempTableCourse.Rows)
                    {
                        Course course = new Course();
                        course.CourseID   = Convert.ToInt32(drr["CourseID"]);
                        course.CourseName = drr["Course"].ToString();
                        course.CourseCode = drr["CourseCode"].ToString();
                        courses.Add(course);
                    }
                }
                lkp.course = courses;
                #endregion

                #region Get Campus
                List <Campus> campuses = new List <Campus>();

                string    sqlCampuses     = string.Concat("[dbo].[sp_getAllCampus]");
                DataTable tempTableCampus = null;
                tempTableCampus = con.executeSelectNoParameter(sqlCampuses); //con.executeSelectQueryWithSP(sclearsql, parameter);
                if ((tempTableCampus != null) || (tempTableCampus.Rows.Count >= 0))
                {
                    foreach (DataRow drr in tempTableCampus.Rows)
                    {
                        Campus campus = new Campus();
                        campus.campusID   = Convert.ToInt32(drr["CampusID"].ToString());
                        campus.campusName = drr["Campus"].ToString();
                        campuses.Add(campus);
                    }
                }
                lkp.campus = campuses;
                #endregion

                #region Get CourseCampus
                List <CourseCampus> ccCollection = new List <CourseCampus>();

                string    sqlCC       = string.Concat("[dbo].[sp_getCourseCampus]");
                DataTable tempTableCC = null;
                tempTableCC = con.executeSelectNoParameter(sqlCC); //con.executeSelectQueryWithSP(sclearsql, parameter);
                if ((tempTableCC != null) || (tempTableCC.Rows.Count >= 0))
                {
                    foreach (DataRow drr in tempTableCC.Rows)
                    {
                        CourseCampus cc = new CourseCampus();
                        cc.campusID       = Convert.ToInt32(drr["CampusID"].ToString());
                        cc.courseID       = Convert.ToInt32(drr["CourseId"].ToString());
                        cc.courseCampusID = Convert.ToInt32(drr["CourseCampusID"].ToString());
                        cc.campusName     = drr["Campus"].ToString();
                        ccCollection.Add(cc);
                    }
                }
                lkp.courseCampus = ccCollection;
                #endregion

                #region Get Country
                List <Country> countries = new List <Country>();

                string    sqlCountry       = string.Concat("[dbo].[sp_getCountry]");
                DataTable tempTableCountry = null;
                tempTableCountry = con.executeSelectNoParameter(sqlCountry); //con.executeSelectQueryWithSP(sclearsql, parameter);
                if ((tempTableCountry != null) || (tempTableCountry.Rows.Count >= 0))
                {
                    foreach (DataRow drr in tempTableCountry.Rows)
                    {
                        Country country = new Country();
                        country.countryID = Convert.ToInt32(drr["CountryID"].ToString());
                        country.country   = drr["Country"].ToString();
                        countries.Add(country);
                    }
                }
                lkp.country = countries;
                #endregion

                #region Get Residency
                List <Residency> residencyCollection = new List <Residency>();

                string    sqlResidency  = string.Concat("[dbo].[sp_getResidency]");
                DataTable tempResidency = null;
                tempResidency = con.executeSelectNoParameter(sqlResidency); //con.executeSelectQueryWithSP(sclearsql, parameter);
                if ((tempResidency != null) || (tempResidency.Rows.Count >= 0))
                {
                    foreach (DataRow drr in tempResidency.Rows)
                    {
                        Residency residency = new Residency();
                        residency.residencyId = Convert.ToInt32(drr["ResidencyId"].ToString());
                        residency.vrt_australiancitizenshipresidency = drr["Residency"].ToString();
                        residency.type = drr["Type"].ToString();
                        residencyCollection.Add(residency);
                    }
                }
                lkp.vrt_australiancitizenshipresidency = residencyCollection;
                #endregion

                #region Get Aboriginal
                List <Aboriginal> aboriginalCollection = new List <Aboriginal>();

                string    sqlAboriginal  = string.Concat("[dbo].[sp_getIndigenousAustralians]");
                DataTable tempAboriginal = null;
                tempAboriginal = con.executeSelectNoParameter(sqlAboriginal); //con.executeSelectQueryWithSP(sclearsql, parameter);
                if ((tempAboriginal != null) || (tempAboriginal.Rows.Count >= 0))
                {
                    foreach (DataRow drr in tempAboriginal.Rows)
                    {
                        Aboriginal aboriginal = new Aboriginal();
                        aboriginal.statusId = Convert.ToInt32(drr["StatusId"].ToString());
                        aboriginal.vrt_aboriginalortorresstraitislander = drr["Status"].ToString();
                        aboriginalCollection.Add(aboriginal);
                    }
                }
                lkp.vrt_aboriginalortorresstraitislander = aboriginalCollection;
                #endregion

                #region Get Qualification
                List <Qualification> qualificationCollection = new List <Qualification>();

                string    sqlQualification     = string.Concat("[dbo].[sp_getQualification]");
                DataTable tempsqlQualification = null;
                tempsqlQualification = con.executeSelectNoParameter(sqlQualification); //con.executeSelectQueryWithSP(sclearsql, parameter);
                if ((tempsqlQualification != null) || (tempsqlQualification.Rows.Count >= 0))
                {
                    foreach (DataRow drr in tempsqlQualification.Rows)
                    {
                        Qualification qualification = new Qualification();
                        qualification.qualificationID   = Convert.ToInt32(drr["QualificationID"].ToString());
                        qualification.qualification     = drr["Qualification"].ToString();
                        qualification.internalName      = drr["internalName"].ToString();
                        qualification.selected          = false;
                        qualification.qualificationCode = drr["qualificationCode"].ToString() ?? "";
                        qualificationCollection.Add(qualification);
                    }
                }
                lkp.txtQualification = qualificationCollection;
                #endregion

                #region Get State
                List <State> stateCollection = new List <State>();

                string    sqlState     = string.Concat("[dbo].[sp_getState]");
                DataTable tempsqlState = null;
                tempsqlState = con.executeSelectNoParameter(sqlState); //con.executeSelectQueryWithSP(sclearsql, parameter);
                if ((tempsqlState != null) || (tempsqlState.Rows.Count >= 0))
                {
                    foreach (DataRow drr in tempsqlState.Rows)
                    {
                        State state = new State();
                        state.stateID = Convert.ToInt32(drr["StateID"].ToString());
                        state.state   = drr["State"].ToString();
                        stateCollection.Add(state);
                    }
                }
                lkp.state = stateCollection;
                #endregion

                #region Get IdProof
                List <IdProof> idProofCollection = new List <IdProof>();

                string    idProofState   = string.Concat("[dbo].[sp_getIdentityProof]");
                DataTable tempsqlIdProof = null;
                tempsqlIdProof = con.executeSelectNoParameter(idProofState); //con.executeSelectQueryWithSP(sclearsql, parameter);
                if ((tempsqlIdProof != null) || (tempsqlIdProof.Rows.Count >= 0))
                {
                    foreach (DataRow drr in tempsqlIdProof.Rows)
                    {
                        IdProof idProof = new IdProof();
                        idProof.proofId      = Convert.ToInt32(drr["ProofId"].ToString());
                        idProof.idProofName  = drr["IdentityProof"].ToString();
                        idProof.type         = drr["Type"].ToString();
                        idProof.internalName = drr["InternalName"].ToString();
                        idProofCollection.Add(idProof);
                    }
                }
                lkp.idProof = idProofCollection;
                #endregion

                #region Get WhatBroughtYouHere
                List <WhatBroughtYouHere> whatBroughtYouHereCollection = new List <WhatBroughtYouHere>();

                string    sqlwhatBroughtYouHereCollection = string.Concat("[dbo].[sp_getReasonToChooseBKI]");
                DataTable tempsqlWhatBroughtYouHere       = null;
                tempsqlWhatBroughtYouHere = con.executeSelectNoParameter(sqlwhatBroughtYouHereCollection); //con.executeSelectQueryWithSP(sclearsql, parameter);
                if ((tempsqlWhatBroughtYouHere != null) || (tempsqlWhatBroughtYouHere.Rows.Count >= 0))
                {
                    foreach (DataRow drr in tempsqlWhatBroughtYouHere.Rows)
                    {
                        WhatBroughtYouHere state = new WhatBroughtYouHere();
                        state.reasonToChooseBKIID = Convert.ToInt32(drr["ReasonToChooseBKIID"].ToString());
                        state.vrt_whatbroughtyoutothekanganinstitutewebsite = drr["ReasonToChooseBKI"].ToString();
                        whatBroughtYouHereCollection.Add(state);
                    }
                }
                lkp.whatBroughtYouHere = whatBroughtYouHereCollection;
                #endregion
            }
            catch (Exception e)
            {
            }
            return(lkp);
        }