Exemple #1
0
    protected void GrdReferrer_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label        lblId                 = (Label)GrdReferrer.Rows[e.RowIndex].FindControl("lblId");
        DropDownList ddlRefs               = (DropDownList)GrdReferrer.Rows[e.RowIndex].FindControl("ddlRefs");
        TextBox      txtProviderNumber     = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtProviderNumber");
        CheckBox     chkIsReportEveryVisit = (CheckBox)GrdReferrer.Rows[e.RowIndex].FindControl("chkIsReportEveryVisit");
        CheckBox     chkIsBatchSendAllPatientsTreatmentNotes = (CheckBox)GrdReferrer.Rows[e.RowIndex].FindControl("chkIsBatchSendAllPatientsTreatmentNotes");


        RegisterReferrer regRef = RegisterReferrerDB.GetByID(Convert.ToInt32(lblId.Text));

        if (RegisterReferrerDB.Exists(regRef.Organisation.OrganisationID, Convert.ToInt32(ddlRefs.SelectedValue), regRef.RegisterReferrerID))
        {
            SetErrorMessage("Clinic is already linked to " + ddlRefs.SelectedItem.Text + ". If it is not visible, use the 'show deleted' checkbox and un-delete it.");
            GrdReferrer.EditIndex = -1;
            FillGrid();
            return;
        }

        RegisterReferrerDB.Update(
            regRef.RegisterReferrerID,
            regRef.Organisation.OrganisationID,
            Convert.ToInt32(ddlRefs.SelectedValue),
            txtProviderNumber.Text.Trim(),
            chkIsReportEveryVisit.Checked,
            chkIsBatchSendAllPatientsTreatmentNotes.Checked,
            regRef.DateLastBatchSendAllPatientsTreatmentNotes);

        GrdReferrer.EditIndex = -1;
        FillGrid();
    }
    protected void GrdReferrer_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label        lblId         = (Label)GrdReferrer.Rows[e.RowIndex].FindControl("lblId");
        DropDownList ddlTitle      = (DropDownList)GrdReferrer.Rows[e.RowIndex].FindControl("ddlTitle");
        TextBox      txtFirstname  = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtFirstname");
        TextBox      txtMiddlename = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtMiddlename");
        TextBox      txtSurname    = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtSurname");
        DropDownList ddlGender     = (DropDownList)GrdReferrer.Rows[e.RowIndex].FindControl("ddlGender");

        TextBox txtName = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtName");
        TextBox txtABN  = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtABN");
        TextBox txtACN  = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtACN");

        TextBox      txtProviderNumber     = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtProviderNumber");
        DropDownList ddlIsClinic           = (DropDownList)GrdReferrer.Rows[e.RowIndex].FindControl("ddlIsClinic");
        CheckBox     chkIsReportEveryVisit = (CheckBox)GrdReferrer.Rows[e.RowIndex].FindControl("chkIsReportEveryVisit");
        CheckBox     chkIsBatchSendAllPatientsTreatmentNotes = (CheckBox)GrdReferrer.Rows[e.RowIndex].FindControl("chkIsBatchSendAllPatientsTreatmentNotes");


        int registger_referrer_id = Convert.ToInt32(lblId.Text);

        DataTable dt = Session["referrerinfolist_data"] as DataTable;

        DataRow[] foundRows = dt.Select("register_referrer_id=" + registger_referrer_id.ToString());
        DataRow   row       = foundRows[0];

        RegisterReferrer rr = RegisterReferrerDB.Load(row);

        rr.Referrer              = ReferrerDB.Load(row);
        rr.Referrer.Person       = PersonDB.Load(row, "", "person_entity_id");
        rr.Referrer.Person.Title = IDandDescrDB.Load(row, "title_id", "descr");
        if (row["organisation_id"] != DBNull.Value)
        {
            rr.Organisation = OrganisationDB.Load(row, "", "organisation_entity_id", "organisation_is_deleted");
        }

        PersonDB.Update(rr.Referrer.Person.PersonID, Convert.ToInt32(ddlTitle.SelectedValue), Utilities.FormatName(txtFirstname.Text), Utilities.FormatName(txtMiddlename.Text), Utilities.FormatName(txtSurname.Text), row["nickname"].ToString(), ddlGender.SelectedValue, row["dob"] == DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(row["dob"]), DateTime.Now);
        OrganisationDB.UpdateExtOrg(rr.Organisation.OrganisationID, rr.Organisation.OrganisationType.OrganisationTypeID, txtName.Text, txtACN.Text, txtABN.Text, DateTime.Now, rr.Organisation.IsDebtor, rr.Organisation.IsCreditor, rr.Organisation.BpayAccount, rr.Organisation.Comment);
        RegisterReferrerDB.Update(rr.RegisterReferrerID, rr.Organisation.OrganisationID, rr.Referrer.ReferrerID, txtProviderNumber.Text, chkIsReportEveryVisit.Checked, chkIsBatchSendAllPatientsTreatmentNotes.Checked, rr.DateLastBatchSendAllPatientsTreatmentNotes);

        GrdReferrer.EditIndex = -1;
        FillGrid();
    }
    protected void GrdRegistration_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label        lblId                 = (Label)GrdRegistration.Rows[e.RowIndex].FindControl("lblId");
        DropDownList ddlReferrer           = (DropDownList)GrdRegistration.Rows[e.RowIndex].FindControl("ddlReferrer");
        TextBox      txtProviderNumber     = (TextBox)GrdRegistration.Rows[e.RowIndex].FindControl("txtProviderNumber");
        DropDownList ddlIsClinic           = (DropDownList)GrdRegistration.Rows[e.RowIndex].FindControl("ddlIsClinic");
        CheckBox     chkIsReportEveryVisit = (CheckBox)GrdRegistration.Rows[e.RowIndex].FindControl("chkIsReportEveryVisit");
        CheckBox     chkIsBatchSendAllPatientsTreatmentNotes = (CheckBox)GrdRegistration.Rows[e.RowIndex].FindControl("chkIsBatchSendAllPatientsTreatmentNotes");

        Organisation org = OrganisationDB.GetByID(GetFormID());

        if (org == null)
        {
            HideTableAndSetErrorMessage("");
            return;
        }

        RegisterReferrer registerReferrer = RegisterReferrerDB.GetByID(Convert.ToInt32(lblId.Text));

        RegisterReferrerDB.Update(Convert.ToInt32(lblId.Text), org.OrganisationID, Convert.ToInt32(ddlReferrer.SelectedValue), txtProviderNumber.Text, chkIsReportEveryVisit.Checked, chkIsBatchSendAllPatientsTreatmentNotes.Checked, registerReferrer.DateLastBatchSendAllPatientsTreatmentNotes);

        GrdRegistration.EditIndex = -1;
        FillGrid();
    }