コード例 #1
0
ファイル: LabOrderForm.aspx.cs プロジェクト: wamathaga/IQCare
    private void TechnicalAreaIdentifier()
    {
        int          intmoduleID = Convert.ToInt32(Session["TechnicalAreaId"]);
        IPatientHome PatientHome = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");

        System.Data.DataSet DSTab = PatientHome.GetTechnicalAreaIdentifierFuture(intmoduleID, Convert.ToInt32(Session["PatientId"]));

        if (DSTab.Tables[0].Rows.Count > 0)
        {
            if (DSTab.Tables[0].Rows.Count > 0)
            {
                //thePnlIdent.Controls.Add(new LiteralControl("<td class='bold pad18' style='width: 25%'>"));
                Label theLabelIdentifier1 = new Label();
                theLabelIdentifier1.ID = "Lbl_" + DSTab.Tables[0].Rows[0][0].ToString();
                int i = 0;
                foreach (DataRow DRLabel in DSTab.Tables[0].Rows)
                {
                    foreach (DataRow DRLabel1 in DSTab.Tables[1].Rows)
                    {
                        theLabelIdentifier1.Text = theLabelIdentifier1.Text + "    " + DRLabel[0].ToString() + " : " + DRLabel1[i].ToString();
                    }
                    i++;
                }


                thePnlIdent.Controls.Add(theLabelIdentifier1);
            }
        }
    }
コード例 #2
0
        public static DataTable GetModuleForms(int locationId, int moduleId)
        {
            IPatientHome ptmhm   = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");
            DataTable    dtForms = ptmhm.GetModuleForms(moduleId, locationId);

            return(dtForms);
        }
コード例 #3
0
    //private void Load_MenuPartial(int PatientId, string Status,int CountryId)
    //{
    //    ICustomForm CustomFormMgr = (ICustomForm)ObjectFactory.CreateInstance(ObjFactoryParameter);
    //    DataSet theDS = CustomFormMgr.GetFormName(1, CountryId);
    //    foreach (DataRow dr in theDS.Tables[0].Rows)
    //    {
    //        //string theURL = string.Format("{0}&PatientId={1}&FormID={2}&sts={3}", "../ClinicalForms/frmClinical_CustomForm.aspx?name=Add", PatientId.ToString(), dr["FeatureID"].ToString(), Status);
    //        string theURL = string.Format("{0}", "../ClinicalForms/frmClinical_CustomForm.aspx?");

    //        if (Status == "0")
    //            divPMTCT.Controls.Add(new LiteralControl("<a class ='menuitem2' id ='mnu" + dr["FormID"] + "' onClick=fnSetformID('" + dr["FeatureID"].ToString() + "'); HRef=" + theURL + " runat='server'>" + dr["FeatureName"] + "</a>"));
    //        else
    //            divPMTCT.Controls.Add(new LiteralControl("<a class ='menuitem2' id ='mnu" + dr["FormID"] + "' onClick=fnSetformID('" + dr["FeatureID"].ToString() + "'); runat='server'>" + dr["FeatureName"] + "</a>"));
    //    }

    //}

    private void Load_MenuRegistration()
    {
        int    ModuleId = Convert.ToInt32(Session["TechnicalAreaId"]);
        string theURL   = "";


        IPatientHome PatientHome = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");
        DataSet      theDS       = PatientHome.GetTechnicalAreaandFormName(ModuleId);

        //if (theDS.Tables[0].Rows[0]["ModuleName"].ToString() == "HIVCARE-STATIC FORM")
        //{
        //    mnuPMTCTEnrol.Visible = false;
        //}
        //else { mnuEnrolment.Visible = false; }

        if (ModuleId == 2)
        {
            mnuPMTCTEnrol.Visible = true;
            mnuEnrolment.Visible  = true;
        }
        else
        {
            mnuPMTCTEnrol.Visible = true;
            mnuEnrolment.Visible  = false;
        }
    }
コード例 #4
0
        public PatientService(CurrentSession session, int patientId, int moduleId)
        {
            int locationId, userId;

            locationId = session.Facility.Id;
            patientId  = Convert.ToInt32(HttpContext.Current.Session["patientId"]);
            userId     = session.User.Id;
            IPatientHome pHome = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");

            CurrentPatient     = pHome.GetPatientById(patientId);
            CurrentServiceArea = session.Facility.Modules.Where(m => m.Id == moduleId).FirstOrDefault();

            if (CurrentServiceArea != null && CurrentServiceArea.Clinical)
            {
                Formset         = this.GetFormsForPatientAndModule(locationId, moduleId, userId, this.CurrentPatient);
                FormUrl         = StaticFormMap.FormUrl;
                this.formLoaded = true;
            }
            else
            {
                this.formLoaded = false;
                Formset         = null;
                FormUrl         = null;
            }
        }
コード例 #5
0
        public PatientService(int patientId)
        {
            //patientId = Convert.ToInt32(HttpContext.Current.Session["patientId"]);

            IPatientHome pHome = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");

            CurrentPatient = pHome.GetPatientById(patientId);
        }
コード例 #6
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            IPatientHome WListManager = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");

            WListManager.SavePatientWaitList((DataTable)Session["dtWaitingList"], Convert.ToInt32(Session["WLTechnicalArea"]), Convert.ToInt32(base.Session["AppUserId"]), Convert.ToInt32(HttpContext.Current.Session["WLPatientID"]));

            IQCareMsgBox.Show("Successfully saved ", "!", "", this);
            ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
        }
コード例 #7
0
    private DataSet PatientSummary()
    {
        IPatientHome ReportDetails    = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome,BusinessProcess.Clinical");
        DataSet      dsPatientSummary = (DataSet)ReportDetails.GetPatientSummaryInformation(Convert.ToInt32(Session["PatientId"]), Convert.ToInt32(Session["TechnicalAreaId"]));

        ReportDetails = null;
        dsPatientSummary.WriteXmlSchema(Server.MapPath("..\\XMLFiles\\PatientClinicalSummary.xml"));
        return(dsPatientSummary);
    }
