public static DataTable CreateDataTable( Registration  registration   )
        {
            DataTable dt = new DataTable();

            DataColumn col_StudentID = new DataColumn("StudentID" , typeof(int));
            DataColumn col_Name = new DataColumn("Name" , typeof(string));
            DataColumn col_DateOfBirth = new DataColumn("DateOfBirth" , typeof(DateTime));
            DataColumn col_GradePointAvg = new DataColumn("GradePointAvg" , typeof(decimal));
            DataColumn col_Active = new DataColumn("Active" , typeof(bool));
            dt.Columns.AddRange(new DataColumn[] { col_StudentID,col_Name,col_DateOfBirth,col_GradePointAvg,col_Active,});		return dt;
        }
 private void AddRegistration()
 {
     if (CheckValidity())
     {
         Registration StudentRegistration;
         if (textBoxStudentID.Text == "<Auto Generate>")
         {
             StudentRegistration = new Registration(textBoxStudentName.Text.Trim(), dateTimePickerDateOfBirth.Value, decimal.Parse(textBoxGPA.Text), checkBoxActive.Checked);
         }
         else
         {
             StudentRegistration = new Registration(int.Parse(textBoxStudentID.Text), textBoxStudentName.Text.Trim(), dateTimePickerDateOfBirth.Value, decimal.Parse(textBoxGPA.Text), checkBoxActive.Checked);
         }
         NewRegistrations.Add(StudentRegistration);
         ClearFields();
     }
 }
        public static void FillData(DataTable dt, Registration user)
        {
            DataRow drow = dt.NewRow();

            drow["StudentID"] = user.StudentID;
            drow["Name"] = user.Name;
            drow["DateOfBirth"] = user.DateOfBirth;
            drow["GradePointAvg"] = user.GradePointAvg;
            drow["Active"] = user.Active;
            dt.Rows.Add(drow);
        }
        private static Registration MakeRegistration(SqlDataReader dataReader)
        {
            Registration registration = new Registration();

            if (dataReader.IsDBNull(0) == false) {
                registration.StudentID = dataReader.GetInt32(0);
            }
            if (dataReader.IsDBNull(1) == false) {
                registration.Name = dataReader.GetString(1);
            }
            if (dataReader.IsDBNull(2) == false) {
                registration.DateOfBirth = dataReader.GetDateTime(2);
            }
            if (dataReader.IsDBNull(3) == false) {
                registration.GradePointAvg = dataReader.GetDecimal(3);
            }
            if (dataReader.IsDBNull(4) == false) {
                registration.Active = dataReader.GetBoolean(4);
            }

            return registration;
        }
        public static Registration Select(int studentID_Incoming)
        {
            Registration Registrationins = new Registration();
            SqlConnection scon = Connection.GetConnection();
            SqlCommand scom = new SqlCommand("RegistrationSelect", scon);
            scom.CommandType = CommandType.StoredProcedure;
            scon.Open();

            scom.Parameters.Add("@StudentID", SqlDbType.Int,4);
            scom.Parameters["@StudentID"].Value = studentID_Incoming;
            using (SqlDataReader dataReader = scom.ExecuteReader()){
                if (dataReader.Read()) {
                    Registrationins = MakeRegistration(dataReader);
                } else {
                    Registrationins = null;
                }
            }
            scon.Close();
            return Registrationins;
        }