/// <summary>
        /// Deletes the patient.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void DeleteSelectedPatient(object sender, EventArgs e)
        {
            IDeletePatient FormManager;

            FormManager = (IDeletePatient)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDeletePatient, BusinessProcess.Administration");
            int theResultRow = FormManager.DeletePatient(this.PatientId, this.UserId);

            if (theResultRow == 0)
            {
                string errorMessage = IQCareMsgBox.GetMessage("DeletePatientError", this);
                this.NotifyAction(errorMessage, "Patient Delete Error", true, string.Format("javascript:return false;", "../frmFacilityHome.aspx"));
            }
            else
            {
                string strResponse = labelDeleteText.Text.Replace("Delete all records for ", "") + " has been deleted successfully";
                this.NotifyAction(strResponse, "Patient Delete", false, string.Format("javascript:window.location='{0}'; return false;", "../frmFacilityHome.aspx"));
            }
        }
    private void deletePatient()
    {
        //*******Delete the patient on the basis of patient id ********//
        IDeletePatient FormManager;

        FormManager = (IDeletePatient)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDeletePatient, BusinessProcess.Administration");
        int theResultRow = FormManager.DeletePatient(Convert.ToInt32(PatientId), Convert.ToInt32(ViewState["UserID"]));

        if (theResultRow == 0)
        {
            IQCareMsgBox.Show("DeletePatientError", this);
            return;
        }
        else
        {
            string theUrl;
            theUrl = string.Format("{0}?mnuClicked={1}", "../frmFindAddPatient.aspx", "DeletePatient");;
            Response.Redirect(theUrl);
        }
    }