protected void btnUpdate_Click(object sender, EventArgs e)
    {
        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());
        }
        try
        {
            btnremove.Enabled = true;
            Bill_Sys_PatientBO _bill_Sys_PatientBO = new Bill_Sys_PatientBO();
            if (ChkOC.Checked)
            {
                _bill_Sys_PatientBO.UpdateInsuranceInfoeventforOC(txtCompanyID.Text, txtInsuranceid.Text, txtInsuranceaddid.Text, txteventid.Text, txtCaseID.Text, txtclaimno.Text, txtpoliccyno.Text, extddlCaseType.Text, txtpolicyholder.Text, txtdateofaccident.Text, txtPatientPhoneNo.Text, "1", extddlLocation.Text);
            }
            else
            {
                _bill_Sys_PatientBO.UpdateInsuranceInfoevent(txtCompanyID.Text, txtInsuranceid.Text, txtInsuranceaddid.Text, txteventid.Text, txtCaseID.Text, txtclaimno.Text, txtpoliccyno.Text, extddlCaseType.Text, txtpolicyholder.Text, txtdateofaccident.Text, txtPatientPhoneNo.Text, extddlLocation.Text);
            }

            if (extddlCoSignedby.Text != "NA")
            {
                DataSet dsMandetoryInfo = new DataSet();
                DataSet dsDoctorInfo    = new DataSet();
                Bill_Sys_BillTransaction_BO _Bill_Sys_BillTransaction_BO = new Bill_Sys_BillTransaction_BO();
                dsMandetoryInfo = _Bill_Sys_BillTransaction_BO.GetReferringDoctorMandetoryInfo(txtCompanyID.Text, extddlCaseType.Text);
                dsDoctorInfo    = _Bill_Sys_BillTransaction_BO.GetReadingDoctorInformation(txtCompanyID.Text, extddlCoSignedby.Text);

                if (dsDoctorInfo.Tables.Count > 0 && dsMandetoryInfo.Tables.Count > 0)
                {
                    if (dsDoctorInfo.Tables[0].Rows.Count > 0 && dsMandetoryInfo.Tables[0].Rows.Count > 0)
                    {
                        if (dsDoctorInfo != null && dsMandetoryInfo != null)
                        {
                            string szNPI, szLicenceNo, szWCBAuth, szWCBRating = "";
                            bool   flag = false;
                            szNPI       = dsMandetoryInfo.Tables[0].Rows[0][0].ToString();
                            szLicenceNo = dsMandetoryInfo.Tables[0].Rows[0][1].ToString();
                            szWCBAuth   = dsMandetoryInfo.Tables[0].Rows[0][2].ToString();
                            szWCBRating = dsMandetoryInfo.Tables[0].Rows[0][3].ToString();

                            if (szNPI.ToLower() == "true")
                            {
                                if (dsDoctorInfo.Tables[0].Rows[0]["SZ_NPI"].ToString() == "" || dsDoctorInfo.Tables[0].Rows[0]["SZ_NPI"].ToString() == "&nbsp" || dsDoctorInfo.Tables[0].Rows[0]["SZ_NPI"].ToString() == null)
                                {
                                    flag = true;
                                }
                            }
                            if (szLicenceNo.ToLower() == "true")
                            {
                                if (dsDoctorInfo.Tables[0].Rows[0]["SZ_DOCTOR_LICENSE_NUMBER"].ToString() == "" || dsDoctorInfo.Tables[0].Rows[0]["SZ_DOCTOR_LICENSE_NUMBER"].ToString() == "&nbsp" || dsDoctorInfo.Tables[0].Rows[0]["SZ_DOCTOR_LICENSE_NUMBER"].ToString() == null)
                                {
                                    flag = true;
                                }
                            }
                            if (szWCBAuth.ToLower() == "true")
                            {
                                if (dsDoctorInfo.Tables[0].Rows[0]["SZ_WCB_AUTHORIZATION"].ToString() == "" || dsDoctorInfo.Tables[0].Rows[0]["SZ_WCB_AUTHORIZATION"].ToString() == "&nbsp" || dsDoctorInfo.Tables[0].Rows[0]["SZ_WCB_AUTHORIZATION"].ToString() == null)
                                {
                                    flag = true;
                                }
                            }
                            if (szWCBRating.ToLower() == "true")
                            {
                                if (dsDoctorInfo.Tables[0].Rows[0]["SZ_WCB_RATING_CODE"].ToString() == "" || dsDoctorInfo.Tables[0].Rows[0]["SZ_WCB_RATING_CODE"].ToString() == "&nbsp" || dsDoctorInfo.Tables[0].Rows[0]["SZ_WCB_RATING_CODE"].ToString() == null)
                                {
                                    flag = true;
                                }
                            }

                            if (flag == true)
                            {
                                ScriptManager.RegisterClientScriptBlock(this, GetType(), "Done", "alert('Co-Signed doctor does not have mandetory fields.');", true);
                            }
                            else
                            {
                                Bill_Sys_ProcedureCode_BO _bill_Sys_ProcedureCode_BO = new Bill_Sys_ProcedureCode_BO();
                                _bill_Sys_ProcedureCode_BO.UpdateCoSignedBy(Convert.ToInt32(txtEventPRocID.Text), extddlCoSignedby.Text, "UPDATE");
                                usrMessage1.PutMessage("Update Successfully");
                                usrMessage1.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
                                usrMessage1.Show();
                            }
                        }
                    }
                }//table count
            }
            else
            {
                Bill_Sys_ProcedureCode_BO _bill_Sys_ProcedureCode_BO = new Bill_Sys_ProcedureCode_BO();
                _bill_Sys_ProcedureCode_BO.UpdateCoSignedBy(Convert.ToInt32(txtEventPRocID.Text), "", "UPDATE");
                usrMessage1.PutMessage("Update Successfully");
                usrMessage1.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
                usrMessage1.Show();
            }
            //grdAllReports.XGridBindSearch();
        }
        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());
        }
    }