コード例 #8
0
        /// <summary>
        /// Gets the forms for patient and module.
        /// </summary>
        /// <param name="locationId">The location identifier.</param>
        /// <param name="moduleId">The module identifier.</param>
        /// <param name="userId">The user identifier.</param>
        /// <param name="patientAge">The patient age.</param>
        /// <param name="patientSex">The patient sex.</param>
        /// <returns></returns>
        DataTable GetFormsForPatientAndModule(int locationId, int moduleId, int userId, Patient patient)
        {
            IPatientHome         ptmhm   = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");
            List <StaticFormMap> formMap = StaticFormMap.FormUrl;
            DataTable            dtForms = ptmhm.GetModuleForms(moduleId, locationId);

            List <FormRule> formRules = ptmhm.GetModuleFormsBusinessRule(moduleId, null, null);
            DataTable       dt        = this.ApplyBusinessRuleOnFormSet(ref dtForms, ref formRules, patient.Age, patient.Sex);

            //dtForms.DefaultView.ToTable();
            if (moduleId == 1 && patient.Age < 2) //pmtct
            {
                // to do move this to the model configuration, rules per forms and modules
                //remove ccc and anc forms if the patientage < 2 years
                //CCC_INITIAL_FOLLOWUP
                //ART_HISTORY
                //ART_THERAPY
                //ICF
                //ANC_Register_MOH_405
                //Postnatal_Register_MOH_406
                dt.DefaultView.RowFilter = "ReferenceId Not In('CCC_INITIAL_FOLLOWUP','ART_HISTORY','ART_THERAPY','ICF','ANC_Register_MOH_405','Postnatal_Register_MOH_406')";
            }

            DataTable dtFilterd = dt.DefaultView.ToTable();

            dtFilterd.Columns.Add(new DataColumn("Url", Type.GetType("System.String")));
            dtFilterd.Columns["Url"].DefaultValue = "";
            dtFilterd.AcceptChanges();
            foreach (DataRow row in dtFilterd.Rows)
            {
                if (!Convert.ToBoolean(row["Custom"]))
                {
                    StaticFormMap map = formMap.Where(m => m.ReferenceId == row["ReferenceId"].ToString()).FirstOrDefault();
                    if (map != null)
                    {
                        row["Url"] = string.Format("{0}?|{1}", map.Url, row["FeatureId"].ToString());
                    }
                    else
                    {
                        row["Deleted"] = 1;
                    }
                }
                else if (row["Code"].ToString() == "CARE_END")
                {
                    row["Url"] = string.Format("{0}|{1}", "~/Scheduler/frmScheduler_ContactCareTracking.aspx?", row["FeatureId"].ToString());
                }
                else
                {
                    row["Url"] = string.Format("~/ClinicalForms/CustomForm.aspx?|{0}", row["FeatureId"].ToString());
                }
                row.AcceptChanges();
            }
            dtFilterd.DefaultView.RowFilter = "Deleted <> 1";
            this.formLoaded = true;
            return(dtFilterd.DefaultView.ToTable());
        }
コード例 #9
0
        //private void NotifyAction(string strMessage, string strTitle, bool errorFlag, string onOkScript = "")
        //{
        //    lblNoticeInfo.Text = strMessage;
        //    lblNotice.Text = strTitle;
        //    lblNoticeInfo.ForeColor = (errorFlag) ? System.Drawing.Color.DarkRed : System.Drawing.Color.DarkGreen;
        //    lblNoticeInfo.Font.Bold = true;
        //    imgNotice.ImageUrl = (errorFlag) ? "~/images/mb_hand.gif" : "~/images/mb_information.gif";
        //    btnOkAction.OnClientClick = "";
        //    if (onOkScript != "")
        //    {
        //        btnOkAction.OnClientClick = onOkScript;
        //    }
        //    this.notifyPopupExtender.Show();
        //}
        /// <summary>
        /// Loads the patients wait list.
        /// </summary>
        /// <param name="patientID">The patient identifier.</param>
        private void LoadPatientsWaitList(int patientID)
        {
            IPatientHome PManager = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");

            System.Data.DataTable theDt = PManager.GetPatientWaitList(patientID);

            grdWaitingList.DataSource = theDt;
            Session["dtWaitingList"]  = theDt;
            grdWaitingList.DataBind();
        }
コード例 #10
0
        private void openPatientDetails(int patientID)
        {
            HttpContext.Current.Session["PatientId"]         = patientID;
            HttpContext.Current.Session["PatientVisitId"]    = 0;
            HttpContext.Current.Session["ServiceLocationId"] = 0;
            HttpContext.Current.Session["LabId"]             = 0;

            /* Session["TechnicalAreaName"] = null;
             * Session["TechnicalAreaId"] = 0;*/


            #region "Refresh Patient Records"
            IPatientHome        PManager = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");
            System.Data.DataSet thePDS   = PManager.GetPatientDetails(Convert.ToInt32(HttpContext.Current.Session["PatientId"]), Convert.ToInt32(HttpContext.Current.Session["SystemId"]), Convert.ToInt32(HttpContext.Current.Session["TechnicalAreaId"]));


            HttpContext.Current.Session["PatientInformation"] = thePDS.Tables[0];
            #endregion
            string theUrl = "";
            if (Request.QueryString["srvNm"] == "Records")
            {
                Session["TechnicalAreaName"] = "Records";
                theUrl = string.Format("{0}", "./frmAddTechnicalArea.aspx");
                Response.Redirect(theUrl);
            }
            else
            {
                //Check if the patient is enrolled and go directly to patient home page if patient is enrolled
                IPatientRegistration PatRegMgr = (IPatientRegistration)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientRegistration, BusinessProcess.Clinical");
                DataSet theDS = PatRegMgr.GetFieldNames(int.Parse(Request.QueryString["mod"]), Convert.ToInt32(Session["PatientId"]));
                if (theDS.Tables[3].Rows.Count > 0)//check if patient is care ended for reenrollment
                {
                    //theUrl = string.Format("{0}?PatientId={1}&mod={2}", "./frmAddTechnicalArea.aspx", patientID, Request.QueryString["mod"]);

                    /*
                     * Code is commented for Care end patient, when patient is under Care End It should redirected to patient home page.
                     * Dated: 14 jan 2015
                     */

                    //theUrl = string.Format("{0}?mod={1}", "./frmAddTechnicalArea.aspx", Request.QueryString["mod"]);
                    theUrl = "./ClinicalForms/frmPatient_Home.aspx";
                }
                else if (theDS.Tables[2].Rows.Count > 0 && theDS.Tables[2].Rows[0]["StartDate"].ToString() != "")
                {
                    theUrl = "./ClinicalForms/frmPatient_Home.aspx";
                }
                else
                {
                    //theUrl = string.Format("{0}?PatientId={1}&mod={2}", "./frmAddTechnicalArea.aspx", patientID, Request.QueryString["mod"]);
                    theUrl = string.Format("{0}?mod={1}", "./frmAddTechnicalArea.aspx", Request.QueryString["mod"]);
                }
                Response.Redirect(theUrl, false);
            }
        }
