Ejemplo n.º 1
0
 public Student ShowNameEmail(Student aStudent)
 {
     if (HasThisRegNo(aStudent.RegNo))
         {
             return aStudentGateway.ShowNameEmail(aStudent.RegNo);
         }
       return null;
 }
Ejemplo n.º 2
0
        public Student ShowNameEmail(string regNo)
        {
            connection.Open();
            string queryString = string.Format("Select * from StudentsTable Where RegNo='{0}'", regNo);
            SqlCommand command = new SqlCommand(queryString, connection);

            SqlDataReader aReader = command.ExecuteReader();
            Student aStudent = new Student();
            while (aReader.Read())
            {
                aStudent.Name = aReader[1].ToString();
                aStudent.RegNo = aReader[0].ToString();
                aStudent.Email = aReader[2].ToString();
            }
            connection.Close();
            return aStudent;
        }
Ejemplo n.º 3
0
        private void findButton_Click(object sender, EventArgs e)
        {
            aStudent = new Student();

             tempStudent = new Student();

            aStudent.Name = nameTextBox.Text;
            aStudent.RegNo = regNoTextBox.Text;
            aStudent.Email = emailTextBox.Text;

            tempStudent = aStudentBll.ShowNameEmail(aStudent);

            if (tempStudent==null)
            {
                MessageBox.Show(@"Not Registered");
            }
            else
            {
                nameTextBox.Text=tempStudent.Name;
                emailTextBox.Text = tempStudent.Email;
            }
        }
Ejemplo n.º 4
0
 private void findButton_Click(object sender, EventArgs e)
 {
     aStudent = new Student(regNoTextBox.Text, nameTextBox.Text, emailTextBox.Text);
 }