public string SetPatientId_Session(string url)
    {
        string str       = url;
        string strUrl    = string.Empty;
        int    patientID = 0;

        strUrl = str.Substring(0, str.IndexOf("?"));
        if (strUrl == "./Scheduler/frmScheduler_AppointmentNew.aspx")
        {
            patientID = Convert.ToInt32(str.Substring(str.LastIndexOf("=") + 1));
        }
        else
        {
            patientID = Convert.ToInt32(str.Substring(str.IndexOf("=") + 1));
        }
        Session["PatientId"] = patientID;


        if (strUrl == "./Scheduler/frmScheduler_AppointmentNew.aspx")
        {
            strUrl = "./Scheduler/frmScheduler_AppointmentNew.aspx?name=Add";
        }

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

        Session["PatientInformation"] = thePDS.Tables[0];
        #endregion

        return(strUrl);
    }
        protected void grdPatientPrescriptions_SelectedIndexChanged(object sender, EventArgs e)
        {
            AuthenticationManager Authentication = new AuthenticationManager();
            string   ModuleId;
            DataView theDV = new DataView((DataTable)Session["UserRight"]);

            if (Session["TechnicalAreaId"] != null || Session["TechnicalAreaId"].ToString() != "")
            {
                if (Convert.ToInt32(Session["TechnicalAreaId"].ToString()) != 0)
                {
                    ModuleId = "0," + Session["TechnicalAreaId"].ToString();
                }
                else
                {
                    ModuleId = "0";
                }
            }
            else
            {
                ModuleId = "0";
            }

            theDV.RowFilter = "ModuleId in (" + ModuleId + ")";
            DataTable theDT = new DataTable();

            theDT = theDV.ToTable();

            string theUrl    = string.Empty;
            int    patientID = int.Parse(grdPatientPrescriptions.SelectedDataKey.Values["Ptn_pk"].ToString());

            Session["PatientVisitID"] = int.Parse(grdPatientPrescriptions.SelectedDataKey.Values["VisitID"].ToString());
            base.Session["PatientId"] = patientID;

            if (Authentication.HasFeatureRight(ApplicationAccess.Dispense, theDT) == false)
            {
                theUrl = "frmPharmacy_ReferenceMaterials.aspx";
            }
            else
            {
                theUrl = "frmPharmacyDispense_PatientOrder.aspx";
            }

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

            Session["PatientInformation"] = thePDS.Tables[0];
            //Session["DynamicLabels"] = thePDS.Tables[23];
            thePDS.Dispose();
            #endregion

            Interface.SCM.IDrug thePharmacyManager = (Interface.SCM.IDrug)ObjectFactory.CreateInstance("BusinessProcess.SCM.BDrug, BusinessProcess.SCM");
            thePharmacyManager.LockpatientForDispensing(patientID, 0, Session["AppUserName"].ToString(), DateTime.Now.ToString("dd-MMM-yyyy"), true);

            Response.Redirect(theUrl, false);
        }
    protected void btnsave_Click(object sender, EventArgs e)
    {
        if (FieldValidation() == false)
        {
            return;
        }

        Hashtable            theHT       = AddUpdateData();
        IPatientRegistration ptnMgrPMTCT = (IPatientRegistration)ObjectFactory.CreateInstance(ObjFactoryParameter);

        CustomFieldClinical theCustomManager = new CustomFieldClinical();
        DataTable           theCustomDataDT  = new DataTable();

        //if (Request.QueryString["Name"] == "Add")
        if (Convert.ToInt32(Session["PatientId"]) == 0)
        {
            theCustomDataDT = theCustomManager.GenerateInsertUpdateStatement(pnlCustomList, "Insert", ApplicationAccess.PMTCTEnrollment, (DataSet)ViewState["CustomFieldsDS"]);
        }
        else ////if (Request.QueryString["Name"] == "Edit")
        {
            //CustomFieldClinical theCustomManager = new CustomFieldClinical();
            theCustomDataDT = theCustomManager.GenerateInsertUpdateStatement(pnlCustomList, "Update", ApplicationAccess.PMTCTEnrollment, (DataSet)ViewState["CustomFieldsDS"]);
            //DataTable theDS = ptnMgrPMTCT.UpdatePatientRegistrationPMTCT(theHT,theCustomDataDT);
            //ViewState["PtnID"] = theDS.Rows[0]["PatientID"].ToString();
            //UpdateCancel();
        }

        DataTable theDS = ptnMgrPMTCT.SavePatientRegistrationPMTCT(theHT, theCustomDataDT);

        ViewState["PtnID"]   = theDS.Rows[0]["PatientID"].ToString();
        Session["PatientId"] = theDS.Rows[0]["PatientID"].ToString();
        SaveCancel();

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

        Session["PatientStatus"] = 0;
    }