コード例 #11
0
        /// <summary>
        /// Handles the Load event of the Page 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 Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            Session["dtWaitingList"]       = null;
            Session["WLTechnicalArea"]     = null;
            Session["WLTechnicalAreaName"] = null;
            Session["WLPatientID"]         = 0;
            String pID = Session["PatientId"].ToString();

            if (pID == "0")
            {
                pID = Request.QueryString["PID"];
            }
            if (Session["PatientInformation"] == null)
            {
                IPatientHome PatientManager = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");
                //System.Data.DataSet theDS = PatientManager.GetPatientDetails(Convert.ToInt32(Session["PatientId"]), Convert.ToInt32(Session["SystemId"]));
                System.Data.DataSet theDS = PatientManager.GetPatientDetails(Convert.ToInt32(pID), Convert.ToInt32(Session["SystemId"]), Convert.ToInt32(Session["TechnicalAreaId"]));
                PatientManager = null;
                Session["PatientInformation"] = theDS.Tables[0];
            }
            BindQueues();
            DataTable dtPatientInfo = (DataTable)Session["PatientInformation"];

            if (dtPatientInfo != null)
            {
                lblname.Text = String.Format("{0}, {1}", dtPatientInfo.Rows[0]["LastName"], dtPatientInfo.Rows[0]["FirstName"]);

                lblIQnumber.Text = dtPatientInfo.Rows[0]["IQNumber"].ToString();
                if (Request.QueryString["srvNm"] != null)
                {
                    lblTechnicalArea.Text          = Request.QueryString["srvNm"];
                    Session["WLTechnicalArea"]     = Request.QueryString["mod"];
                    Session["WLTechnicalAreaName"] = Request.QueryString["srvNm"];
                    Session["WLPatientID"]         = Request.QueryString["PID"];
                }
                else
                {
                    lblTechnicalArea.Text          = Session["TechnicalAreaName"].ToString();
                    Session["WLTechnicalArea"]     = Session["TechnicalAreaId"];
                    Session["WLTechnicalAreaName"] = Session["TechnicalAreaName"];
                    Session["WLPatientID"]         = HttpContext.Current.Session["PatientId"];
                }

                LoadPatientsWaitList(Convert.ToInt32(HttpContext.Current.Session["WLPatientID"]));
            }
        }
コード例 #12
0
    private void setReport()
    {
        rptDocument = new ReportDocument();
        IQCareUtils  theUtil       = new IQCareUtils();
        IPatientHome ReportDetails = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome,BusinessProcess.Clinical");
        DataSet      theDS         = (DataSet)ReportDetails.GetPatientSummaryInformation(Convert.ToInt32(Session["PatientId"]), Convert.ToInt32(Session["TechnicalAreaId"]));

        Session["dsPatientClinicalsummary"] = theDS;
        theDS.WriteXmlSchema(Server.MapPath("..\\XMLFiles\\PatientClinicalSummary.xml"));
        ReportDetails = null;

        theReportSource = "rptPatientClinicalSummary.rpt";
        rptDocument.Load(Server.MapPath(theReportSource));
        rptDocument.SetDataSource(theDS);
        crViewer.ReportSource = rptDocument;
        crViewer.DataBind();
        crViewer.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
    }
コード例 #13
0
        private void frmPatientClinicalSummary_Load(object sender, EventArgs e)
        {
            //rptDocument = new ReportDocument();
            //IQCareUtils theUtil = new IQCareUtils();
            //IPatientHome ReportDetails = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome,BusinessProcess.Clinical");
            //DataSet theDS = (DataSet)ReportDetails.GetPatientSummaryInformation(GblIQCare.patientID, GblIQCare.ModuleId);
            //string filename = GblIQCare.GetXMLPath() + "PatientClinicalSummary.xml";
            //System.IO.FileStream myFileStream = new System.IO.FileStream(filename, System.IO.FileMode.Create);
            //System.Xml.XmlTextWriter MyXmlTextWriter = new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicode);
            //theDS.WriteXmlSchema(MyXmlTextWriter);
            //MyXmlTextWriter.Close();
            //ReportDetails = null;

            //theReportSource = GblIQCare.GetReportPath() + "rptPatientClinicalSummary.rpt";
            //rptDocument.Load(theReportSource);
            //rptDocument.SetDataSource(theDS);
            //crViewer.ReportSource = rptDocument;
            //crViewer.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;

            rptDocument = new ReportDocument();
            IQCareUtils  theUtil       = new IQCareUtils();
            IPatientHome ReportDetails = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome,BusinessProcess.Clinical");
            DataSet      theDS         = (DataSet)ReportDetails.GetPatientSummaryInformation(GblIQCare.patientID, GblIQCare.ModuleId);

            theDS.WriteXmlSchema(GblIQCare.GetXMLPath() + "\\PatientClinicalSummary.xml");

            rptPatientClinicalSummary rep = new rptPatientClinicalSummary();

            rep.SetDataSource(theDS);
            frmReportViewer theRepViewer = new frmReportViewer();

            theRepViewer.MdiParent              = this.MdiParent;
            theRepViewer.Location               = new Point(0, 0);
            theRepViewer.crViewer.ReportSource  = rep;
            theRepViewer.crViewer.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
            theRepViewer.Width             = 902;
            theRepViewer.Height            = 650;
            theRepViewer.crViewer.Width    = 880;
            theRepViewer.crViewer.Height   = 600;
            theRepViewer.crViewer.Location = new Point(11, 11);
            theRepViewer.btnExit_position(451, 615);
            theRepViewer.Show();
            this.Close();
        }
