protected void FindProgramButton_Click(object sender, EventArgs e)
        {
            BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler();
            string pProgramCode = ProgramCodeTextBox.Text;

            try
            {
                string program = RequestDirector.FindProgram(pProgramCode);
                if (!string.IsNullOrEmpty(program))
                {
                    ProgramCodeDescriptionTextBox.Visible = true;
                    MessageLabel.Text = "<i>Program Found</i>";
                    ProgramCodeDescriptionTextBox.Text = program;
                }
                else
                {
                    MessageLabel.Text = "<i>Program NOT Found</i>";
                }
            }
            catch (Exception ex)
            {
                MessageLabel.Text = "<i style='color: red;'>Program NOT Found</i>";
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 2
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler();
            string sProgramCode = ProgramList.SelectedValue;

            try
            {
                Program program = new Program();
                program = RequestDirector.FindProgram(sProgramCode);
                if (program.ProgramCode != null)
                {
                    ProgramCodeLabel.Visible      = true;
                    DescriptionLabel.Visible      = true;
                    EnrolledStudentsLabel.Visible = true;
                    ProgramCodeTextBox.Visible    = true;
                    DescriptionTextBox.Visible    = true;
                    studentsGridView.Visible      = true;
                    ProgramCodeTextBox.Text       = program.ProgramCode;
                    DescriptionTextBox.Text       = program.Description;

                    studentsGridView.DataSource = program.EnrolledStudents;
                    studentsGridView.DataBind();
                }
                else
                {
                    MessageLabel.Text = "<i>Program find was NOT successful</i>";
                }
            }
            catch (Exception ex)
            {
                MessageLabel.Text = "<i style='color: red;'>Student Enrollment was NOT successful</i>";
                Console.WriteLine(ex.Message);
            }
        }