public HbcVisit(CareVisit cv, Login p) { parent = p; InitializeComponent(); this.visit = cv; secure(); patientNameLbl.Text = Entity.CurrentPatient.FirstName.ToUpper() + " " + Entity.CurrentPatient.Surname.ToUpper(); }
private CareVisit getSelectedVisit(int rowId) { int tmpIndex = -1; bool temp = false; CareVisit vis = new CareVisit(); foreach (object v in Entity.CurrentPatient.Visits) { tmpIndex++; if(((CareVisit)v).VisitId == rowId) { temp = true; vis = (CareVisit)v; break; } } return vis; }
private void btnSave_Click(object sender, EventArgs e) { if(visit==null) { visit = new CareVisit(); visit.VisitId = Entity.generateVisitId(visit.VisitType); } visit.PatientId = Entity.CurrentPatient.PatientId; visit.VisitDate = dtpVisitDate.Value; visit.UserId = Entity.CurrentUserId; visit.SiteId = Entity.CurrentSiteId; visit.ClinicalFindings = txtClinicalFindings.Text; visit.Treatment = txtDiagnosis.Text; visit.Remarks = txtComments.Text; if (tbPositive) { visit.TBStatus = "1"; if (tbCounselChkBox.Checked) { visit.HasTBCounselling = 1; if (tbAdherenceChkBox.Checked) visit.AdhereingToTBCounselling = 1; else visit.AdhereingToTBCounselling = 0; } else { visit.HasTBCounselling = 0; } if (dotsChkBox.Checked) { visit.IsOnDOTS = 1; if (dotsRadioBtnYes.Checked) visit.IsAdhereToDOTS = 1; else visit.IsAdhereToDOTS = 0; } else { visit.IsOnDOTS = 0; } } else { visit.TBStatus = "0"; visit.HasTBCounselling = 0; } if(hivPositive) { visit.ConfirmedHivStatus = "1"; if (onARTStatus.Text.Equals("")) visit.OnARTStatus = "NON_OI"; else visit.OnARTStatus = onARTStatus.Text; if (chkbxOnArt.Checked) { visit.IsOnART = "1"; } else { visit.IsOnART = "0"; } if (rdIsAdheringNo.Checked) { visit.IsAdhering = "0"; } else if (rdIsAdheringYes.Checked) { visit.IsAdhering = "1"; } else { visit.IsAdhering = "0"; } } else { visit.ConfirmedHivStatus = "0"; visit.IsOnART = "0"; visit.IsAdhering = "0"; } if (chkbxDied.Checked) { visit.HasDied = 1; visit.DateDied = dtpDied.Value; } else { visit.HasDied = 0; //visit.DateDied = Convert.ToDateTime("00/00/0000"); } if (chkbxReceivedSupp.Checked) { visit.ReceivedSupplement = "1"; if (cboNameOfSuppliment.Text.Equals("Other")) visit.NameOfReceivedSupplement = "Other - " + txtNameOfSupplement.Text; else visit.NameOfReceivedSupplement = cboNameOfSuppliment.Text; } else { visit.ReceivedSupplement = "0"; } if (otherChkBox.Checked) { visit.IsOtherDisease = 1; visit.OtherDiseaseDetails = otherDiseaseTextBox.Text; } if (chkbxPainMgmnt.Checked) { visit.ReceivedPainManagement = "1"; visit.PainManagementLevel = Int32.Parse(cboLevel.Text); if (cboLevel.Text == "3") { visit.ReferPainManagement = txtReferPMgt.Text; } } else { visit.ReceivedPainManagement = "0"; } if (rdDischarge.Checked) { visit.DischargeOrTranfer = "0"; } else if (rdTransfer.Checked) { visit.DischargeOrTranfer = "1"; } else { visit.DischargeOrTranfer = "0"; } if (chkbxCounseled.Checked) { visit.ReceivedCounselling = "1"; } else { visit.ReceivedCounselling = "0"; } //visit.NameOfReceivedSupplement = cboNameOfSuppliment.Text; visit.TransferedTo = txtTransferedto.Text; Entity.saveVisit(visit); bool temp = false; int tmpIndex = -1; foreach (object v in Entity.CurrentPatient.Visits) { tmpIndex++; if(((Visit)v).VisitId == visit.VisitId) { temp = true; break; } } if (temp) { Entity.CurrentPatient.Visits.RemoveAt(tmpIndex); Entity.CurrentPatient.Visits.Add(visit); } else { Entity.CurrentPatient.Visits.Add(visit); } parent.SetUserControl(new PatientSummary(Entity.CurrentPatient,parent)); }