예제 #1
0
    protected void btnUpdate_Click(object sender, ImageClickEventArgs e)
    {
        objNLog.Info("Event Started..");

        //if (lblStatus.Visible == true)
        //    lblStatus.Visible = false;

        PatientPersonalDetails Pat_Det = new PatientPersonalDetails();
        PatientInfoDAL Pat_Info = new PatientInfoDAL();
        try
        {
            PatientName Pat_Name = new PatientName();
            int facID=Pat_Info.Get_FacID(txtClinicFacility.Text);

            if (facID == 0)
            {
                Pat_Det.FacID = 0;
            }
            else
            {
                Pat_Det.FacID = facID;
            }

            Pat_Det.MRN = txtMRN.Text;
            Pat_Name.FirstName = txtPatientFName.Text;
            Pat_Name.LastName = txtPatientLName.Text;
            Pat_Name.MiddleName = txtPatientMName.Text;

            if (rbtnMale.Checked == true)
            {
                Pat_Det.Gender = "M";
            }
            else
            {
                Pat_Det.Gender = "F";
            }

            Pat_Det.DOB = txtDOB.Text;
            Pat_Det.SSN = txtSSN.Text;

            Pat_Det.eContactFName = txtecontactFNAME.Text.Trim();
            Pat_Det.eContactLName = txtecontactLNAME.Text.Trim();
            Pat_Det.eContactPhone = txtecontactPHONE.Text.Trim();
            if (ddlecontactREL.SelectedValue != "0")
                Pat_Det.eContactRelation = ddlecontactREL.SelectedValue;

            Pat_Det.PatientAddress1 = txtAddress1.Text;
            Pat_Det.PatientAddress2 = txtAddress2.Text;
            Pat_Det.Pat_City = txtCity.Text;
            Pat_Det.Pat_state = txtState.Text;
            Pat_Det.Pat_ZIP = txtZip.Text;

            Pat_Det.PatientShipAddress1 = txtSAddr1.Text;
            Pat_Det.PatientShipAddress2 = txtSAddr2.Text;
            Pat_Det.Pat_SCity = txtSCity1.Text;
            Pat_Det.Pat_Sstate = txtSState.Text;
            Pat_Det.Pat_SZIP = txtSZIP.Text;

            Pat_Det.Pat_Phone = txtPhone.Text;
            Pat_Det.Pat_WPhone = txtWorkPhone.Text;
            Pat_Det.Pat_CellPhone = txtCellPhone.Text;
            string diag_Code = "";
            if (txtDiagn1.Text.Trim() != "")
                diag_Code = txtDiagn1.Text.Trim();
            if (txtDiagn2.Text.Trim() != "")
            {
                if (diag_Code.Trim() != "")

                    diag_Code = diag_Code + "," + txtDiagn2.Text.Trim();
                else
                    diag_Code = diag_Code + txtDiagn2.Text.Trim();
            }
            if (txtDiagn3.Text.Trim() != "")
            {
                if (diag_Code.Trim() != "")

                    diag_Code = diag_Code + "," + txtDiagn3.Text.Trim();
                else
                    diag_Code = diag_Code + txtDiagn3.Text.Trim();
            }
            if (txtDiagn4.Text.Trim() != "")
            {
                if (diag_Code.Trim() != "")

                    diag_Code = diag_Code + "," + txtDiagn4.Text.Trim();
                else
                    diag_Code = diag_Code + txtDiagn4.Text.Trim();
            }
            if (txtDiagn5.Text.Trim() != "")
            {
                if (diag_Code.Trim() != "")

                    diag_Code = diag_Code + "," + txtDiagn5.Text.Trim();
                else
                    diag_Code = diag_Code + txtDiagn5.Text.Trim();
            }
            Pat_Det.Pat_Diagnosis = diag_Code;

            Pat_Det.Pat_Pre_Doc = txtDoctor.Text;
            Pat_Det.DocID = Int32.Parse(Pat_Info.Get_DocID(txtDoctor.Text).ToString());

            if (chkAutoreFillOption.Checked)

                Pat_Det.Pat_AutoFill = "Y";
            else
                Pat_Det.Pat_AutoFill = "N";

            if (chkHippa.Checked)
            {
                Pat_Det.HIPPANotice = "Y";
                Pat_Det.HIPPADate = txtHippaDate.Text;
            }
            else
                Pat_Det.HIPPANotice = "N";

            Pat_Det.Pat_ID = int.Parse(hidPat_ID.Value.ToString());

            if (ddlPrimInsurance.Enabled == true )
                Pat_Det.PrimaryInsID = int.Parse(ddlPrimInsurance.SelectedValue.ToString());

            if (ddlPatStatus.Enabled == true)
            Pat_Det.PatientStatus = char.Parse(ddlPatStatus.SelectedValue);

            string userID = (string)Session["User"];
            if (Pat_Det.FacID == 0)
            {
                //lblStatus.Visible=true;
                //lblStatus.Text = "No Facilities Found / Invalid Facility..!";

                divPatWarning.Visible = true;
                divPatError.Visible = false;
                divPatSuccess.Visible = false;
                lblAddPatientStatus.Text = "No Facilities Found / Invalid Facility..!";
                mpeAddPatientStatus.Show();

            }
            else if (Pat_Det.DocID == 0)
            {
                //lblStatus.Visible = true;
                //lblStatus.Text = "No Doctors Found / Invalid Doctor..!";

                divPatWarning.Visible = true;
                divPatError.Visible = false;
                divPatSuccess.Visible = false;
                lblAddPatientStatus.Text = "No Doctors Found / Invalid Doctor..!";
                mpeAddPatientStatus.Show();

            }
            else
            {
                Pat_Info.update_patInfo(userID, Pat_Det, Pat_Name);
                Response.Redirect("AllPatientProfile.aspx?patID=" + Request.QueryString["patID"].ToString());
            }

        }
        catch (Exception ex)
        {
            objNLog.Error("Error : " + ex.Message);
        }
        objNLog.Info("Event Completed..");
    }