Exemplo n.º 1
0
        /// <summary>
        /// Popultes the ward admission.
        /// </summary>
        /// <param name="admissions">The admissions.</param>
        void PopulateWardAdmission()
        {
            if (ddlPatientWard.SelectedIndex == -1)
            {
                return;
            }
            // if (ddlPatientWard.SelectedIndex == 0) return;
            int wardId = int.Parse(ddlPatientWard.SelectedValue);

            if (wardId == -1)
            {
                return;
            }
            int? _wardID           = null;
            bool excludeDischarged = rblOption.SelectedValue == "No";

            if (wardId != 0)
            {
                _wardID = wardId;
            }

            IWardsMaster         wardMaster = (IWardsMaster)ObjectFactory.CreateInstance("BusinessProcess.Administration.BWardMaster, BusinessProcess.Administration");
            List <WardAdmission> _admissions;

            _admissions = wardMaster.GetWardAdmission(this.LocationID, _wardID, null, null, excludeDischarged);

            gridAdmission.DataSource = _admissions;
            gridAdmission.DataBind();

            divGridComponent.Update(); //Bug ID 405
        }
 /// <summary>
 /// Populates the details.
 /// </summary>
 /// <param name="admissionid">The admissionid.</param>
 void BindAdmissionDetails()
 {
     try
     {
         IWardsMaster  wardMaster = (IWardsMaster)ObjectFactory.CreateInstance("BusinessProcess.Administration.BWardMaster, BusinessProcess.Administration");
         WardAdmission admission  = wardMaster.GetWardAdmission(this.FacilityID, null, this.AdmissionID, null).DefaultIfEmpty(null).FirstOrDefault();
         if (admission == null)
         {
             throw new Exception("Could not load details for the selected admission");
         }
         //   textAdmissionNumber.Text = labelAdmissionNumber.Text = admission.AdmissionNumber;
         textAdmissionDate.Value = labelAdmissionDate.Text = admission.AdmissionDate.ToString("dd-MMM-yyyy");
         //calendarButtonExtender.SelectedDate = admission.AdmissionDate;
         textBedNumber.Text   = labelBedNumber.Text = admission.BedNumber;
         labelWard.Text       = admission.WardName;
         labelReferred.Text   = admission.ReferredFrom;
         labelAdmittedBy.Text = this.GetUserDetails(admission.AdmittedBy);
         labelDischarge.Text  = "Not yet discharged";
         if (admission.Discharged)
         {
             string dischargedBy = this.GetUserDetails(admission.DischargedBy.Value);
             labelDischarge.Text = dischargedBy + " on " + admission.DischargeDate.Value.ToString("dd-MMM-yyyy");
         }
         if (admission.ExpectedDischarge.HasValue)
         {
             textExpectedDOD.Value = labelExpectedDOD.Text = admission.ExpectedDischarge.Value.ToString("dd-MMM-yyyy");
             //CalendarExtender1.SelectedDate = admission.ExpectedDischarge.Value;
         }
         if (this.OpenMode == "EDIT")
         {
             ListItem refItem = ddlReferral.Items.FindByValue(admission.ReferredFrom);
             if (refItem != null)
             {
                 refItem.Selected = true;
             }
             else
             {
                 ddlReferral.Items.FindByText("Others").Selected = true;
                 textReferral.Text = admission.ReferredFrom;
             }
             //ddlReferral.SelectedItem.Text = admission.ReferredFrom;
             ListItem item = ddlPatientWard.Items.FindByValue(admission.WardID.ToString());
             if (item != null)
             {
                 item.Selected = true;
             }
         }
     }
     catch (Exception ex)
     {
         this.OnErrorOccured(this, new CommandEventArgs("Error", ex));
         this.EnableModelDialog(false);
     }
     //todo bind control
 }
Exemplo n.º 3
0
 /// <summary>
 /// Patients the has pending admission.
 /// </summary>
 /// <param name="PatientID">The patient identifier.</param>
 /// <param name="LocationID">The location identifier.</param>
 /// <returns></returns>
 private bool PatientHasPendingAdmission(int PatientID, int LocationID)
 {
     try
     {
         IWardsMaster wardMaster = (IWardsMaster)ObjectFactory.CreateInstance("BusinessProcess.Administration.BWardMaster, BusinessProcess.Administration");
         List <Ward.WardAdmission> _patientAdmissions = wardMaster.GetWardAdmission(LocationID, null, null, PatientID, true);
         if (_patientAdmissions != null && _patientAdmissions.Count > 0)
         {
             this.NotifyAction(string.Format("The selected patient is still admitted in {0}.", _patientAdmissions[0].WardName), "Error: Double Admission", true, "");
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         this.showErrorMessage(ref ex);
         return(true);
     }
 }