protected void showDetailsButton_Click1(object sender, EventArgs e) { Voter aVoter = new Voter(); string voterId = patientVoterIdTextBox.Text; aVoter.id = voterId; aVoter = centerManager.GetVoterInformation(aVoter.id); patientNameTextBox.Text = aVoter.name; patientAddressTextBox.Text = aVoter.address; patientAgeTextBox.Text = centerManager.CalculateAge(aVoter.date_of_birth).ToString(); List <Treatment> treatMent = centerManager.GetNumberofServiceTaken(voterId); int serviceGiven = 0; foreach (var count in treatMent) { if (count != null) { serviceGiven++; } } serviceTimeTextBox.Text = serviceGiven.ToString(); }