protected void Delete_Click(object sender, EventArgs e) { try { CheckBox chk = new CheckBox(); Label lbl = new Label(); string patid = ""; PatientDataTier std = new PatientDataTier(); if (grdStudents.Rows.Count > 0) { foreach (GridViewRow row in grdStudents.Rows) { chk = (CheckBox)row.FindControl("chkPatID"); if (chk.Checked) { lbl = (Label)row.Controls[0].FindControl("hidPatID"); patid = lbl.Text.Trim(); std.DeletePatient(patid); } } DataBind(); } } catch { } }
protected void btnHidden_Click(object sender, EventArgs e) { try { string reply; // Adds into SQL database try { PatientDataTier.AddPatient(txtFName.Text, txtMidInit.Text, txtLName.Text, ddlGender.Text, txtStreet.Text, txtCity.Text, ddlState.Text, decimal.Parse(txtZIP.Text), DateTime.Parse(txtDOB.Text), txtHomePhone.Text, txtCellPhone.Text, txtEmailI.Text); reply = "Success"; lblDisplay.Text = reply; } catch (Exception Ex) { throw new Exception(Ex.Message); } finally { } } catch (Exception Ex) { } finally { } }
private void DataBind() { PatientDataTier aDatatier = new PatientDataTier(); DataSet aDataSet = new DataSet(); aDataSet = aDatatier.ViewPatient("", "", ""); grdStudents.DataSource = aDataSet.Tables[0]; // Cache for a while if (Cache["CustomerData"] != null) { Cache.Add("StudentData", new DataView(aDataSet.Tables[0]), null, System.Web.Caching.Cache.NoAbsoluteExpiration, System.TimeSpan.FromMinutes(10), System.Web.Caching.CacheItemPriority.Default, null); } grdStudents.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { PatientDataTier dataTier = new PatientDataTier(); if (!string.IsNullOrEmpty(Request.QueryString["ID"])) { DataSet dataSet = new DataSet(); string patid = Request.QueryString["ID"]; dataSet = dataTier.FindByID(patid); if (Request.QueryString["ID"].Trim().ToUpper() == "EDIT") { } else { //Response.Redirect("~/ViewPatients.aspx"); lblPatientID.Text = dataSet.Tables[0].Rows[0]["patient_id"].ToString(); txtFName.Text = dataSet.Tables[0].Rows[0]["fname"].ToString(); txtMidInit.Text = dataSet.Tables[0].Rows[0]["midint"].ToString(); txtLName.Text = dataSet.Tables[0].Rows[0]["lname"].ToString(); ddlGender.Text = dataSet.Tables[0].Rows[0]["gender"].ToString(); txtDOB.Text = dataSet.Tables[0].Rows[0]["dob"].ToString(); txtStreet.Text = dataSet.Tables[0].Rows[0]["streetname"].ToString(); txtCity.Text = dataSet.Tables[0].Rows[0]["city"].ToString(); ddlState.Text = dataSet.Tables[0].Rows[0]["pait_state"].ToString(); ddlState.DataSource = StateManager.getStates(); ddlState.DataTextField = "FullAndAbbrev"; ddlState.DataValueField = "abbreviation"; ddlState.SelectedValue = "PA"; ddlState.DataBind(); txtZIP.Text = dataSet.Tables[0].Rows[0]["zip"].ToString(); txtHomePhone.Text = dataSet.Tables[0].Rows[0]["home_phone"].ToString(); txtCellPhone.Text = dataSet.Tables[0].Rows[0]["cell_phone"].ToString(); txtEmailI.Text = dataSet.Tables[0].Rows[0]["email"].ToString(); } } } }
private void DataBind() { PatientDataTier aDatatier = new PatientDataTier(); ViewState["vpatid"] = txtPatientID.Text.Trim(); DataSet aDataSet = new DataSet(); aDataSet = aDatatier.GetPatient(Convert.ToString(ViewState["vpatid"])); grdPatient.DataSource = aDataSet.Tables[0]; // Cache for a while if (Cache["PatientData"] == null) { Cache.Add("PatientData", new DataView(aDataSet.Tables[0]), null, System.Web.Caching.Cache.NoAbsoluteExpiration, System.TimeSpan.FromMinutes(10), System.Web.Caching.CacheItemPriority.Default, null); } grdPatient.DataBind(); }