protected void GrdPriorART_RowDeleting(object sender, GridViewDeleteEventArgs e) { System.Data.DataTable theDT = new System.Data.DataTable(); theDT = ((DataTable)Session["PriorGridData"]); int r = Convert.ToInt32(e.RowIndex.ToString()); int Id = -1; try { if (theDT.Rows.Count > 0) { if (theDT.Rows[r].HasErrors == false) { if ((theDT.Rows[r]["FacilityId"] != null) && (theDT.Rows[r]["FacilityId"] != DBNull.Value)) { if (theDT.Rows[r]["FacilityId"].ToString() != "") { Id = Convert.ToInt32(theDT.Rows[r]["FacilityId"]); theDT.Rows[r].Delete(); theDT.AcceptChanges(); Session["PriorGridData"] = theDT; GrdPriorART.Columns.Clear(); BindGrid(); Refresh(); GrdPriorART.DataSource = (DataTable)Session["PriorGridData"]; GrdPriorART.DataBind(); //IQCareMsgBox.Show("DeleteSuccess", this); } } } if (((DataTable)Session["PriorGridData"]).Rows.Count == 0) { btnAddPriorART.Enabled = false; } else { btnAddPriorART.Enabled = true; } } else { GrdPriorART.Visible = false; //IQCareMsgBox.Show("DeleteSuccess", this); Refresh(); } } catch (Exception ex) { string str = ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { JavaScriptFunctionsOnLoad(); if (Convert.ToInt32(Session["PatientVisitId"]) > 0) { INigeriaARTCard NigAdultIE = (INigeriaARTCard)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BNigeriaARTCard, BusinessProcess.Clinical"); DataSet dsGet = NigAdultIE.GetNigeriaPriorARTDetails(Convert.ToInt32(Session["PatientId"].ToString()), Convert.ToInt32(Session["PatientVisitId"].ToString())); if (dsGet.Tables[0].Rows.Count > 0) { Session["PriorGridData"] = dsGet.Tables[0]; GrdPriorART.Columns.Clear(); BindGrid(); GrdPriorART.DataSource = dsGet.Tables[0]; GrdPriorART.DataBind(); } } } }
protected void GetGreenCardData() { DataSet theDSARTHistory = new DataSet(); IPriorArtHivCare ARTHistoryMgr = (IPriorArtHivCare)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPriorArtHivCare, BusinessProcess.Clinical"); theDSARTHistory = ARTHistoryMgr.GetGreenCardData(Convert.ToInt32(Session["PatientId"]), Convert.ToInt32(Session["PatientVisitId"]), Convert.ToInt32(Session["AppLocationId"])); if (Convert.ToInt32(Session["PatientVisitId"]) > 0) { txtVisitDate.Text = String.Format("{0:dd-MMM-yyyy}", theDSARTHistory.Tables[0].Rows[0]["VisitDate"]); txtTransferInDate.Text = String.Format("{0:dd-MMM-yyyy}", theDSARTHistory.Tables[0].Rows[0]["TransferInDate"]); ddlvisittype.SelectedValue = Convert.ToString(theDSARTHistory.Tables[0].Rows[0]["VisitTypeId"]); ddltransferfrom.SelectedValue = Convert.ToString(theDSARTHistory.Tables[0].Rows[0]["TransferInFrom"]); dddistrict.SelectedValue = Convert.ToString(theDSARTHistory.Tables[0].Rows[0]["TransferInDistrictId"]); ddfacility.SelectedValue = Convert.ToString(theDSARTHistory.Tables[0].Rows[0]["TransferInFacilityId"]); txtMFLCode.Text = theDSARTHistory.Tables[0].Rows[0]["TransferMFLCode"].ToString(); ddlCountryFrom.SelectedValue = Convert.ToString(theDSARTHistory.Tables[0].Rows[0]["TransferInCountryId"]); ddlbaseWHO.SelectedValue = Convert.ToString(theDSARTHistory.Tables[0].Rows[0]["BaseWHOStage"]); txtDateARTStarted.Text = String.Format("{0:dd-MMM-yyyy}", theDSARTHistory.Tables[0].Rows[0]["ARTStartDate"]); txtbaseCD4.Text = theDSARTHistory.Tables[0].Rows[0]["BaseCD4"].ToString(); if (Convert.ToInt32(theDSARTHistory.Tables[0].Rows[0]["BaseHepB"]) == 1) { rdoHepByes.Checked = true; } else if (Convert.ToInt32(theDSARTHistory.Tables[0].Rows[0]["BaseHepB"]) == 0) { rdoHepBNo.Checked = true; } if (Convert.ToInt32(theDSARTHistory.Tables[0].Rows[0]["BasePregnancy"]) == 1) { rdobasePrgencyYes.Checked = true; } else if (Convert.ToInt32(theDSARTHistory.Tables[0].Rows[0]["BasePregnancy"]) == 0) { rdobasePrgencyNo.Checked = true; } if (Convert.ToInt32(theDSARTHistory.Tables[0].Rows[0]["BaseBreastFeeding"]) == 1) { rdobasebrestFeedYes.Checked = true; } else if (Convert.ToInt32(theDSARTHistory.Tables[0].Rows[0]["BaseBreastFeeding"]) == 0) { rdobasebrestFeedNo.Checked = true; } if (Convert.ToInt32(theDSARTHistory.Tables[0].Rows[0]["BaseTBHIV"]) == 1) { rdobaseTBYes.Checked = true; } else if (Convert.ToInt32(theDSARTHistory.Tables[0].Rows[0]["BaseTBHIV"]) == 0) { rdobaseTBNo.Checked = true; } if (Convert.ToInt32(theDSARTHistory.Tables[0].Rows[0]["BaseDiscordant"]) == 1) { rdoDiscordantYes.Checked = true; } else if (Convert.ToInt32(theDSARTHistory.Tables[0].Rows[0]["BaseDiscordant"]) == 0) { rdoDiscordantNo.Checked = true; } if (Convert.ToInt32(theDSARTHistory.Tables[0].Rows[0]["PartnerDisclosure"]) == 1) { rdodiclosureyes.Checked = true; } else if (Convert.ToInt32(theDSARTHistory.Tables[0].Rows[0]["PartnerDisclosure"]) == 0) { rdodiclosureno.Checked = true; } if (Convert.ToInt32(theDSARTHistory.Tables[0].Rows[0]["INHCompletion"]) == 1) { Inhcompyes.Checked = true; } else if (Convert.ToInt32(theDSARTHistory.Tables[0].Rows[0]["INHCompletion"]) == 0) { InhcompNo.Checked = true; } txtbaseweight.Text = theDSARTHistory.Tables[0].Rows[0]["BaseWeight"].ToString(); txtbaseheight.Text = theDSARTHistory.Tables[0].Rows[0]["BaseHeight"].ToString(); txtbaseMUAC.Text = theDSARTHistory.Tables[0].Rows[0]["BaseMUAC"].ToString(); txtFirstARTRegimen.Text = theDSARTHistory.Tables[0].Rows[0]["ARTRegimen"].ToString(); txtBaseViral.Text = theDSARTHistory.Tables[0].Rows[0]["BaseViralLoad"].ToString(); txtbaseviraldate.Text = String.Format("{0:dd-MMM-yyyy}", theDSARTHistory.Tables[0].Rows[0]["BaseViralLoadDate"]); txttransferdate.Text = String.Format("{0:dd-MMM-yyyy}", theDSARTHistory.Tables[0].Rows[0]["TransferOutDate"]); //theHT.Add("BCG", txtDiphtheria.Text); txtMeasles.Text = theDSARTHistory.Tables[0].Rows[0]["Measles"].ToString(); txtIPV.Text = theDSARTHistory.Tables[0].Rows[0]["IPV"].ToString(); txtPenta.Text = theDSARTHistory.Tables[0].Rows[0]["Penta"].ToString(); txtPCV.Text = theDSARTHistory.Tables[0].Rows[0]["PCV"].ToString(); txtBCG.Text = theDSARTHistory.Tables[0].Rows[0]["BCG"].ToString(); txtHBV.Text = theDSARTHistory.Tables[0].Rows[0]["HBV"].ToString(); txtFlu.Text = theDSARTHistory.Tables[0].Rows[0]["Flu"].ToString(); txtHepatitis.Text = theDSARTHistory.Tables[0].Rows[0]["HepatitisB"].ToString(); txtTetanus.Text = theDSARTHistory.Tables[0].Rows[0]["Tetanus"].ToString(); txtPertussis.Text = theDSARTHistory.Tables[0].Rows[0]["Pertussis"].ToString(); txtHaemophilus.Text = theDSARTHistory.Tables[0].Rows[0]["Haemophilus"].ToString(); txtdeathdate.Text = String.Format("{0:dd-MMM-yyyy}", theDSARTHistory.Tables[0].Rows[0]["DeathDate"]); txtsexDisDate.Text = String.Format("{0:dd-MMM-yyyy}", theDSARTHistory.Tables[0].Rows[0]["PartnerDisclosureDate"]); partDisDate.Text = String.Format("{0:dd-MMM-yyyy}", theDSARTHistory.Tables[0].Rows[0]["AdolPartialDisclosureDate"]); txtFullDisDate.Text = String.Format("{0:dd-MMM-yyyy}", theDSARTHistory.Tables[0].Rows[0]["AdolFullDisclosureDate"]); txtINHStartDate.Text = String.Format("{0:dd-MMM-yyyy}", theDSARTHistory.Tables[0].Rows[0]["INHStartDate"]); txtINHCompDate.Text = String.Format("{0:dd-MMM-yyyy}", theDSARTHistory.Tables[0].Rows[0]["INHCompletionDate"]); GrdPriorART.Columns.Clear(); BindGrid(); GrdPriorART.DataSource = theDSARTHistory.Tables[2]; GrdPriorART.DataBind(); DataTable theDTGRV = (DataTable)GrdPriorART.DataSource; ViewState["GridData"] = theDTGRV; } }
protected void btnAddPriorART_Click(object sender, EventArgs e) { if (ValidateLastUsed() == false) { return; } int VisitId = Convert.ToInt32(Session["PatientVisitId"]) > 0 ? Convert.ToInt32(Session["PatientVisitId"]) : 0; DataTable theDT = new DataTable(); if ((DataTable)Session["PriorGridData"] == null) { theDT.Columns.Add("ptn_pk", typeof(Int32)); theDT.Columns.Add("VisitId", typeof(Int32)); theDT.Columns.Add("FacilityId", typeof(Int32)); theDT.Columns.Add("EntrytypeId", typeof(Int32)); theDT.Columns.Add("Facilityname", typeof(string)); theDT.Columns.Add("EntryType", typeof(string)); theDT.Columns.Add("DurationFromDate", typeof(string)); theDT.Columns.Add("DurationToDate", typeof(string)); DataRow theDR = theDT.NewRow(); theDR["ptn_pk"] = Session["PatientId"]; theDR["VisitId"] = VisitId; theDR["Facilityname"] = ddlfacilityname.SelectedItem.Text; theDR["EntryType"] = ddlentrytype.SelectedItem.Text; theDR["DurationFromDate"] = "" + txtdurationfrom.Value + ""; theDR["DurationToDate"] = "" + txtdurationto.Value + ""; theDR["FacilityId"] = ddlfacilityname.SelectedValue; theDR["EntrytypeId"] = ddlentrytype.SelectedValue; theDT.Rows.Add(theDR); GrdPriorART.Columns.Clear(); BindGrid(); Refresh(); GrdPriorART.DataSource = theDT; GrdPriorART.DataBind(); Session["PriorGridData"] = theDT; } else { theDT = (DataTable)Session["PriorGridData"]; if (Convert.ToInt32(ViewState["UpdateFlag"]) == 1) { DataRow[] rows = theDT.Select("FacilityId=" + ViewState["SelectedFacilityId"]); for (int i = 0; i < rows.Length; i++) { rows[i]["ptn_pk"] = Session["PatientId"]; rows[i]["VisitId"] = VisitId; rows[i]["FacilityId"] = ddlfacilityname.SelectedValue; rows[i]["Facilityname"] = ddlfacilityname.SelectedItem.Text; rows[i]["EntryTypeId"] = ddlfacilityname.SelectedValue; rows[i]["EntryType"] = ddlentrytype.SelectedItem.Text; rows[i]["DurationFromDate"] = "" + txtdurationfrom.Value + ""; rows[i]["DurationToDate"] = "" + txtdurationto.Value + ""; theDT.AcceptChanges(); } GrdPriorART.Columns.Clear(); BindGrid(); Refresh(); GrdPriorART.DataSource = theDT; GrdPriorART.DataBind(); Session["PriorGridData"] = theDT; ViewState["UpdateFlag"] = "0"; DataTable theGVDT = (DataTable)GrdPriorART.DataSource; } else { DataRow[] duplicaterows = theDT.Select("FacilityId=" + ddlfacilityname.SelectedValue + " and EntrytypeId=" + ddlentrytype.SelectedValue + " and DurationFromDate='" + txtdurationfrom.Value + "' and DurationToDate='" + txtdurationto.Value + "'"); if (duplicaterows.Length == 0) { DataRow theDR = theDT.NewRow(); theDR["ptn_pk"] = Session["PatientId"]; theDR["VisitId"] = VisitId; theDR["Facilityname"] = ddlfacilityname.SelectedItem.Text; theDR["EntryType"] = ddlentrytype.SelectedItem.Text; theDR["DurationFromDate"] = "" + txtdurationfrom.Value + ""; theDR["DurationToDate"] = "" + txtdurationto.Value + ""; theDR["FacilityId"] = ddlfacilityname.SelectedValue; theDR["EntrytypeId"] = ddlentrytype.SelectedValue; theDT.Rows.Add(theDR); GrdPriorART.Columns.Clear(); BindGrid(); Refresh(); GrdPriorART.DataSource = theDT; GrdPriorART.DataBind(); Session["PriorGridData"] = theDT; } } } }
protected void btnAddPriorART_Click(object sender, EventArgs e) { if (ValidateLastUsed() == false) { return; } int VisitId = Convert.ToInt32(Session["PatientVisitId"]) > 0 ? Convert.ToInt32(Session["PatientVisitId"]) : 0; DataTable theDT = new DataTable(); if ((DataTable)ViewState["GridData"] == null) { theDT.Columns.Add("ptn_pk", typeof(Int32)); theDT.Columns.Add("VisitId", typeof(Int32)); theDT.Columns.Add("PurposeId", typeof(Int32)); theDT.Columns.Add("Purpose", typeof(string)); theDT.Columns.Add("Regimen", typeof(string)); theDT.Columns.Add("RegLastUsed", typeof(string)); DataRow theDR = theDT.NewRow(); theDR["ptn_pk"] = Session["PatientId"]; theDR["VisitId"] = VisitId; theDR["Purpose"] = ddlpurpose.SelectedItem.Text; theDR["Regimen"] = txtRegimen.Text; theDR["RegLastUsed"] = "" + txtLastUsed.Text + ""; theDR["PurposeId"] = ddlpurpose.SelectedValue; theDT.Rows.Add(theDR); GrdPriorART.Columns.Clear(); BindGrid(); Refresh(); GrdPriorART.DataSource = theDT; GrdPriorART.DataBind(); ViewState["GridData"] = theDT; } else { theDT = (DataTable)ViewState["GridData"]; if (Convert.ToInt32(ViewState["UpdateFlag"]) == 1) { DataRow[] rows = theDT.Select("PurposeId=" + ViewState["SelectedPurposeId"] + " and Regimen='" + ViewState["SelectedRegimen"] + "' and RegLastUsed='" + ViewState["SelectedLastused"] + "'"); for (int i = 0; i < rows.Length; i++) { rows[i]["ptn_pk"] = Session["PatientId"]; rows[i]["VisitId"] = VisitId; rows[i]["PurposeId"] = ddlpurpose.SelectedValue; rows[i]["Purpose"] = ddlpurpose.SelectedItem.Text; rows[i]["Regimen"] = txtRegimen.Text; rows[i]["RegLastUsed"] = "" + txtLastUsed.Text + ""; theDT.AcceptChanges(); } GrdPriorART.Columns.Clear(); BindGrid(); Refresh(); GrdPriorART.DataSource = theDT; GrdPriorART.DataBind(); ViewState["GridData"] = theDT; ViewState["UpdateFlag"] = "0"; DataTable theGVDT = (DataTable)GrdPriorART.DataSource; } else { DataRow theDR = theDT.NewRow(); theDR["ptn_pk"] = Session["PatientId"]; theDR["VisitId"] = VisitId; theDR["Purpose"] = ddlpurpose.SelectedItem.Text; theDR["Regimen"] = txtRegimen.Text; theDR["RegLastUsed"] = "" + txtLastUsed.Text + ""; theDR["PurposeId"] = ddlpurpose.SelectedValue; theDT.Rows.Add(theDR); GrdPriorART.Columns.Clear(); BindGrid(); Refresh(); GrdPriorART.DataSource = theDT; GrdPriorART.DataBind(); ViewState["GridData"] = theDT; } } }