コード例 #1
0
 /// <summary>
 /// Saves the admission.
 /// </summary>
 /// <param name="WardID">The ward identifier.</param>
 /// <param name="UserID">The user identifier.</param>
 /// <param name="PatientID">The patient identifier.</param>
 /// <param name="AdmissionDate">The admission date.</param>
 /// <param name="ExpectedDischargeDate">The expected discharge date.</param>
 /// <param name="AdmissionID">The admission identifier.</param>
 /// <exception cref="System.NotImplementedException"></exception>
 ///  //(int WardID, int UserID, int PatientID, DateTime AdmissionDate, DateTime? ExpectedDischargeDate, int? AdmissionID = null)
 public string SaveAdmission(WardAdmission admission, int UserID)
 {
     lock (this)
     {
         try
         {
             ClsUtility.Init_Hashtable();
             ClsObject itemManager = new ClsObject();
             ClsUtility.AddExtendedParameters("@WardID", SqlDbType.Int, admission.WardID);
             ClsUtility.AddExtendedParameters("@AdmittedBy", SqlDbType.Int, admission.AdmittedBy);
             ClsUtility.AddExtendedParameters("@UserID", SqlDbType.Int, UserID);
             ClsUtility.AddExtendedParameters("@PatientID", SqlDbType.Int, admission.PatientID);
             ClsUtility.AddExtendedParameters("@AdmissionDate", SqlDbType.DateTime, admission.AdmissionDate.ToString("dd-MMM-yyyy"));
             //   ClsUtility.AddExtendedParameters("@AdmissionNumber", SqlDbType.VarChar, admission.AdmissionNumber);
             ClsUtility.AddExtendedParameters("@ReferredFrom", SqlDbType.VarChar, admission.ReferredFrom);
             ClsUtility.AddExtendedParameters("@BedNumber", SqlDbType.VarChar, admission.BedNumber);
             ClsUtility.AddExtendedParameters("@Active", SqlDbType.Bit, admission.Active);
             if (admission.AdmissionID.HasValue)
             {
                 ClsUtility.AddExtendedParameters("@AdmissionID", SqlDbType.Int, admission.AdmissionID.Value);
             }
             if (admission.ExpectedDischarge.HasValue)
             {
                 ClsUtility.AddExtendedParameters("@ExpectedDischargeDate", SqlDbType.DateTime, admission.ExpectedDischarge.Value.ToString("dd-MMM-yyyy"));
             }
             DataTable dt = (DataTable)itemManager.ReturnObject(ClsUtility.theParams, "pr_Wards_SaveAdmission", ClsDBUtility.ObjectEnum.DataTable);
             return(dt.Rows[0][0].ToString());
         }
         catch
         {
             throw;
         }
     }
 }
コード例 #2
0
 /// <summary>
 /// Handles the RowDataBound event of the gridAdmission 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 gridAdmission_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         WardAdmission rowView    = (WardAdmission)e.Row.DataItem;
         string        discharged = rowView.Discharged ? "Yes" : "No";
         e.Row.Cells[6].Text = discharged;
         if (!rowView.Discharged)
         {
             TextBox dichargeText = e.Row.FindControl("textDischargeDate") as TextBox;
             if (dichargeText != null)
             {
                 dichargeText.Text = DateTime.Now.ToString("dd-MMM-yyyy");
             }
             Button btn = e.Row.FindControl("buttonDischarge") as Button;
             if (btn != null)
             {
                 //id, date,status
                 btn.OnClientClick = string.Format("javascript:showDiag('{0}','{1}','{2}');return false;"
                                                   , rowView.AdmissionID
                                                   , rowView.AdmissionDate.ToString("dd-MMM-yyyy")
                                                   , discharged);
             }
         }
     }
 }
コード例 #3
0
 /// <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
 }
コード例 #4
0
        /// <summary>
        /// Handles the Click event of the buttonAdmit control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void buttonAdmit_Click(object sender, EventArgs e)
        {
            try
            {
                this.EnableModelDialog(true);
                //todo validation;
                if (ddlPatientWard.SelectedIndex == -1)
                {
                    throw new Exception("Please select the ward");
                }
                int wardId = int.Parse(ddlPatientWard.SelectedValue);
                if (wardId == -1)
                {
                    throw new Exception("Please select the ward");
                }

                if (ddlReferral.SelectedValue == "")
                {
                    throw new Exception("Please specify where patient has been referred from");
                }
                if (textBedNumber.Text.Trim() == "")
                {
                    throw new Exception("Bed number cannot be blank");
                }
                DateTime dateAdmitted = DateTime.Now;
                if (!string.IsNullOrEmpty(textAdmissionDate.Value))
                {
                    dateAdmitted = Convert.ToDateTime(textAdmissionDate.Value);
                }
                else
                {
                    throw new Exception("Admission date cannot be blank");
                }
                if (dateAdmitted > DateTime.Now)
                {
                    throw new Exception("Admission date cannot be greater than today");
                }
                DateTime?expectedDOD = null;
                if (!string.IsNullOrEmpty(textExpectedDOD.Value.Trim()))
                {
                    expectedDOD = Convert.ToDateTime(textExpectedDOD.Value.Trim());
                }

                if (expectedDOD.HasValue && expectedDOD.Value < dateAdmitted)
                {
                    throw new Exception("Expected date of discharge cannot be before than the admission date");
                }

                string admissionNumber = "";
                //if (!chkAutoCode.Checked)
                //    admissionNumber = textAdmissionNumber.Text.Trim();
                string referredFrom = ddlReferral.SelectedItem.Text;
                string bedNumber    = textBedNumber.Text.Trim();
                //eo validation
                WardAdmission admission = new WardAdmission()
                {
                    WardID            = wardId,
                    AdmissionDate     = dateAdmitted,
                    AdmissionNumber   = admissionNumber,
                    ReferredFrom      = referredFrom,
                    BedNumber         = bedNumber,
                    AdmittedBy        = this.UserID,
                    PatientID         = this.PatientID,
                    Active            = true,
                    ExpectedDischarge = expectedDOD,
                    AdmissionID       = this.AdmissionID
                };
                IWardsMaster wardMaster = (IWardsMaster)ObjectFactory.CreateInstance("BusinessProcess.Administration.BWardMaster, BusinessProcess.Administration");
                admissionNumber = wardMaster.SaveAdmission(admission, this.UserID);

                var list = new List <KeyValuePair <string, string> >();
                list.Add(new KeyValuePair <string, string>("Message", "Patient admission is completed."));
                list.Add(new KeyValuePair <string, string>("Title", "Patient Admission"));
                list.Add(new KeyValuePair <string, string>("errorFlag", "false"));
                this.EnableModelDialog(false);
                this.OnNotifyCommand(this, new CommandEventArgs("Notify", list));
            }
            catch (Exception ex)
            {
                this.EnableModelDialog(true);
                this.errorLabel.Text = ex.Message;
                this.IsError         = true;
                this.DataBind();
                //this.OnErrorOccured(this, new CommandEventArgs("Error", ex));
            }
        }