Exemple #1
0
    //save the first view
    protected bool SaveDemographics()
    {
        Session["PAT_DEMOGRAPHICS_DS"] = null;
        Session["PATIENTNAME"]         = null;

        long lHomePhoneMsg = 0;
        long lEmailMsg     = 0;

        if (rblHomePhoneMsg.SelectedIndex > -1)
        {
            lHomePhoneMsg = Convert.ToInt32(rblHomePhoneMsg.SelectedValue);
        }

        if (rblEmailMessage.SelectedIndex > -1)
        {
            lEmailMsg = Convert.ToInt32(rblEmailMessage.SelectedValue);
        }

        //check data entry for errors
        string strMessage = CheckPatientDemoErrors();

        if (!string.IsNullOrEmpty(strMessage))
        {
            Master.StatusCode    = 1;
            Master.StatusComment = strMessage;
            //ShowSysFeedback();
            return(false);
        }

        ConvertPatientDemographics();

        CPatient pat = new CPatient();

        // if new patient then insert else update
        if (m_bNewPatient)
        {
            m_strNewPatientID   = Master.APPMaster.GetNewPatientID();
            m_strNewEncounterID = Master.APPMaster.GetNewEncounterID();

            //insert the actual record
            bool bStatus = pat.InsertPatientDemographics(
                Master,
                m_strNewPatientID,
                m_strNewEncounterID,
                txtFirstName.Text,
                txtMiddleName.Text,
                txtLastName.Text,
                m_strFMPSSN,
                m_strFMPSSNConfirm,
                m_strGender,
                m_strDOB,
                cboProvider.SelectedValue,
                txtAddress1.Text,
                txtAddress2.Text,
                txtCity.Text,
                txtPostCode.Text,
                txtHomePhone.Text,
                txtCelPhone.Text,
                txtWorkPhone.Text,
                txtPatEmail.Text,
                cboState.SelectedValue,
                Convert.ToInt32(cboCallPreference.SelectedValue),
                lHomePhoneMsg,
                lEmailMsg);

            if (!bStatus)
            {
                //ShowSysFeedback();
                return(false);
            }

            //reset these so the RFR tab will show
            Master.APPMaster.PatientHasOpenCase = true;

            Master.SetVSValue("IsNewPatient", false);
            Master.SetVSValue("ReloadPage", true);

            //set the selected patient id, basically they are
            //"looked up" at this point...
            Master.SelectedPatientID = m_strNewPatientID;

            //Add all patient events
            CPatientEvent evt = new CPatientEvent(Master);
            evt.AddAllEvents();

            //add patient step
            CPatientTxStep patstep = new CPatientTxStep(Master);
            patstep.InsertPatientStep(0);

            //get current (new) treatment id
            CEncounter enc             = new CEncounter();
            long       lNewTreatmentID = 1;
            enc.GetCurrentTreatmentID(Master, m_strNewPatientID, out lNewTreatmentID);
            Master.SelectedTreatmentID = lNewTreatmentID;

            //assign initial questionnaires
            CIntake intake = new CIntake();
            intake.AssignInitialAssessments(Master, m_strNewPatientID);

            if (!SaveEthnicityRaceSource())
            {
                //ShowSysFeedback();
                return(false);
            }

            return(true);
        }
        else
        {
            bool bStatus = pat.UpdatePatientDemographics(
                Master,
                txtFirstName.Text,
                txtMiddleName.Text,
                txtLastName.Text,
                m_strFMPSSN,
                m_strFMPSSNConfirm,
                m_strGender,
                m_strDOB,
                cboProvider.SelectedValue,
                txtAddress1.Text,
                txtAddress2.Text,
                txtCity.Text,
                txtPostCode.Text,
                txtHomePhone.Text,
                txtCelPhone.Text,
                txtWorkPhone.Text,
                txtPatEmail.Text,
                cboState.SelectedValue,
                Convert.ToInt32(cboCallPreference.SelectedValue),
                lHomePhoneMsg,
                lEmailMsg);

            if (!bStatus)
            {
                return(false);
            }

            if (!SaveEthnicityRaceSource())
            {
                return(false);
            }
        }

        return(true);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack && Master.SelectedPatientID == "")
        {
            GetPatientID();
        }

        //pass the master to the user control
        ucPatientPortalAccount.BaseMstr = Master;

        strSaveBtnID = Master.FindControl("btnMasterSave").ClientID;

        SetJSAttributes();

        //-----------------------------------------------------------------------
        //      NOT POSTBACK
        //-----------------------------------------------------------------------
        #region NotPostback
        if (!IsPostBack)
        {
            //Load combos
            loadAllCombos();
            LoadEthnicityRaceLists();

            if (Master.SelectedPatientID == "")
            {
                return;
            }
            else
            {
                loadPatient();
                loadEmergencyContactInput();
                ucPatientPortalAccount.loadPatientPortalAccount();
            }

            //set hidden field's value to the current tab index
            htxtCurrTab.Value = tabContDemographics.ActiveTabIndex.ToString();
        }
        #endregion

        //if the user pushed the master save button
        //then save the form
        if (Master.OnMasterSAVE())
        {
            if (Save())
            {
                CPatientTxStep patstep = new CPatientTxStep(Master);
                CPatientEvent  patevt  = new CPatientEvent(Master);

                if ((Master.PatientTxStep & (long)PatientStep.SavedProfile) == 0)
                {
                    patevt.CompletedEvent(1);
                }

                upWrapperUpdatePanel.Update();
                if (patstep.InsertPatientStep(1))
                {
                    Response.Redirect("portal_start.aspx");
                }
            }
        }
    }