示例#1
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        BCS RequestDirector = new BCS();


        try
        {
            Student enrolledStudent = RequestDirector.FindStudent(DeleteStudentTextBox.Text);

            if (!string.IsNullOrEmpty(enrolledStudent.FirstName))
            {
                MessageLabel.Text         = "";
                Panel1.Visible            = true;
                StudentId.Text            = enrolledStudent.StudentId;
                FirstName.Text            = enrolledStudent.FirstName;
                LastName.Text             = enrolledStudent.LastName;
                Email.Text                = enrolledStudent.Email;
                DeleteStudentTextBox.Text = "";
            }
            else
            {
                Panel1.Visible    = false;
                MessageLabel.Text = ("Student not found");
            }
        }
        catch (Exception)
        {
            Panel1.Visible    = false;
            MessageLabel.Text = ("Find student was not successful");

            MessageLabel.ForeColor = System.Drawing.Color.DarkRed;
        }
    }
示例#2
0
 public void OnPostView(string id)
 {
     if (ModelState.IsValid)
     {
         BCS RequestDirector = new BCS();
         AcceptedStudent = RequestDirector.FindStudent(id);
         FirstNameField  = AcceptedStudent.FirstName;
         LastNameField   = AcceptedStudent.LastName;
         EmailField      = AcceptedStudent.Email;
         StudentIDField  = AcceptedStudent.StudentID;
         Message         = $"Viewing {AcceptedStudent.FirstName}";
     }
 }
示例#3
0
        public void OnPost(string searchBox)
        {
            searchedStudent = new Student();
            searchedStudent = _requestDirector.FindStudent(searchBox);

            studentId   = searchedStudent.StudentId;
            firstName   = searchedStudent.FirstName;
            lastName    = searchedStudent.LastName;
            email       = searchedStudent.Email;
            programCode = searchedStudent.ProgramCode;


            if (searchedStudent == null)
            {
                Message = "Student Does Not Exist";
            }
        }
示例#4
0
        public void OnPost()
        {
            if (ModelState.IsValid)
            {
                bool    Confirmation;
                Student AcceptedStudent = new Student
                {
                    StudentID = StudentIDField,
                    FirstName = FirstNameField,
                    LastName  = LastNameField,
                    Email     = EmailField
                };
                BCS RequestDirector = new BCS();
                Confirmation = RequestDirector.EnrollStudent(AcceptedStudent, ProgramCodeField);

                AcceptedStudent = RequestDirector.FindStudent(AcceptedStudent.StudentID);

                Message = $"{AcceptedStudent.FirstName} {AcceptedStudent.LastName} was enrolled :{Confirmation} in the {ProgramCodeField} program";
            }
            else
            {
                Message = $"Not Valid";
            }
        }