protected void btnDelete_Click(object sender, EventArgs e)
    {
        health_provider_id = Convert.ToInt32(Request.QueryString["healthProviderID"]);

        qHtl_HealthProvider provider = new qHtl_HealthProvider(health_provider_id);
        provider.Available = "No";
        provider.MarkAsDelete = 1;
        provider.Update();

        Response.Redirect("health-providers-list.aspx");
    }
    protected void btnSave_OnClick(object sender, System.EventArgs e)
    {
        Page.Validate("form");

        if (Page.IsValid)
        {
            int user_id = Convert.ToInt32(Context.Items["UserID"]);

            if (!String.IsNullOrEmpty(Request.QueryString["healthProviderID"]))
            {
                health_provider_id = Convert.ToInt32(Request.QueryString["healthProviderID"]);

                qHtl_HealthProvider provider = new qHtl_HealthProvider(health_provider_id);

                provider.Name = txtName.Text;
                provider.Description = txtSummary.Text;
                provider.HealthProviderType = ddlType.SelectedValue;
                provider.Address1 = txtAddress1.Text;
                provider.Address2 = txtAddress2.Text;
                provider.City = txtCity.Text;
                provider.StateProvince = ddlState.SelectedValue;
                provider.PostalCode = txtPostalCode.Text;
                provider.Country = ddlCountry.SelectedValue;
                provider.Phone = txtPhone.Text;

                provider.Update();
            }
            else
            {
                qHtl_HealthProvider provider = new qHtl_HealthProvider();

                provider.ScopeID = 1;
                provider.Created = DateTime.Now;
                provider.CreatedBy = user_id;
                provider.LastModified = DateTime.Now;
                provider.LastModifiedBy = user_id;
                provider.Available = "Yes";
                provider.MarkAsDelete = 0;
                provider.Name = txtName.Text;
                provider.Description = txtSummary.Text;
                provider.HealthProviderType = ddlType.SelectedValue;
                provider.Available = rblAvailable.SelectedValue;
                provider.Address1 = txtAddress1.Text;
                provider.Address2 = txtAddress2.Text;
                provider.City = txtCity.Text;
                provider.StateProvince = ddlState.SelectedValue;
                provider.PostalCode = txtPostalCode.Text;
                provider.Country = ddlCountry.SelectedValue;
                provider.Phone = txtPhone.Text;

                provider.Insert();

                health_provider_id = provider.HealthProviderID;
            }

            bool geo_coding_success;
            try
            {
                Quartz.Data.qDbs_CustomWorkflows qFlow = new Quartz.Data.qDbs_CustomWorkflows();
                int curr_user_id = Convert.ToInt32(Context.Items["UserID"]);
                string workflowSuccess = qFlow.RunWorkflow(107, 101, health_provider_id, curr_user_id);
                geo_coding_success = true;
            }
            catch
            {
                geo_coding_success = false;
            }

            if (!String.IsNullOrEmpty(Request.QueryString["healthProviderID"]))
            {
                if (geo_coding_success == true)
                {
                    lblMessage.Text = "*** Record Successfully Updated ***";
                    lblMessageBottom.Text = "*** Record Successfully Updated ***";
                }
                else
                {
                    lblMessage.Text = "*** Record Successfully Updated BUT GeoCoding of the Address Failed ***";
                    lblMessageBottom.Text = "*** Record Successfully Updated BUT GeoCoding of the Address Failed ***";
                }
            }
            else
            {
                Response.Redirect(Request.Url.ToString() + "?mode=add-successful&healthProviderID=" + health_provider_id);
            }
        }
    }