コード例 #14
0
    private void setReport()
    {
        rptDocument = new ReportDocument();

        IPatientHome ReportDetails           = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome,BusinessProcess.Clinical");
        DataSet      dsReportsPatientProfile = (DataSet)ReportDetails.GetPatientSummaryInformation(Convert.ToInt32(Session["PatientId"]), Convert.ToInt32(Session["TechnicalAreaId"]));

        Session["dsPatientClinicalsummary"] = dsReportsPatientProfile;
        dsReportsPatientProfile.WriteXmlSchema(Server.MapPath("..\\XMLFiles\\PatientClinicalSummary.xml"));


        ReportDetails = null;

        //theReportSource = "rptPatientClinicalSummary.rpt";
        //theReportSource = "cr_PatientProfileSummary_New.rpt";
        theReportSource = "rptPatientProfile.rpt";
        rptDocument.Load(Server.MapPath(theReportSource));

        rptDocument.SetDataSource(dsReportsPatientProfile);
        rptDocument.SetParameterValue("SatelliteId", Session["AppSatelliteId"].ToString());
        crViewer.ReportSource  = rptDocument;
        crViewer.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
    }
コード例 #15
0
        /// <summary>
        /// Handles the Click event of the btnSubmit 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 btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                //Revist Date.
                DateTime now = DateTime.Now;
                //Entry point
                int moduleID = Convert.ToInt32(Session["WLTechnicalArea"]);

                int patientID = Convert.ToInt32(HttpContext.Current.Session["WLPatientID"]);
                //UserID
                IPatientHome pMGR;
                pMGR = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");
                pMGR.SavePatientRevisit(now, this.RevistHrsAllowance, moduleID, this.UserId, patientID, this.LocationId);
            }
            catch //(Exception err)
            {
                // MsgBuilder theBuilder = new MsgBuilder();
                // theBuilder.DataElements["MessageText"] = err.Message.ToString();
                // IQCareMsgBox.Show("#C1", theBuilder, this);
            }
            try
            {
                IPatientHome WListManager = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");

                WListManager.SavePatientWaitList((DataTable)Session["dtWaitingList"],
                                                 Convert.ToInt32(Session["WLTechnicalArea"]),
                                                 Convert.ToInt32(base.Session["AppUserId"]),
                                                 Convert.ToInt32(HttpContext.Current.Session["WLPatientID"]));

                IQCareMsgBox.Show("Successfully saved ", "!", "", this);
            }
            catch (Exception ex)
            {
                IQCareMsgBox.Show("Error Occurred " + ex.Message, "!", "", this);
            }
        }
