private void SaveDiagnosisCode()
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        _associateDiagnosisCodeBO = new Bill_Sys_AssociateDiagnosisCodeBO();
        DataSet   _billDs             = new DataSet();
        ArrayList _arrayListDiagnosys = new ArrayList();

        try
        {
            _associateDiagnosisCodeBO.DeleteCaseAssociateDignosisCodeWithProcCode(txtCaseID.Text, txtCompanyID.Text, "");//, lstPTDProcCode.Items[j].Value.Substring(0, lstPTDProcCode.Items[j].Value.IndexOf("|")), lstPTDProcCode.Items[j].Value.Substring((lstPTDProcCode.Items[j].Value.IndexOf("|") + 1), ((lstPTDProcCode.Items[j].Value.Length - lstPTDProcCode.Items[j].Value.IndexOf("|")) - 1)));

            dsSelectedDiagnosis = (DataSet)Session["selectedDS"];

            grdSelectedDiagnosisCode.DataSource = dsSelectedDiagnosis;
            grdSelectedDiagnosisCode.DataBind();

            for (int i = 0; i < grdSelectedDiagnosisCode.VisibleRowCount; i++)
            {
                _arrayList = new ArrayList();
                _arrayList.Add(txtDiagnosisSetID.Text);
                _arrayList.Add(txtCaseID.Text);
                if (((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).BT_REFERRING_FACILITY == true)
                {
                    _arrayList.Add("");
                }
                else
                {
                    _arrayList.Add("");
                }
                _arrayList.Add(grdSelectedDiagnosisCode.GetRowValues(i, "SZ_DIAGNOSIS_CODE_ID").ToString());
                _arrayList.Add(txtCompanyID.Text);
                _arrayList.Add(Request.QueryString["ProcGroupID"].ToString());
                _associateDiagnosisCodeBO.SaveCaseAssociateDignosisCode(_arrayList);
                _arrayListDiagnosys.Add(grdSelectedDiagnosisCode.GetRowValues(i, "SZ_DESCRIPTION").ToString() + ' ' + grdSelectedDiagnosisCode.GetRowValues(i, "SZ_DIAGNOSIS_CODE").ToString());
            }
            for (int j = 0; j < grdNormalDgCode.VisibleRowCount && j < 20; j++)
            {
                //CheckBox chkEmpty = (CheckBox)dgiProcedureCode.Cells[1].FindControl("chkSelect");
                CheckBox chkEmpty = (CheckBox)grdNormalDgCode.FindRowCellTemplateControl(j, null, "chkSelect");

                if (chkEmpty.Checked == true)
                {
                    _arrayList = new ArrayList();
                    _arrayList.Add(txtDiagnosisSetID.Text);
                    _arrayList.Add(txtCaseID.Text);
                    if (((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).BT_REFERRING_FACILITY == true)
                    {
                        _arrayList.Add("");
                    }
                    else
                    {
                        _arrayList.Add("");
                    }
                    _arrayList.Add(Request.QueryString["ProcGroupID"].ToString());
                    _arrayList.Add(grdNormalDgCode.GetRowValues(j, "SZ_DIAGNOSIS_CODE_ID"));
                    _arrayList.Add(txtCompanyID.Text);
                    _arrayList.Add(Request.QueryString["ProcCode"]);
                    _arrayList.Add(txtSpeciality.Text);
                    _associateDiagnosisCodeBO.SaveCaseAssociateDignosisCode(_arrayList);

                    //_arrayListDiagnosys.Add(dgiProcedureCode.Cells[2].Text + ' ' + dgiProcedureCode.Cells[4].Text);
                    _arrayListDiagnosys.Add(grdNormalDgCode.GetRowValues(j, "SZ_DIAGNOSIS_CODE").ToString() + ' ' + grdNormalDgCode.GetRowValues(j, "SZ_DESCRIPTION"));
                }
            }

            Session["DiagnosysList"] = (ArrayList)_arrayListDiagnosys;

            GetAssignedDiagnosisCode(txtCaseID.Text, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, "", "GET_DIAGNOSIS_CODE");
            GetDiagnosisCode(txtCaseID.Text, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, "", "GET_DIAGNOSIS_CODE");
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }
        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
    private void SaveDiagnosisCode()
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        _associateDiagnosisCodeBO = new Bill_Sys_AssociateDiagnosisCodeBO();
        DataSet   _billDs             = new DataSet();
        ArrayList _arrayListDiagnosys = new ArrayList();

        try
        {
            _associateDiagnosisCodeBO.DeleteCaseAssociateDignosisCodeWithProcCode(txtCaseID.Text, txtCompanyID.Text, "");//, lstPTDProcCode.Items[j].Value.Substring(0, lstPTDProcCode.Items[j].Value.IndexOf("|")), lstPTDProcCode.Items[j].Value.Substring((lstPTDProcCode.Items[j].Value.IndexOf("|") + 1), ((lstPTDProcCode.Items[j].Value.Length - lstPTDProcCode.Items[j].Value.IndexOf("|")) - 1)));



            foreach (DataGridItem dgiProcedureCode in grdSelectedDiagnosisCode.Items)
            {
                _arrayList = new ArrayList();
                _arrayList.Add(txtDiagnosisSetID.Text);
                _arrayList.Add(txtCaseID.Text);
                if (((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).BT_REFERRING_FACILITY == true)
                {
                    _arrayList.Add("");
                }
                else
                {
                    _arrayList.Add("");
                }
                _arrayList.Add(dgiProcedureCode.Cells[0].Text.ToString());
                _arrayList.Add(txtCompanyID.Text);
                _arrayList.Add(dgiProcedureCode.Cells[5].Text.ToString());
                _associateDiagnosisCodeBO.SaveCaseAssociateDignosisCode(_arrayList);


                _arrayListDiagnosys.Add(dgiProcedureCode.Cells[2].Text + ' ' + dgiProcedureCode.Cells[4].Text);
            }
            foreach (DataGridItem dgiProcedureCode in grdNormalDgCode.Items)
            {
                CheckBox chkEmpty = (CheckBox)dgiProcedureCode.Cells[1].FindControl("chkSelect");
                if (chkEmpty.Checked == true)
                {
                    _arrayList = new ArrayList();
                    _arrayList.Add(txtDiagnosisSetID.Text);
                    _arrayList.Add(txtCaseID.Text);
                    if (((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).BT_REFERRING_FACILITY == true)
                    {
                        _arrayList.Add("");
                    }
                    else
                    {
                        _arrayList.Add("");
                    }
                    _arrayList.Add(dgiProcedureCode.Cells[1].Text.ToString());
                    _arrayList.Add(txtCompanyID.Text);
                    _arrayList.Add(txtSpeciality.Text);
                    _associateDiagnosisCodeBO.SaveCaseAssociateDignosisCode(_arrayList);

                    _arrayListDiagnosys.Add(dgiProcedureCode.Cells[2].Text + ' ' + dgiProcedureCode.Cells[4].Text);
                }
            }

            Session["DiagnosysList"] = (ArrayList)_arrayListDiagnosys;

            GetAssignedDiagnosisCode(txtCaseID.Text, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, "", "GET_DIAGNOSIS_CODE");
            GetDiagnosisCode(txtCaseID.Text, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, "", "GET_DIAGNOSIS_CODE");
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }
        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
    private void SaveDiagnosisCode()
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        _associateDiagnosisCodeBO = new Bill_Sys_AssociateDiagnosisCodeBO();
        DataSet   _billDs = new DataSet();
        ArrayList _arrayList;

        try
        {
            string szDiagnosisCode = "";
            _associateDiagnosisCodeBO.DeleteCaseAssociateDignosisCodeWithProcCode(txtCaseID.Text, txtCompanyID.Text, "");//, lstPTDProcCode.Items[j].Value.Substring(0, lstPTDProcCode.Items[j].Value.IndexOf("|")), lstPTDProcCode.Items[j].Value.Substring((lstPTDProcCode.Items[j].Value.IndexOf("|") + 1), ((lstPTDProcCode.Items[j].Value.Length - lstPTDProcCode.Items[j].Value.IndexOf("|")) - 1)));
            txtDiagnosisSetID.Text = _associateDiagnosisCodeBO.GetDiagnosisSetID();
            Bil_Sys_Associate_Diagnosis _dianosis_Association = new Bil_Sys_Associate_Diagnosis();
            _dianosis_Association = (Bil_Sys_Associate_Diagnosis)Session["DIAGNOS_ASSOCIATION"];

            for (int i = 0; i < grdDiagnosisCode.VisibleRowCount; i++)
            {
                ASPxGridView       _ASPxGridView = (ASPxGridView)grdid.FindControl("grdDiagnosisCode");
                GridViewDataColumn c             = (GridViewDataColumn)grdDiagnosisCode.Columns[0];
                CheckBox           checkBox      = (CheckBox)grdDiagnosisCode.FindRowCellTemplateControl(i, c, "chkall");
                if (checkBox != null)
                {
                    if (checkBox.Checked)
                    {
                        _arrayList = new ArrayList();
                        _arrayList.Add(txtDiagnosisSetID.Text);
                        _arrayList.Add(txtCaseID.Text);
                        if (((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).BT_REFERRING_FACILITY == true)
                        {
                            _arrayList.Add("");
                        }
                        else
                        {
                            _arrayList.Add("");
                        }
                        szDiagnosisCode = Convert.ToString(grdDiagnosisCode.GetRowValues(i, "SZ_DIAGNOSIS_CODE_ID"));
                        _arrayList.Add(szDiagnosisCode);
                        _arrayList.Add(txtCompanyID.Text);
                        _arrayList.Add(_dianosis_Association.ProceuderGroupId);
                        _associateDiagnosisCodeBO.SaveCaseAssociateDignosisCode(_arrayList);
                    }
                }
            }


            //Put Condition here
            //---------Commented by Kunal---------------------------------------------------------
            if (objSystemObject.SZ_ASSIGN_DIAGNOSIS_CODE_TO_VISIT == "1")
            {
                GetAssignedProcedureDiagnosisCode(txtCaseID.Text, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, _dianosis_Association.EventProcID, "GET_DIAGNOSIS_CODE");
                GetProcedureDiagnosisCode(txtCaseID.Text, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, _dianosis_Association.EventProcID, "GET_DIAGNOSIS_CODE");
            }
            else
            {
                GetAssignedDiagnosisCode(txtCaseID.Text, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, "", "GET_DIAGNOSIS_CODE");
                GetDiagnosisCode(txtCaseID.Text, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, "", "GET_DIAGNOSIS_CODE");
            }
            //--------------End---------------------------------------------------------------------
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }

        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }