Exemplo n.º 1
0
        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();
        }
        protected override void CreateChildControls()
        {
            treatments  = centerManager.GetNumberofServiceTaken(VoterId);
            ServiceTime = treatments.Count;
            int i = 1;

            foreach (var treatment in treatments)
            {
                List <Treatment> allTreatments = centerManager.GetAllTreatmentByDate(treatment.Date, VoterId);

                foreach (var service in allTreatments)
                {
                    var div = new HtmlGenericControl("div");
                    div.Attributes.Add("class", "form-inline col-sm-5");
                    div.Controls.Add(new Label()
                    {
                        CssClass = "btn btn-md btn-primary col-sm-12", ID = "treatment" + i, Text = "Treatment " + i
                    });
                    div.Controls.Add(new LiteralControl("<br/>"));
                    div.Controls.Add(new Label()
                    {
                        CssClass = "col-sm-4", Text = "Center Name "
                    });
                    div.Controls.Add(new TextBox()
                    {
                        CssClass = "form-inline col-sm-8", ID = "centerNameTextBox", Text = service.CenterName
                    });
                    div.Controls.Add(new Label()
                    {
                        CssClass = "col-sm-4", Text = "Date "
                    });
                    div.Controls.Add(new TextBox()
                    {
                        CssClass = "form-inline col-sm-8", ID = "datecTextBox", Text = service.Date.ToShortDateString()
                    });
                    div.Controls.Add(new Label()
                    {
                        CssClass = "col-sm-4", Text = "Doctor Name "
                    });
                    div.Controls.Add(new TextBox()
                    {
                        CssClass = "form-inline col-sm-8", ID = "doctorTextBox", Text = service.DoctorName
                    });
                    div.Controls.Add(new Label()
                    {
                        CssClass = "col-sm-4", Text = "Observation "
                    });
                    div.Controls.Add(new TextBox()
                    {
                        CssClass = "form-inline col-sm-8", ID = "observationTextBox", Text = service.Observation
                    });
                    div.Controls.Add(new LiteralControl("<br/>"));
                    section.Controls.Add(div);
                    ShowGridView(service);
                    var div1 = new HtmlGenericControl("div");
                    div1.Controls.Add(new LiteralControl("<br/>"));
                    section.Controls.Add(div1);
                }
                i++;
            }
        }