private void LoadAutoPopulatingData() { DataSet theDSExistingForm = new DataSet(); theDSExistingForm = DiffCareManager.GetDifferentiatedCare(Convert.ToInt32(Session["PatientId"]), Convert.ToInt32(Session["PatientVisitId"])); if (theDSExistingForm.Tables[3].Rows.Count > 0) { if (theDSExistingForm.Tables[3].Rows[0][0].ToString() != "1900-01-01 00:00:00.000") { DateTime d2; DateTime d1 = Convert.ToDateTime(theDSExistingForm.Tables[3].Rows[0][0].ToString()); if (theDSExistingForm.Tables[2].Rows.Count < 0) { d2 = Convert.ToDateTime(theDSExistingForm.Tables[2].Rows[0][2].ToString()); } else { d2 = DateTime.Now; } TimeSpan span = d2.Subtract(d1); DataTable dtdecode; int days = (int)span.TotalDays; if (days < 365) { DataView theDTView = new DataView(theDSExistingForm.Tables[1]); theDTView.RowFilter = "Name ='Well' or Name='Advance HIV Disease'"; if (theDTView.Count > 0) { dtdecode = theUtils.CreateTableFromDataView(theDTView); theBindManager.BindCombo(ddlPatientClassification, dtdecode, "NAME", "ID"); } } else { DataView theDTView = new DataView(theDSExistingForm.Tables[1]); theDTView.RowFilter = "Name ='Stable' or Name='Unstable'"; if (theDTView.Count > 0) { dtdecode = theUtils.CreateTableFromDataView(theDTView); theBindManager.BindCombo(ddlPatientClassification, dtdecode, "NAME", "ID"); } } } else { DataView theDTView = new DataView(theDSExistingForm.Tables[1]); theDTView.RowFilter = "Name ='Well' or Name='Advance HIV Disease'"; DataTable dtdecode; if (theDTView.Count > 0) { dtdecode = theUtils.CreateTableFromDataView(theDTView); theBindManager.BindCombo(ddlPatientClassification, dtdecode, "NAME", "ID"); } } } else { DataView theDTView = new DataView(theDSExistingForm.Tables[1]); theDTView.RowFilter = "Name ='Well' or Name='Advance HIV Disease'"; DataTable dtdecode; if (theDTView.Count > 0) { dtdecode = theUtils.CreateTableFromDataView(theDTView); theBindManager.BindCombo(ddlPatientClassification, dtdecode, "NAME", "ID"); } } }