Exemplo n.º 1
0
 /// <summary>
 /// Saves the ward.
 /// </summary>
 /// <param name="Ward">The ward.</param>
 /// <param name="UserID">The user identifier.</param>
 /// <exception cref="System.NotImplementedException"></exception>
 public void SaveWard(PatientWard Ward, int UserID)
 {
     lock (this)
     {
         try
         {
             ClsUtility.Init_Hashtable();
             ClsObject itemManager = new ClsObject();
             if (Ward.WardID.HasValue)
             {
                 ClsUtility.AddExtendedParameters("@WardID", SqlDbType.Int, Ward.WardID.Value);
             }
             ClsUtility.AddExtendedParameters("@UserID", SqlDbType.Int, UserID);
             ClsUtility.AddParameters("@WardName", SqlDbType.VarChar, Ward.WardName);
             ClsUtility.AddExtendedParameters("@Capacity", SqlDbType.Int, Ward.Capacity);
             ClsUtility.AddExtendedParameters("@LocationID", SqlDbType.Int, Ward.LocationID);
             ClsUtility.AddParameters("@PatientCategory", SqlDbType.VarChar, Ward.PatientCategory);
             ClsUtility.AddExtendedParameters("@Active", SqlDbType.Bit, Ward.Active);
             itemManager.ReturnObject(ClsUtility.theParams, "pr_Wards_Save", ClsDBUtility.ObjectEnum.ExecuteNonQuery);
         }
         catch
         {
             throw;
         }
     }
 }
        /// <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);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handles the RowDataBound event of the gridWardList control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridViewRowEventArgs"/> instance containing the event data.</param>
        protected void gridWardList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(gridWardList, "RowClick$" + e.Row.RowIndex.ToString(), false));

                PatientWard rowView = (PatientWard)e.Row.DataItem;
                string      status  = rowView.Active? "Active" :"Inactive";
                e.Row.Cells[3].Text = status;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Saves the ward.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void SaveWard(object sender, EventArgs e)
        {
            string errorMessage = "";
            string actionType   = ActionType.ToUpper().Trim();
            bool   haserror     = false;

            if (string.IsNullOrEmpty(textWardName.Text.Trim()))
            {
                haserror      = true;
                errorMessage += "Missing: Ward Name";
            }
            if (string.IsNullOrEmpty(textCapacity.Text.Trim()))
            {
                haserror      = true;
                errorMessage += "<br /> Missing: Bed capacity";
            }
            if (ddlPatientCategory.SelectedValue == "")
            {
                haserror      = true;
                errorMessage += "<br /> Missing: Ward's patient category";
            }
            if (haserror)
            {
                // isError = true;
                errorLabel.Text    = errorMessage;
                panelError.Visible = true;
                mpeWardPopup.Show();
                //parameterPopup.Show();
                return;
            }
            try
            {
                //database action
                IWardsMaster wardMaster = (IWardsMaster)ObjectFactory.CreateInstance("BusinessProcess.Administration.BWardMaster, BusinessProcess.Administration");
                PatientWard  ward       = new PatientWard()
                {
                    WardID          = this.ActionType == "EDIT"? this.SelectedWardID : null,
                    WardName        = textWardName.Text.Trim(),
                    Active          = rblStatus.SelectedValue == "1",
                    Capacity        = int.Parse(textCapacity.Text),
                    PatientCategory = ddlPatientCategory.SelectedValue,
                    LocationID      = this.LocationID
                };
                wardMaster.SaveWard(ward, this.UserID);
                this.PopulateWardList();
                this.ActionType = "VIEW";
            }
            catch (Exception ex)
            {
                this.NotifyAction(string.Format("{0} {1} ", actionType, ex.Message), "Error occurred ..", true);
                this.ActionType = "VIEW";
            }
        }