protected void btnSave_Click(Object sender, EventArgs e) { HealthStatementData hsd = new HealthStatementData(); HealthStatement newStatement = new HealthStatement(); int num1; int.TryParse(indexes.Value, out num1); newStatement.RowID = num1; newStatement.QuestionNum = cmbQuestion.SelectedItem.Value; newStatement.Question = cmbQuestion.SelectedItem.Text; newStatement.IsMedication = chkOngoing.Checked; newStatement.Name = cmbPersonName.SelectedItem.Text; newStatement.Condition = txtCondition.Text; newStatement.DateDiagnosed = txtDateDiagnosed.Text; newStatement.DateLastTreated = txtDateLastTreated.Text; newStatement.Recovery = txtDegreeOfRecovery.Text; newStatement.TreatmentType = txtMeds.Text; if (isEditOrAdd.Value.Equals("Add")) { //dvCondition.InsertItem(false); hsd.InsertEntry(newStatement); } else if (isEditOrAdd.Value.Equals("Edit")) { //dvCondition.UpdateItem(false); hsd.UpdateEntry(newStatement); } isEdit = false; isAdd = false; isEditOrAdd.Value = "none"; //Update validation information UpdateExplanationValidationField(); ObjectDataSource1.Select(); ObjectDataSource1.DataBind(); GridView1.DataBind(); UpdatePanel1.Update(); }
protected void btnAdd_Click(object sender, EventArgs e) { //dvCondition.DataBind(); //dvCondition.Style["Display"] = "block"; mdlPopup.Show(); isAdd = true; isEdit = false; isEditOrAdd.Value = "Add"; HealthStatementData hsd = new HealthStatementData(); cmbQuestion.SelectedIndex = 0; cmbPersonName.SelectedIndex = 0; chkOngoing.Checked = false; txtCondition.Text = ""; txtMeds.Text = ""; txtDateDiagnosed.Text = ""; txtDateLastTreated.Text = ""; txtDegreeOfRecovery.Text = ""; indexes.Value = hsd.NextIndex.ToString(); UpdatePanel1.Update(); }
protected void GridView1_SelectedIndexChanged(Object sender, EventArgs e) { /*ObjectDataSource2.DataBind(); dvCondition.DataBind(); dvCondition.Style["Display"] = "block";*/ //NOTE: Set up fields here. mdlPopup.Show(); isEdit = true; isAdd = false; isEditOrAdd.Value = "Edit"; HealthStatementData hsd = new HealthStatementData(); HealthInformationAnswers hia = (HealthInformationAnswers)(Session["HealthInformationAnswers"]); HealthStatement hs = hsd.getStatementByRowID(Convert.ToInt32(GridView1.DataKeys[GridView1.SelectedIndex].Value)); cmbQuestion.SelectedIndex = cmbQuestion.Items.IndexOf(new System.Web.UI.WebControls.ListItem(hs.Question, hs.QuestionNum)); cmbPersonName.SelectedIndex = cmbPersonName.Items.IndexOf(new System.Web.UI.WebControls.ListItem(hs.Name)); chkOngoing.Checked = hs.IsMedication; txtMeds.Text = hs.TreatmentType; txtDateDiagnosed.Text = hs.DateDiagnosed; txtDateLastTreated.Text = hs.DateLastTreated; txtDegreeOfRecovery.Text = hs.Recovery; indexes.Value = hs.RowID.ToString(); txtCondition.Text = hs.Condition; UpdatePanel1.Update(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { HealthStatementData hsd = new HealthStatementData(); HealthStatement hs = new HealthStatement(); hs.RowID = Convert.ToInt32(e.Keys[e.RowIndex]); hsd.DeleteEntry(hs); //Update validation information UpdateExplanationValidationField(); //e.Keys[e.RowIndex] }