Ejemplo n.º 1
0
        /// <summary>
        /// Selecteds the ward changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void SelectedWardChanged(object sender, EventArgs e)
        {
            if (ddlPatientWard.SelectedIndex == 0)
            {
                return;
            }

            int          wardId     = int.Parse(ddlPatientWard.SelectedValue);
            IWardsMaster wardMaster = (IWardsMaster)ObjectFactory.CreateInstance("BusinessProcess.Administration.BWardMaster, BusinessProcess.Administration");
            PatientWard  ward       = wardMaster.GetWards(this.FacilityID, wardId).DefaultIfEmpty(null).FirstOrDefault();

            if (ward != null)
            {
                int availableBeds = ward.Capacity - ward.Occupancy;
                if (availableBeds > 0)
                {
                    labelAvailablity.Text = string.Format("{0} beds available", availableBeds);
                }
                else
                {
                    labelAvailablity.Text = string.Format("Overbooked by {0} beds", availableBeds * -1);
                }
            }
            this.EnableModelDialog(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Populates the wards.
        /// </summary>
        void PopulateWards()
        {
            IWardsMaster wardMaster = (IWardsMaster)ObjectFactory.CreateInstance("BusinessProcess.Administration.BWardMaster, BusinessProcess.Administration");
            var          wards      = wardMaster.GetWards(this.FacilityID)
                                      .Where(wd => wd.Active == true && wd.PatientCategory.ToLower() == this.PatientWardCategory.ToLower() || wd.PatientCategory.ToLower() == "all" || this.OpenMode == "EDIT")
                                      .OrderBy(wd => wd.WardName);

            ddlPatientWard.Items.Clear();
            ddlPatientWard.Items.Add(new ListItem("Select", "-1"));
            foreach (PatientWard wd in wards)
            {
                ddlPatientWard.Items.Add(new ListItem(string.Format("{0}  ({1})", wd.WardName, wd.Capacity - wd.Occupancy), wd.WardID.ToString()));
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Populates the ward list.
 /// </summary>
 void PopulateWardList()
 {
     try
     {
         IWardsMaster       wardMaster = (IWardsMaster)ObjectFactory.CreateInstance("BusinessProcess.Administration.BWardMaster, BusinessProcess.Administration");
         List <PatientWard> wards      = wardMaster.GetWards(this.LocationID);
         gridWardList.DataSource = wards;
         gridWardList.DataBind();
     }
     catch (Exception ex)
     {
         this.showErrorMessage(ref ex);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Populates the wards.
        /// </summary>
        void PopulateWards(int selectedWard = -1)
        {
            IWardsMaster wardMaster = (IWardsMaster)ObjectFactory.CreateInstance("BusinessProcess.Administration.BWardMaster, BusinessProcess.Administration");
            var          wards      = wardMaster.GetWards(this.LocationID).Where(wd => wd.Active == true).OrderBy(wd => wd.WardName);

            ddlPatientWard.Items.Clear();
            if (selectedWard == -1)
            {
                int.TryParse(ddlPatientWard.SelectedValue.ToString(), out selectedWard);
            }
            foreach (PatientWard wd in wards)
            {
                ddlPatientWard.Items.Add(new ListItem(string.Format("{0}  ({1})", wd.WardName, wd.Capacity - wd.Occupancy), wd.WardID.ToString()));
            }
            int wardCount = ddlPatientWard.Items.Count;
            //Defect - Redmine #567
            ListItem item = new ListItem("All wards", "0");

            ddlPatientWard.Items.Insert(0, item);
            if (wardCount > 1)
            {
                // ddlPatientWard.Items.Add(new ListItem("All wards", "0"));
                //ListItem item = new ListItem("All wards", "0");
                //ddlPatientWard.Items.Insert(0, item);
            }
            else if (wardCount == 1)
            {
                ddlPatientWard.SelectedIndex = 0;
            }
            else
            {
                ListItem selectedItem = ddlPatientWard.Items.FindByValue(selectedWard.ToString());
                if (selectedItem != null)
                {
                    selectedItem.Selected = true;
                }
            }
        }