protected void saveButton_Click(object sender, EventArgs e) { string disease = ""; string medicine = ""; if (voterIdTextBox.Text == "") { } else { foreach (GridViewRow row in treatmentGridView.Rows) { TextBox txtBox = (TextBox)row.FindControl("TextBox"); treatment.VoterId = voterIdTextBox.Text; treatment.Observation = observationTextBox.Text; treatment.Date = dateTextBox.Text; treatment.DoctorId = Convert.ToInt32(doctorDropDownList.SelectedValue); treatment.CenterId = Convert.ToInt32(Session["centerId"]); disease = row.Cells[0].Text; medicine = (row.Cells[1].Text); treatment.Dose = (row.Cells[2].Text); treatment.Meal = (row.Cells[3].Text); treatment.Quantity = int.Parse(row.Cells[4].Text); treatment.Note = (row.Cells[5].Text); treatment.DiseaseId = manager.GetDiseaseIdByName(disease); treatment.MedicineId = manager.GetMedicineIdByName(medicine); saveLabel.Text = manager.SaveTreatMent(treatment); // Dopdf(); string text = manager.UpdateQuantity(treatment.CenterId, treatment.MedicineId, treatment.Quantity); } if (manager.IsPatientAlreadyExists(treatment.VoterId)) { updateLabel.Text = manager.UpdateServiceGiven(treatment.VoterId); } else { Services services = new Services(); services.VoterId = voterIdTextBox.Text; services.ServiceGiven = 1; string result = manager.SaveService(services); } } // Dopdf(); Session.Clear(); Session.RemoveAll(); treatmentGridView.DataSource = string.Empty; treatmentGridView.Columns.Clear(); treatmentGridView.DataBind(); observationTextBox.Text = ""; noteTextBox.Text = ""; // Dopdf(); }