コード例 #16
0
    private void Init_Menu()
    {
        IPatientHome PatientHome = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");
        int          ModuleId    = Convert.ToInt32(Session["TechnicalAreaId"]);
        DataSet      theDS       = PatientHome.GetTechnicalAreaandFormName(ModuleId);

        ViewState["AddForms"] = theDS;

        if (Convert.ToInt32(Session["PatientId"]) != 0)
        {
            PatientId = Convert.ToInt32(Session["PatientId"]);
        }

        if (PatientId == 0)
        {
            PatientId = Convert.ToInt32(Session["PatientId"]);
        }

        if (Session["AppUserID"].ToString() == "")
        {
            IQCareMsgBox.Show("SessionExpired", this);
            Response.Redirect("frmLogOff.aspx");
        }

        lblversion.Text = AuthenticationManager.AppVersion;
        lblrelDate.Text = AuthenticationManager.ReleaseDate;

        DataTable dtPatientInfo = (DataTable)Session["PatientInformation"];

        if (dtPatientInfo != null && dtPatientInfo.Rows.Count > 0)
        {
            PMTCTNos = dtPatientInfo.Rows[0]["ANCNumber"].ToString() + dtPatientInfo.Rows[0]["PMTCTNumber"].ToString() + dtPatientInfo.Rows[0]["AdmissionNumber"].ToString() + dtPatientInfo.Rows[0]["OutpatientNumber"].ToString();
            ARTNos   = dtPatientInfo.Rows[0]["PatientEnrollmentId"].ToString();
        }
        ////DataTable theDT1 = (DataTable)Session["AppModule"];
        ////DataView theDV = new DataView(theDT1);

        //################  Master Settings ###################
        string UserID = "";

        if (Session["AppUserID"].ToString() != null)
        {
            UserID = Session["AppUserId"].ToString();
        }
        if (Session["AppUserName"].ToString() != null)
        {
            lblUserName.Text = Session["AppUserName"].ToString();
        }
        if (Session["AppLocation"].ToString() != null)
        {
            lblLocation.Text = Session["AppLocation"].ToString();
        }

        IIQCareSystem AdminManager;

        AdminManager = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security");
        if (Session["AppDateFormat"].ToString() != null)
        {
            lblDate.Text = AdminManager.SystemDate().ToString(Session["AppDateFormat"].ToString());
        }

        //######################################################

        string theUrl;

        //////if (lblpntStatus.Text == "0")
        //////{
        if (Session["PtnPrgStatus"] != null)
        {
            DataTable theStatusDT       = (DataTable)Session["PtnPrgStatus"];
            DataTable theCEntedStatusDT = (DataTable)Session["CEndedStatus"];
            string    PatientExitReason = string.Empty;
            string    PMTCTCareEnded    = string.Empty;
            string    CareEnded         = string.Empty;
            if (theCEntedStatusDT.Rows.Count > 0)
            {
                PatientExitReason = Convert.ToString(theCEntedStatusDT.Rows[0]["PatientExitReason"]);
                PMTCTCareEnded    = Convert.ToString(theCEntedStatusDT.Rows[0]["PMTCTCareEnded"]);
                CareEnded         = Convert.ToString(theCEntedStatusDT.Rows[0]["CareEnded"]);
            }


            //if ((theStatusDT.Rows[0]["PMTCTStatus"].ToString() == "PMTCT Care Ended") || (Session["PMTCTPatientStatus"]!= null && Session["PMTCTPatientStatus"].ToString() == "1"))
            if ((Convert.ToString(theStatusDT.Rows[0]["PMTCTStatus"]) == "PMTCT Care Ended") || (PatientExitReason == "93" && PMTCTCareEnded == "1"))
            {
                PtnPMTCTStatus = 1;
                Session["PMTCTPatientStatus"] = 1;
            }
            else
            {
                PtnPMTCTStatus = 0;
                Session["PMTCTPatientStatus"] = 0;
                //LoggedInUser.PatientStatus = 0;
            }
            //if ((theStatusDT.Rows[0]["ART/PalliativeCare"].ToString() == "Care Ended") || (Session["HIVPatientStatus"]!= null && Session["HIVPatientStatus"].ToString() == "1"))
            if ((Convert.ToString(theStatusDT.Rows[0]["ART/PalliativeCare"]) == "Care Ended") || (PatientExitReason == "93" && CareEnded == "1"))
            {
                PtnARTStatus = 1;
                Session["HIVPatientStatus"] = 1;
            }
            else
            {
                PtnARTStatus = 0;
                Session["HIVPatientStatus"] = 0;
            }
        }
        //////}
        //else
        //{
        //    if (Session["PtnPrgStatus"] != null)
        //    {
        //        DataTable theStatusDT = (DataTable)Session["PtnPrgStatus"];
        //        if (theStatusDT.Rows[0]["PMTCTStatus"].ToString() == "PMTCT Care Ended")
        //        {
        //            PtnPMTCTStatus = 1;
        //            Session["PMTCTPatientStatus"] = 1;

        //        }
        //        else
        //        {
        //            PtnPMTCTStatus = 0;
        //            Session["PMTCTPatientStatus"] = 0;

        //        }
        //        if (theStatusDT.Rows[0]["ART/PalliativeCare"].ToString() == "Care Ended")
        //        {
        //            PtnARTStatus = 1;
        //            Session["HIVPatientStatus"] = 1;

        //        }
        //        else
        //        {
        //            PtnARTStatus = 0;
        //            Session["HIVPatientStatus"] = 0;

        //        }
        //    }


        //}

        if (lblpntStatus.Text == "0" && (PtnARTStatus == 0 || PtnPMTCTStatus == 0))
        //if (PtnARTStatus == 0 || PtnPMTCTStatus == 0)
        {
            if (PtnARTStatus == 0)
            {
                //########### Initial Evaluation ############
                //theUrl = string.Format("{0}&sts={1}", "../ClinicalForms/frmClinical_InitialEvaluation.aspx?name=Add", PtnARTStatus);
                theUrl           = string.Format("{0}", "../ClinicalForms/frmClinical_InitialEvaluation.aspx");
                mnuInitEval.HRef = theUrl;
                //########### ART-FollowUp ############
                //string theUrl18 = string.Format("{0}&sts={1}", "../ClinicalForms/frmClinical_ARTFollowup.aspx?name=Add", PtnARTStatus);
                string theUrl18 = string.Format("{0}", "../ClinicalForms/frmClinical_ARTFollowup.aspx");
                mnuFollowupART.HRef = theUrl18;
                //########### Non-ART Follow-Up #########
                string theUrl1 = string.Format("{0}", "../ClinicalForms/frmClinical_NonARTFollowUp.aspx");
                Session.Remove("ExixstDS1");
                mnuNonARTFollowUp.HRef = theUrl1;
                ////########### HIV Care/ART Encounter #########
                //string theUrl2 = string.Format("{0}", "../ClinicalForms/frmClinical_HIVCareARTCardEncounter.aspx");
                //mnuHIVCareARTEncounter.HRef = theUrl2;
                //########### Contact Tracking ############
                //theUrl = string.Format("{0}", "../Scheduler/frmScheduler_ContactCareTracking.aspx?");
                //mnuContactCare1.HRef = theUrl;
                //########### Patient Record ############
                theUrl = string.Format("{0}&PatientId={1}&sts={2}", "../ClinicalForms/frmClinical_PatientRecordCTC.aspx?name=Add", PatientId.ToString(), PtnARTStatus);
                //mnuPatientRecord.HRef = theUrl;
                //########### Adult Pharmacy ############
                //LoggedInUser.Program = "ART";
                //LoggedInUser.PatientPharmacyId = 0;
                theUrl = string.Format("{0}", "../Pharmacy/frmPharmacyForm.aspx?Prog=ART");
                //theUrl = string.Format("{0}", "../Pharmacy/frmPharmacy_Adult.aspx?Prog=ART");
                mnuAdultPharmacy.HRef = theUrl;
                //########### Pediatric Pharmacy ############
                //theUrl = string.Format("{0}", "../Pharmacy/frmPharmacy_Paediatric.aspx?Prog=ART");
                //mnuPaediatricPharmacy.HRef = theUrl;
                ////########### Pharmacy CTC###############
                theUrl = string.Format("{0}", "../Pharmacy/frmPharmacy_CTC.aspx?Prog=ART");
                //mnuPharmacyCTC.HRef = theUrl;
                //########### Laboratory ############
                theUrl = string.Format("{0}sts={1}", "../Laboratory/frmLabOrder.aspx?", PtnARTStatus);
                string theUrlLabOrder = string.Format("{0}&sts={1}", "../Laboratory/frmLabOrderTests.aspx?name=Add", PtnARTStatus);
                mnuLabOrder.HRef     = theUrl;
                mnuOrderLabTest.HRef = theUrlLabOrder;
                mnuOrderLabTest.Attributes.Add("onclick", "window.open('" + theUrlLabOrder + "','','toolbars=no,location=no,directories=no,dependent=yes,top=100,left=30,maximize=no,resize=no,width=1000,height=500,scrollbars=yes');return false;");
                //########### Home Visit ############
                ///theUrl = string.Format("{0}&PatientId={1}&sts={2}", "../Scheduler/frmScheduler_HomeVisit.aspx?name=Add", PatientId.ToString(), PtnARTStatus);
                theUrl            = string.Format("{0}", "../Scheduler/frmScheduler_HomeVisit.aspx");
                mnuHomeVisit.HRef = theUrl;
            }

            if (PtnPMTCTStatus == 0)
            {
                //########### Contact Tracking ############
                theUrl = string.Format("{0}Module={1}", "../Scheduler/frmScheduler_ContactCareTracking.aspx?", "PMTCT");
                //mnuContactCarePMTCT.HRef = theUrl;

                //####### Adult Pharmacy PMTCT ##########
                //LoggedInUser.Program = "PMTCT";
                //LoggedInUser.PatientPharmacyId = 0;
                theUrl = string.Format("{0}", "../Pharmacy/frmPharmacyForm.aspx?Prog=PMTCT");
                mnuAdultPharmacyPMTCT.HRef = theUrl;

                //###########Paediatric Pharmacy PMTCT#################
                //theUrl = string.Format("{0}", "../Pharmacy/frmPharmacy_Paediatric.aspx?Prog=PMTCT");
                //mnuPaediatricPharmacyPMTCT.HRef = theUrl;

                //########### Pharmacy PMTCT CTC###############
                theUrl = string.Format("{0}", "../Pharmacy/frmPharmacy_CTC.aspx?Prog=PMTCT");
                //mnuPharmacyPMTCTCTC.HRef = theUrl;

                //########### Laboratory ############
                string theUrlPMTCT         = string.Format("{0}sts={1}", "../Laboratory/frmLabOrder.aspx?", PtnPMTCTStatus);
                string theUrlPMTCTLabOrder = string.Format("{0}sts={1}", "../Laboratory/frmLabOrderTests.aspx?", PtnPMTCTStatus);
                mnuLabOrderPMTCT.HRef     = theUrlPMTCT;
                mnuOrderLabTestPMTCT.HRef = theUrlPMTCTLabOrder;
                mnuOrderLabTestPMTCT.Attributes.Add("onclick", "window.open('" + theUrlPMTCTLabOrder + "','','toolbars=no,location=no,directories=no,dependent=yes,top=100,left=30,maximize=no,resize=no,width=1000,height=500,scrollbars=yes');return false;");
            }
        }

        #region "Common Forms"
        theUrl = string.Format("{0}&mnuClicked={1}&sts={2}&PatientID={3}", "../AdminForms/frmAdmin_DeletePatient.aspx?name=Add", "DeletePatient", lblpntStatus.Text, PatientId.ToString());
        mnuAdminDeletePatient.HRef = theUrl;

        //######## Meetu 08 Sep 2009 End########//
        //####### Delete Form #############
        theUrl = string.Format("{0}?PatientId={1}&sts={2}", "../ClinicalForms/frmClinical_DeleteForm.aspx", PatientId.ToString(), lblpntStatus.Text);
        mnuClinicalDeleteForm.HRef = theUrl;

        //####### Delete Patient  #############
        //theUrl = string.Format("{0}?mnuClicked={1}&sts={2}", "../frmFindAddPatient.aspx?name=Add", "DeletePatient", lblpntStatus.Text);
        theUrl = string.Format("{0}?mnuClicked={1}&sts={2}&PatientID={3}", "../AdminForms/frmAdmin_DeletePatient.aspx?name=Add", "DeletePatient", lblpntStatus.Text, PatientId.ToString());
        mnuAdminDeletePatient.HRef = theUrl;

        //##### Patient Transfer #######
        //theUrl = string.Format("{0}&PatientId={1}&sts={2}", "../ClinicalForms/frmClinical_Transfer.aspx?name=Add", PatientId.ToString(), lblpntStatus.Text);
        theUrl = string.Format("{0}&sts={1}", "../ClinicalForms/frmClinical_Transfer.aspx?name=Add", lblpntStatus.Text);

        mnuPatientTranfer.HRef = theUrl;

        //########### Existing Forms ############
        theUrl = string.Format("{0}", "../ClinicalForms/frmPatient_History.aspx");
        mnuExistingForms.HRef = theUrl;

        //########### ARV-Pickup Report ############
        theUrl             = string.Format("{0}&PatientId={1}&SatelliteID={2}&CountryID={3}&PosID={4}&sts={5}", "../Reports/frmReport_PatientARVPickup.aspx?name=Add", PatientId.ToString(), Session["AppSatelliteId"], Session["AppCountryId"], Session["AppPosID"], lblpntStatus.Text);
        mnuDrugPickUp.HRef = theUrl;

        //########### PatientProfile ############
        theUrl = string.Format("{0}&PatientId={1}&ReportName={2}&sts={3}", "../Reports/frmReportViewer.aspx?name=Add", PatientId.ToString(), "PatientProfile", lblpntStatus.Text);
        mnuPatientProfile.HRef = theUrl;

        //########### ARV-Pickup Report ############
        theUrl            = string.Format("{0}&PatientId={1}&SatelliteID={2}&CountryID={3}&PosID={4}&sts={5}", "../Reports/frmReportDebitNote.aspx?name=Add", PatientId.ToString(), Session["AppSatelliteId"], Session["AppCountryId"], Session["AppPosID"], lblpntStatus.Text);
        mnuDebitNote.HRef = theUrl;

        ////////########### Patient Blue Cart############
        //////theUrl = string.Format("{0}&PatientId={1}&ReportName={2}&sts={3}", "../Reports/frmPatientBlueCart.aspx?name=Add", PatientId.ToString(), "PatientProfile", lblpntStatus.Text);
        //////mnupatientbluecart.HRef = theUrl;


        //###### PatientHome #############
        ////theUrl = string.Format("{0}?PatientId={1}", "../ClinicalForms/frmPatient_Home.aspx", PatientId.ToString());
        theUrl             = string.Format("{0}", "../ClinicalForms/frmPatient_Home.aspx");
        mnuPatienHome.HRef = theUrl;

        //###### Scheduler #############
        theUrl = string.Format("{0}&PatientId={1}&LocationId={2}&FormName={3}&sts={4}", "../Scheduler/frmScheduler_AppointmentHistory.aspx?name=Add", Convert.ToInt32(Request.QueryString["PatientId"]), Session["AppLocationId"].ToString(), "PatientHome", lblpntStatus.Text);
        mnuScheduleAppointment.HRef = theUrl;

        //####### Additional Forms - Family Information #######
        theUrl = string.Format("{0}&PatientId={1}", "../ClinicalForms/frmFamilyInformation.aspx?name=Add", PatientId.ToString());
        mnuFamilyInformation.HRef = theUrl;

        //####### Patient Classification #######
        theUrl = string.Format("{0}&PatientId={1}", "../ClinicalForms/frmClinical_PatientClassificationCTC.aspx?name=Add", PatientId.ToString());
        mnuPatientClassification.HRef = theUrl;

        //####### Follow-up Education #######
        theUrl = string.Format("{0}&PatientId={1}", "../ClinicalForms/frmFollowUpEducationCTC.aspx?name=Add", PatientId.ToString());
        mnuFollowupEducation.HRef = theUrl;

        //####### Exposed Infant #############
        theUrl = string.Format("{0}?PatientId={1}", "../ClinicalForms/frmExposedInfantEnrollment.aspx", PatientId.ToString());
        mnuExposedInfant.HRef = theUrl;
        #endregion
        theUrl = string.Format("{0}?PatientId={1}", "../ClinicalForms/frm_PriorArt_HivCare.aspx", PatientId.ToString());
        mnuPriorARTHIVCare.HRef = theUrl;
        theUrl          = string.Format("{0}", "../ClinicalForms/frmClinical_ARTCare.aspx");
        mnuARTCare.HRef = theUrl;

        //########### HIV Care/ART Encounter #########
        string theUrl2 = string.Format("{0}", "../ClinicalForms/frmClinical_HIVCareARTCardEncounter.aspx");
        mnuHIVCareARTEncounter.HRef = theUrl2;

        //########### Kenya Blue Card #########
        theUrl           = string.Format("{0}?PatientId={1}", "../ClinicalForms/frmClinical_InitialFollowupVisit.aspx", PatientId.ToString());
        mnuARTVisit.HRef = theUrl;

        theUrl             = string.Format("{0}?PatientId={1}", "../ClinicalForms/frmClinical_ARVTherapy.aspx", PatientId.ToString());
        mnuARTTherapy.HRef = theUrl;

        //theUrl = string.Format("{0}?PatientId={1}", "../ClinicalForms/frmClinical_ARTHistory.aspx", PatientId.ToString());
        //mnuARTTherapy.HRef = theUrl;

        theUrl             = string.Format("{0}?PatientId={1}", "../ClinicalForms/frmClinical_ARTHistory.aspx", PatientId.ToString());
        mnuARTHistory.HRef = theUrl;

        //########### Patient Enrollment ############
        //Added - Jayanta Kr. Das - 16-02-07
        DataTable theDT = new DataTable();
        if (PatientId != 0)
        {
            //### Patient Enrolment ######
            string theUrl1 = "";
            if (ARTNos != null && ARTNos == "")
            {
                if (Session["SystemId"].ToString() == "1" && PtnARTStatus == 0)
                {
                    ////theUrl = string.Format("{0}&patientid={1}&locationid={2}&sts={3}", "../ClinicalForms/frmClinical_Enrolment.aspx?name=Add", PatientId.ToString(), Session["AppLocationId"].ToString(), PtnARTStatus);
                    theUrl            = string.Format("{0}", "../ClinicalForms/frmClinical_Enrolment.aspx");
                    mnuEnrolment.HRef = theUrl;
                }
                else if (PtnARTStatus == 0)
                {
                    theUrl            = string.Format("{0}&patientid={1}&locationid={2}&sts={3}", "../ClinicalForms/frmClinical_PatientRegistrationCTC.aspx?name=Add", PatientId.ToString(), Session["AppLocationId"].ToString(), PtnARTStatus);
                    mnuEnrolment.HRef = theUrl;
                }
                if (PtnPMTCTStatus == 0)
                {
                    ////theUrl1 = string.Format("{0}&patientid={1}&locationid={2}&sts={3}", "../ClinicalForms/frmClinical_EnrolmentPMTCT.aspx?name=Edit", PatientId.ToString(), Session["AppLocationId"].ToString(), PtnPMTCTStatus);
                    //theUrl1 = string.Format("{0}", "../frmPatientRegistration.aspx"); //JAYANT 25/4/2012
                    theUrl1            = string.Format("{0}", "../frmPatientCustomRegistration.aspx");
                    mnuPMTCTEnrol.HRef = theUrl1;
                }
            }

            else if (PMTCTNos != null && PMTCTNos == "")
            {
                if (PtnPMTCTStatus == 0)
                {
                    ////theUrl1 = string.Format("{0}&patientid={1}&locationid={2}&sts={3}", "../ClinicalForms/frmClinical_EnrolmentPMTCT.aspx?name=Add", PatientId.ToString(), Session["AppLocationId"].ToString(), PtnPMTCTStatus);
                    //theUrl1 = string.Format("{0}", "../frmPatientRegistration.aspx");
                    theUrl1            = string.Format("{0}", "../frmPatientCustomRegistration.aspx");
                    mnuPMTCTEnrol.HRef = theUrl1;
                }

                if (Session["SystemId"].ToString() == "1" && PtnARTStatus == 0)
                {
                    theUrl            = string.Format("{0}", "../ClinicalForms/frmClinical_Enrolment.aspx");
                    mnuEnrolment.HRef = theUrl;
                }
                else if (PtnARTStatus == 0)
                {
                    theUrl            = string.Format("{0}&patientid={1}&locationid={2}&sts={3}", "../ClinicalForms/frmClinical_PatientRegistrationCTC.aspx?name=Edit", PatientId.ToString(), Session["AppLocationId"].ToString(), PtnARTStatus);
                    mnuEnrolment.HRef = theUrl;
                }
            }
            else
            {
                //if (PtnPMTCTStatus == 0)
                //{
                ////theUrl1 = string.Format("{0}&patientid={1}&locationid={2}&sts={3}", "../ClinicalForms/frmClinical_EnrolmentPMTCT.aspx?name=Edit", PatientId.ToString(), Session["AppLocationId"].ToString(), PtnPMTCTStatus);
                //theUrl1 = string.Format("{0}", "../frmPatientRegistration.aspx");
                theUrl1            = string.Format("{0}", "../frmPatientCustomRegistration.aspx");
                mnuPMTCTEnrol.HRef = theUrl1;
                //}

                if (Session["SystemId"].ToString() == "1" && PtnARTStatus == 0)
                {
                    ////theUrl = string.Format("{0}&patientid={1}&locationid={2}&sts={3}", "../ClinicalForms/frmClinical_Enrolment.aspx?name=Edit", PatientId.ToString(), Session["AppLocationId"].ToString(), PtnARTStatus);
                    theUrl            = string.Format("{0}", "../ClinicalForms/frmClinical_Enrolment.aspx");
                    mnuEnrolment.HRef = theUrl;
                }
                else if (PtnARTStatus == 0)
                {
                    theUrl            = string.Format("{0}&patientid={1}&locationid={2}&sts={3}", "../ClinicalForms/frmClinical_PatientRegistrationCTC.aspx?name=Edit", PatientId.ToString(), Session["AppLocationId"].ToString(), PtnARTStatus);
                    mnuEnrolment.HRef = theUrl;
                }
            }
        }
        //Load_MenuPartial(PatientId, PtnPMTCTStatus.ToString(), Convert.ToInt32(Session["AppCurrency"].ToString()));
    }
