Ejemplo n.º 1
0
        public List <StudentTakeCourse> downloadStudentTakeCoursesFromFirebase()
        {
            List <StudentTakeCourse> allStudentTakeCourses = new List <StudentTakeCourse>();

            using (StreamReader read = new StreamReader("student_take_courses_total_reduced.txt"))
            {
                string line;
                while ((line = read.ReadLine()) != null)
                {
                    String[]          arr = line.Split(',');
                    StudentTakeCourse s1  = new StudentTakeCourse();
                    s1.idSTC         = Convert.ToInt32(arr[0]);
                    s1.rollNoSTC     = arr[1];
                    s1.courseCodeSTC = arr[2];
                    allStudentTakeCourses.Add(s1);
                }
            }

            /*     for (int a=0; a<allStudentTakeCourses.Count; a++)
             *   {
             *       Console.WriteLine(allStudentTakeCourses[a].idSTC+",  "+allStudentTakeCourses[a].rollNoSTC+",  " + allStudentTakeCourses[a].courseCodeSTC);
             *   }
             */
            return(allStudentTakeCourses);
        }
Ejemplo n.º 2
0
        public void Test26StudentTakeCourse()
        {
            StudentTakeCourse c1 = new StudentTakeCourse();

            c1.courseCodeSTC = c1.courseCodeSTC;
            c1.idSTC         = c1.idSTC;
            c1.rollNoSTC     = c1.rollNoSTC;
        }
Ejemplo n.º 3
0
        public List <StudentTakeCourse> getAllStudentTakeCourses(String dummyString = "null")
        {
            if (dummyString != "null")
            {
                connectionString += dummyString;
            }

            SqlConnection            con = null;
            List <StudentTakeCourse> allStudentTakeCourses = new List <StudentTakeCourse>();
            SqlCommand cmd = null;

            try
            {
                con = new SqlConnection(connectionString);
                cmd = new SqlCommand("SELECT * FROM " + studentTakeCourseTable, con);
                cmd.Connection.Open();
                SqlDataReader sdr = cmd.ExecuteReader();

                while (sdr.Read())
                {
                    StudentTakeCourse s1 = new StudentTakeCourse();
                    s1.idSTC         = (int)sdr["id"];
                    s1.courseCodeSTC = (String)sdr["courseCode"];
                    s1.rollNoSTC     = (String)sdr["rollNo"];
                    //     Console.WriteLine(s1.idSTC+", "+ s1.courseCodeSTC + ", " + s1.rollNoSTC);

                    allStudentTakeCourses.Add(s1);
                }
                cmd.Connection.Close();
            }
            catch (Exception e)
            {
                cmd.Connection.Close();
                Console.WriteLine("Getting all studentTakeCourses error");
                //   Console.WriteLine(e.ToString());
                return(null);
            }
            //    Console.WriteLine("StudentTakeCourses returned");
            return(allStudentTakeCourses);
        }