static void Main(string[] args) { var A = new Student() { ID = 100 }; // byte var B = new Adult() { ID = 1000 }; // short var regA = new StudentRegistered() { Person = A }; Console.WriteLine("Type: {0} Value: {1}", regA.StudentID.GetType().Name, regA.StudentID); // Type: Byte Value: 100 var regB = new StudentRegistered() { Person = B }; Console.WriteLine("Type: {0} Value: {1}", regB.StudentID.GetType().Name, regB.StudentID); // Type: Int16 Value: 1000 }
public static List <StudentRegistered> GetRegisteredStudents() { List <StudentRegistered> registeredStudents = new List <StudentRegistered>(); using (SqlConnection conn = new SqlConnection(Connection.StringConnection)) { conn.Open(); using (SqlCommand comm = new SqlCommand("SELECT * FROM fn_list_RegisteredStudents()", conn)) { using (SqlDataReader reader = comm.ExecuteReader()) { while (reader.Read()) { StudentRegistered student = new StudentRegistered() { RegisteredStudentID = Convert.ToInt32(reader["RegisteredStudentID"]), StudentID = Convert.ToInt32(reader["StudentID"]), LRN = Convert.ToString(reader["LRN"]), StudentName = Convert.ToString(reader["StudentName"]), Gender = Convert.ToString(reader["Gender"]), MobileNo = Convert.ToString(reader["MobileNo"]), YearLevelID = Convert.ToInt32(reader["YearLevelID"]), EducationLevel = Convert.ToString(reader["EducationLevel"]), YearLevel = Convert.ToString(reader["YearLevel"]), SectionID = Convert.ToInt32(reader["SectionID"]), Section = Convert.ToString(reader["Section"]), SchoolYearID = Convert.ToInt32(reader["SchoolYearID"]), DateRegistered = Convert.ToDateTime(reader["DateRegistered"]) }; registeredStudents.Add(student); } } } } return(registeredStudents); }
public void Handle(StudentRegistered @event) { _dojoDetailsRepository.Change(@event.DojoId, d => d.NumberOfStudents++); }