コード例 #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            Session["dtWaitingList"]       = null;
            Session["WLTechnicalArea"]     = null;
            Session["WLTechnicalAreaName"] = null;
            Session["WLPatientID"]         = 0;
            string pID = Session["PatientId"].ToString();

            if (pID == "0")
            {
                pID = Request.QueryString["PID"];
            }
            if (Request.QueryString["hashtag"] == null)
            {
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                Response.Redirect("~/frmFacilityHome.aspx", true);
            }
            else
            {
                string  returnUrl = Request.QueryString["hashtag"].Replace(" ", "+");
                Utility objUtil   = new Utility();
                returnUrl             = objUtil.Decrypt((returnUrl));
                btnBack.OnClientClick = String.Format("javascript:window.location = '../{0}';return false;", returnUrl);
            }
            if (Request.QueryString["mod"] != null)
            {
                Master.ExecutePatientLevel = false;
            }
            else
            {
                Master.ExecutePatientLevel = true;
            }
            if (Session["PatientInformation"] == null)
            {
                IPatientHome PatientManager = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");
                //System.Data.DataSet theDS = PatientManager.GetPatientDetails(Convert.ToInt32(Session["PatientId"]), Convert.ToInt32(Session["SystemId"]));
                DataSet theDS = PatientManager.GetPatientDetails(Convert.ToInt32(pID), Convert.ToInt32(Session["SystemId"]), Convert.ToInt32(Session["TechnicalAreaId"]));
                PatientManager = null;
                Session["PatientInformation"] = theDS.Tables[0];
            }
            BindQueues();
            DataTable dtPatientInfo = (DataTable)Session["PatientInformation"];

            if (Request.QueryString["srvNm"] != null)
            {
                lblTechnicalArea.Text          = Request.QueryString["srvNm"];
                Session["WLTechnicalArea"]     = Request.QueryString["mod"];
                Session["WLTechnicalAreaName"] = Request.QueryString["srvNm"];
                Session["WLPatientID"]         = Request.QueryString["PID"];
            }
            else
            {
                lblTechnicalArea.Text          = Session["TechnicalAreaName"].ToString();
                Session["WLTechnicalArea"]     = Session["TechnicalAreaId"];
                Session["WLTechnicalAreaName"] = Session["TechnicalAreaName"];
                Session["WLPatientID"]         = HttpContext.Current.Session["PatientId"];
            }

            LoadPatientsWaitList(Convert.ToInt32(HttpContext.Current.Session["WLPatientID"]));
        }