Beispiel #4
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)
        {
            //(Master.FindControl("lblRoot") as Label).Text = "Clinical Forms >>";
            //(Master.FindControl("lblMark") as Label).Visible = false;
            //(Master.FindControl("lblheader") as Label).Text = "Patient History";
            //(Master.FindControl("lblformname") as Label).Text = "Existing Forms";
            (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Text     = "Clinical Forms >> ";
            (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text   = "Patient History";
            (Master.FindControl("levelTwoNavigationUserControl1").FindControl("lblformname") as Label).Text = "Existing Forms";



            #region "Refresh Patient Records"
            IPatientHome PManager;
            if (null == Session["PatientInformation"])
            {
                PManager = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");
                System.Data.DataSet thePDS = PManager.GetPatientDetails(Convert.ToInt32(Session["PatientId"]), Convert.ToInt32(Session["SystemId"]), Convert.ToInt32(Session["TechnicalAreaId"]));
                //System.Data.DataSet thePDS = PManager.GetPatientDetails(Convert.ToInt32(Request.QueryString["PatientId"]), Convert.ToInt32(Session["SystemId"]));

                Session["PatientInformation"] = thePDS.Tables[0];
            }
            #endregion

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

            try
            {
                (Master.FindControl("levelTwoNavigationUserControl1").FindControl("lblpntStatus") as Label).Text = Convert.ToString(Session["PatientStatus"]);
                if (!IsPostBack)
                {
                    IFacilitySetup FacilityMaster = (IFacilitySetup)ObjectFactory.CreateInstance("BusinessProcess.Administration.BFacility, BusinessProcess.Administration");
                    //theFacilityDS = FacilityMaster.GetFacilityList(Convert.ToInt32(Session["SystemId"]), 1001);
                    //theFacilityDS = FacilityMaster.GetSystemBasedLabels(Convert.ToInt32(Session["SystemId"]), 1001, 0);
                    //ViewState["FacilityDS"] = theFacilityDS;
                    //SetPageLabels();
                    //******************************************************//
                    if (Session["PatientId"] == null || Convert.ToString(Session["PatientId"]) == "0")
                    {
                        Session["PatientId"] = Request.QueryString["PatientId"];  //remove it after session of patient set on find add when patient selected from grid.
                    }

                    PId    = Convert.ToString(Session["PatientId"]);
                    PtnSts = Convert.ToString(Session["PatientStatus"]);;
                    if (Session["PatientId"] != null && Convert.ToInt32(Session["PatientId"]) != 0)
                    {
                        PId = Session["PatientId"].ToString();
                    }
                    if (Session["PatientStatus"] != null)
                    {
                        PtnSts = Session["PatientStatus"].ToString();
                    }
                    DataSet theDS = PatientManager.GetPatientHistory(Convert.ToInt32(PId));
                    ViewState["theCFDT"] = theDS.Tables[3].Copy();
                    FormIQCare(theDS);
                }
            }

            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareMsgBox.Show("#C1", theBuilder, this);
                return;
            }
            finally
            {
                PatientManager = null;
            }
        }