コード例 #18
0
        private void openPatientDetails(int patientID)
        {
            HttpContext.Current.Session["PatientId"]         = patientID;
            HttpContext.Current.Session["PatientVisitId"]    = 0;
            HttpContext.Current.Session["ServiceLocationId"] = 0;
            HttpContext.Current.Session["LabId"]             = 0;
            HttpContext.Current.Session["CareEndFlag"]       = "0";

            /* Session["TechnicalAreaName"] = null;
             * Session["TechnicalAreaId"] = 0;*/


            #region "Refresh Patient Records"
            IPatientHome        PManager = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");
            System.Data.DataSet thePDS   = PManager.GetPatientDetails(Convert.ToInt32(HttpContext.Current.Session["PatientId"]), Convert.ToInt32(HttpContext.Current.Session["SystemId"]), Convert.ToInt32(HttpContext.Current.Session["TechnicalAreaId"]));


            HttpContext.Current.Session["PatientInformation"] = thePDS.Tables[0];
            if (thePDS.Tables[40].Rows.Count > 0)
            {
                HttpContext.Current.Session["CareEndFlag"] = thePDS.Tables[40].Rows[0]["CareEnded"].ToString();
            }
            #endregion
            string theUrl = "";
            if (Request.QueryString["srvNm"] == "Records")
            {
                Session["TechnicalAreaName"] = "Records";
                theUrl = string.Format("{0}", "./frmAddTechnicalArea.aspx");
                Response.Redirect(theUrl);
            }
            else
            {
                //Check if the patient is enrolled and go directly to patient home page if patient is enrolled
                IPatientRegistration PatRegMgr = (IPatientRegistration)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientRegistration, BusinessProcess.Clinical");
                DataSet theDS = PatRegMgr.GetFieldNames(int.Parse(Request.QueryString["mod"]), Convert.ToInt32(Session["PatientId"]));

                if (Session["TechnicalAreaId"].ToString() == "206")
                {
                    Session["PatientVisitID"] = 0;
                    theUrl = "./PharmacyDispense/frmPharmacyDispense_PatientOrder.aspx";
                }
                else if (Session["TechnicalAreaId"].ToString() == "300")
                {
                    theUrl = "./Laboratory/frm_LabTestResults.aspx";
                }
                else if (theDS.Tables[3].Rows.Count > 0)//check if patient is care ended, redirect to homepage
                {
                    theUrl = "./ClinicalForms/frmPatient_Home.aspx";
                }
                else if (theDS.Tables[2].Rows.Count > 0 && theDS.Tables[2].Rows[0]["StartDate"].ToString() != "")
                {
                    theUrl = "./ClinicalForms/frmPatient_Home.aspx";
                }
                else
                {
                    theUrl = string.Format("{0}?mod={1}", "./frmAddTechnicalArea.aspx", Request.QueryString["mod"]);
                }

                Response.Redirect(theUrl, false);
            }
        }