public void SetInfo(int patientID, string formType)
    {
        this.PatientID = patientID;
        this.FormType  = GetFormTypeFromString(formType);

        UpdateInfo();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            HideErrorMessage();
            Utilities.UpdatePageHeaderV2(Page.Master, true);

            if (!IsPostBack)
            {
                PagePermissions.EnforcePermissions_RequireAny(Session, Response, true, true, true, false, true, false);

                SetupGUI();

                UrlParamType urlParamType = GetUrlParamType();
                if ((urlParamType == UrlParamType.Edit || urlParamType == UrlParamType.View) && IsValidFormID())
                {
                    FillEditViewForm(urlParamType == UrlParamType.Edit);
                }
                else if (GetUrlParamType() == UrlParamType.Add && IsValidFormID() && GetUrlParamCreditType() != UrlParamCreditType.None)
                {
                    FillEmptyAddForm();
                }
                else
                {
                    HideTableAndSetErrorMessage("", "Invalid URL Parameters");
                }
            }
        }
        catch (CustomMessageException ex)
        {
            if (IsPostBack)
            {
                SetErrorMessage(ex.Message);
            }
            else
            {
                HideTableAndSetErrorMessage(ex.Message);
            }
        }
        catch (Exception ex)
        {
            if (IsPostBack)
            {
                SetErrorMessage("", ex.ToString());
            }
            else
            {
                HideTableAndSetErrorMessage("", ex.ToString());
            }
        }
    }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            HideErrorMessage();
            Utilities.UpdatePageHeaderV2(Page.Master, true);

            if (!IsPostBack)
            {
                UrlParamType urlParamType = GetUrlParamType();
                if ((urlParamType == UrlParamType.Edit || urlParamType == UrlParamType.View) && IsValidFormID())
                {
                    FillEditViewForm(urlParamType == UrlParamType.Edit);
                }
                else if (GetUrlParamType() == UrlParamType.Add && IsValidFormID())
                {
                    FillEmptyAddForm();
                }
                else
                {
                    HideTableAndSetErrorMessage("");
                }
            }

            txtFlashingText.Focus();
        }
        catch (CustomMessageException ex)
        {
            if (IsPostBack)
            {
                SetErrorMessage(ex.Message);
            }
            else
            {
                HideTableAndSetErrorMessage(ex.Message);
            }
        }
        catch (Exception ex)
        {
            if (IsPostBack)
            {
                SetErrorMessage("", ex.ToString());
            }
            else
            {
                HideTableAndSetErrorMessage("", ex.ToString());
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            HideErrorMessage();
            Utilities.UpdatePageHeaderV2(Page.Master, true);

            if (!IsPostBack)
            {
                SetupGUI();

                UrlParamType urlParamType = GetUrlParamType();
                if ((urlParamType == UrlParamType.Edit || urlParamType == UrlParamType.Reconcile || urlParamType == UrlParamType.View || urlParamType == UrlParamType.ViewOnly) && IsValidFormID())
                {
                    FillEditViewForm(urlParamType == UrlParamType.Edit, urlParamType == UrlParamType.Reconcile);
                }
                else if (GetUrlParamType() == UrlParamType.Add && IsValidFormID())
                {
                    FillEmptyAddForm();
                }
                else
                {
                    HideTableAndSetErrorMessage("", "Invalid URL Parameters");
                }
            }
        }
        catch (CustomMessageException ex)
        {
            if (IsPostBack)
            {
                SetErrorMessage(ex.Message);
            }
            else
            {
                HideTableAndSetErrorMessage(ex.Message);
            }
        }
        catch (Exception ex)
        {
            if (IsPostBack)
            {
                SetErrorMessage("", ex.ToString());
            }
            else
            {
                HideTableAndSetErrorMessage("", ex.ToString());
            }
        }
    }
    public void SetupGUI()
    {
        UrlParamType urlParamType = GetUrlParamType();

        DataTable paymentTypes = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "ReceiptPaymentType", "", "descr", "receipt_payment_type_id,descr");

        ddlPaymentType.DataSource = paymentTypes;
        ddlPaymentType.DataBind();

        bool editable = GetUrlParamType() == UrlParamType.Add || GetUrlParamType() == UrlParamType.Edit || GetUrlParamType() == UrlParamType.Reconcile;

        Utilities.SetEditControlBackColour(ddlPaymentType, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);
        Utilities.SetEditControlBackColour(txtTotal, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);
        Utilities.SetEditControlBackColour(txtAmountReconciled, editable, System.Drawing.Color.LightGoldenrodYellow, System.Drawing.Color.Empty);
    }
Beispiel #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Utilities.SetNoCache(Response);
        }

        try
        {
            if (Session == null || Session["DB"] == null)
            {
                throw new SessionTimedOutException();
            }

            UrlParamType urlParamType = GetUrlParamType();

            if (urlParamType == UrlParamType.Insert)
            {
                Insert();
            }
            else if (urlParamType == UrlParamType.Update)
            {
                Update();
            }
            else if (urlParamType == UrlParamType.InsertHealthPoint)
            {
                InsertHealthPoint();
            }
            else if (urlParamType == UrlParamType.CanCancelHealthPointClaim)
            {
                CanCancelHealthPointClaim();
            }
            else
            {
                throw new Exception("Unknown type");
            }
        }
        catch (SessionTimedOutException)
        {
            Utilities.UnsetSessionVariables();
            Response.Write("SessionTimedOutException");
        }
        catch (Exception ex)
        {
            Response.Write("Exception: " + (Utilities.IsDev() ? ex.ToString() : "please contact system administrator."));
        }
    }
    protected void ConfirmOrDeleteOrCancelBooking(UrlParamType urlParamType)
    {
        Booking booking = UrlBooking;

        if (booking == null)
        {
            throw new Exception("Invalid url field booking_id");
        }

        if (urlParamType == UrlParamType.Delete)
        {
            BookingDB.UpdateSetDeleted(booking.BookingID, GetStaffID());
        }
        else if (urlParamType == UrlParamType.Confirm)
        {
            BookingDB.UpdateSetConfirmed(booking.BookingID, 1, GetStaffID());
        }
        else if (urlParamType == UrlParamType.Unconfirm)
        {
            BookingDB.UpdateSetUnconfirmed(booking.BookingID);
        }
        else if (urlParamType == UrlParamType.Arrived)
        {
            BookingDB.UpdateSetArrivalTime(booking.BookingID);
        }
        else if (urlParamType == UrlParamType.Unarrived)
        {
            BookingDB.RemoveArrivalTime(booking.BookingID);
        }
        else if (urlParamType == UrlParamType.Cancel)
        {
            BookingDB.UpdateSetCancelledByPatient(booking.BookingID, GetStaffID());
        }
        else if (urlParamType == UrlParamType.Deceased)
        {
            PatientDB.UpdateDeceased(booking.Patient.PatientID, GetStaffID());
            BookingDB.UpdateSetDeceasedByPatient(booking.BookingID);
        }
    }
Beispiel #8
0
    protected DataTable GetOrgsDaTatable(UrlParamType urlParamType, bool showDeleted, string searchName = "", bool searchNameOnlyStartsWith = false)
    {
        DataTable dt = null;

        switch (GetUrlParamType())
        {
        case UrlParamType.Clinic:
            dt = OrganisationDB.GetDataTable_Clinics(chkShowDeleted.Checked, searchName, searchNameOnlyStartsWith);
            break;

        case UrlParamType.AgedCare:
            dt = OrganisationDB.GetDataTable_AgedCareFacs(chkShowDeleted.Checked, searchName, searchNameOnlyStartsWith);
            break;

        case UrlParamType.Insurance:
            dt = OrganisationDB.GetDataTable_Insurance(chkShowDeleted.Checked, searchName, searchNameOnlyStartsWith);
            break;

        case UrlParamType.External:
            if (IsValidFormOrgTypeIDs())
            {
                dt = OrganisationDB.GetDataTable_External(chkShowDeleted.Checked, searchName, searchNameOnlyStartsWith, true, GetFormOrgTypeIDs());
            }
            else
            {
                dt = OrganisationDB.GetDataTable_External(chkShowDeleted.Checked, searchName, searchNameOnlyStartsWith);
            }
            break;

        default:
            dt = OrganisationDB.GetDataTable(0, chkShowDeleted.Checked, true, false, false, true, false, searchName, searchNameOnlyStartsWith);
            break;
        }

        return(dt);
    }
Beispiel #9
0
    protected void GrdOrganisation_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("Insert"))
        {
            DropDownList ddlParent = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlNewParent");
            DropDownList ddlUseParentOffernigPrices = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlUseParentOffernigPrices");
            TextBox      txtName         = (TextBox)GrdOrganisation.FooterRow.FindControl("txtNewName");
            DropDownList ddlType         = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlNewType");
            DropDownList ddlCustType     = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlNewCustType");
            TextBox      txtABN          = (TextBox)GrdOrganisation.FooterRow.FindControl("txtNewABN");
            TextBox      txtACN          = (TextBox)GrdOrganisation.FooterRow.FindControl("txtNewACN");
            TextBox      txtBPayAccount  = (TextBox)GrdOrganisation.FooterRow.FindControl("txtNewBPayAccount");
            DropDownList ddlServiceCycle = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlNewServiceCycle");
            DropDownList ddlIsDebtor     = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlNewIsDebtor");
            DropDownList ddlIsCreditor   = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlNewIsCreditor");
            DropDownList ddlFreeServices = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlNewFreeServices");

            TimeSpan defaultDayStartTime      = new TimeSpan(8, 0, 0);
            TimeSpan defaultDayEndTime        = new TimeSpan(20, 0, 0);
            TimeSpan defaultDayLunchStartTime = new TimeSpan(12, 0, 0);
            TimeSpan defaultDayLunchEndTime   = new TimeSpan(12, 0, 0);

            UrlParamType urlParamType = GetUrlParamType();
            if (urlParamType == UrlParamType.External)
            {
                if (urlParamType == UrlParamType.External && IsValidFormOrgTypeIDs() && GetFormOrgTypeIDs() == "191")
                {
                    OrganisationDB.InsertExtOrg(Convert.ToInt32(GetFormOrgTypeIDs()), txtName.Text, txtACN.Text, txtABN.Text,
                                                OrganisationTypeDB.IsDebtor(191), OrganisationTypeDB.IsCreditor(191), "", "");
                }
                else
                {
                    OrganisationDB.Insert(Convert.ToInt32(ddlParent.SelectedValue), false, Convert.ToInt32(ddlType.SelectedValue), Convert.ToInt32(ddlCustType.SelectedValue), txtName.Text, txtACN.Text, txtABN.Text,
                                          OrganisationTypeDB.IsDebtor(Convert.ToInt32(ddlType.SelectedValue)), OrganisationTypeDB.IsCreditor(Convert.ToInt32(ddlType.SelectedValue)),

                                          "", 0, DateTime.MinValue, DateTime.MinValue, "", 0,
                                          //txtBPayAccount.Text, Convert.ToInt32(ddlServiceCycle.SelectedValue),
                                          //DateTime.MinValue DateTime.MinValue, "", Convert.ToInt32(ddlFreeServices.SelectedValue),

                                          false, false, false, false, false, false, false,
                                          defaultDayStartTime, defaultDayEndTime,
                                          defaultDayStartTime, defaultDayEndTime,
                                          defaultDayStartTime, defaultDayEndTime,
                                          defaultDayStartTime, defaultDayEndTime,
                                          defaultDayStartTime, defaultDayEndTime,
                                          defaultDayStartTime, defaultDayEndTime,
                                          defaultDayStartTime, defaultDayEndTime,
                                          defaultDayLunchStartTime, defaultDayLunchEndTime,
                                          defaultDayLunchStartTime, defaultDayLunchEndTime,
                                          defaultDayLunchStartTime, defaultDayLunchEndTime,
                                          defaultDayLunchStartTime, defaultDayLunchEndTime,
                                          defaultDayLunchStartTime, defaultDayLunchEndTime,
                                          defaultDayLunchStartTime, defaultDayLunchEndTime,
                                          defaultDayLunchStartTime, defaultDayLunchEndTime,
                                          DateTime.MinValue);
                }
            }
            else
            {
                OrganisationDB.Insert(Convert.ToInt32(ddlParent.SelectedValue), Convert.ToBoolean(ddlUseParentOffernigPrices.SelectedValue), Convert.ToInt32(ddlType.SelectedValue), Convert.ToInt32(ddlCustType.SelectedValue), txtName.Text, txtACN.Text, txtABN.Text,
                                      OrganisationTypeDB.IsDebtor(Convert.ToInt32(ddlType.SelectedValue)), OrganisationTypeDB.IsCreditor(Convert.ToInt32(ddlType.SelectedValue)),
                                      txtBPayAccount.Text, Convert.ToInt32(ddlServiceCycle.SelectedValue),
                                      DateTime.MinValue, DateTime.MinValue, "", Convert.ToInt32(ddlFreeServices.SelectedValue),
                                      true, false, false, false, false, false, true,
                                      defaultDayStartTime, defaultDayEndTime,
                                      defaultDayStartTime, defaultDayEndTime,
                                      defaultDayStartTime, defaultDayEndTime,
                                      defaultDayStartTime, defaultDayEndTime,
                                      defaultDayStartTime, defaultDayEndTime,
                                      defaultDayStartTime, defaultDayEndTime,
                                      defaultDayStartTime, defaultDayEndTime,
                                      defaultDayLunchStartTime, defaultDayLunchEndTime,
                                      defaultDayLunchStartTime, defaultDayLunchEndTime,
                                      defaultDayLunchStartTime, defaultDayLunchEndTime,
                                      defaultDayLunchStartTime, defaultDayLunchEndTime,
                                      defaultDayLunchStartTime, defaultDayLunchEndTime,
                                      defaultDayLunchStartTime, defaultDayLunchEndTime,
                                      defaultDayLunchStartTime, defaultDayLunchEndTime,
                                      DateTime.MinValue);
            }

            FillGrid();
        }

        if (e.CommandName.Equals("_Delete") || e.CommandName.Equals("_UnDelete"))
        {
            int organisation_id = Convert.ToInt32(e.CommandArgument);

            try
            {
                if (e.CommandName.Equals("_Delete"))
                {
                    OrganisationDB.UpdateInactive(organisation_id);
                }
                else
                {
                    OrganisationDB.UpdateActive(organisation_id);
                }
            }
            catch (ForeignKeyConstraintException fkcEx)
            {
                if (Utilities.IsDev())
                {
                    SetErrorMessage("Can not delete because other records depend on this : " + fkcEx.Message);
                }
                else
                {
                    SetErrorMessage("Can not delete because other records depend on this");
                }
            }

            FillGrid();
        }
    }
Beispiel #10
0
    protected void GrdOrganisation_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label        lblId     = (Label)GrdOrganisation.Rows[e.RowIndex].FindControl("lblId");
        DropDownList ddlParent = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlParent");
        DropDownList ddlUseParentOffernigPrices = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlUseParentOffernigPrices");
        TextBox      txtName         = (TextBox)GrdOrganisation.Rows[e.RowIndex].FindControl("txtName");
        DropDownList ddlType         = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlType");
        DropDownList ddlCustType     = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlCustType");
        TextBox      txtABN          = (TextBox)GrdOrganisation.Rows[e.RowIndex].FindControl("txtABN");
        TextBox      txtACN          = (TextBox)GrdOrganisation.Rows[e.RowIndex].FindControl("txtACN");
        TextBox      txtBPayAccount  = (TextBox)GrdOrganisation.Rows[e.RowIndex].FindControl("txtBPayAccount");
        DropDownList ddlServiceCycle = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlServiceCycle");
        DropDownList ddlIsDebtor     = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlIsDebtor");
        DropDownList ddlIsCreditor   = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlIsCreditor");
        DropDownList ddlFreeServices = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlFreeServices");
        TextBox      txtStartDate    = (TextBox)GrdOrganisation.Rows[e.RowIndex].FindControl("txtStartDate");
        TextBox      txtEndDate      = (TextBox)GrdOrganisation.Rows[e.RowIndex].FindControl("txtEndDate");


        Organisation org = OrganisationDB.GetByID(Convert.ToInt32(lblId.Text));

        UrlParamType urlParamType = GetUrlParamType();
        int          orgTypeID    = Convert.ToInt32(ddlType.SelectedValue);

        if (urlParamType == UrlParamType.Clinic)
        {
            orgTypeID = 218;
        }

        DateTime startDate = GetDate(txtStartDate.Text.Trim());
        DateTime endDate   = GetDate(txtEndDate.Text.Trim());

        if (urlParamType == UrlParamType.External)
        {
            if (urlParamType == UrlParamType.External && IsValidFormOrgTypeIDs() && GetFormOrgTypeIDs() == "191")
            {
                OrganisationDB.UpdateExtOrg(Convert.ToInt32(lblId.Text), Convert.ToInt32(GetFormOrgTypeIDs()), txtName.Text, txtACN.Text, txtABN.Text, DateTime.Now,
                                            org.IsDebtor, org.IsCreditor, org.BpayAccount, org.Comment);
            }
            else
            {
                OrganisationDB.Update(Convert.ToInt32(lblId.Text), Convert.ToInt32(ddlParent.SelectedValue), org.UseParentOffernigPrices, Convert.ToInt32(ddlType.SelectedValue), Convert.ToInt32(ddlCustType.SelectedValue), txtName.Text,

                                      org.Acn, org.Abn, org.IsDebtor, org.IsCreditor, org.BpayAccount, org.WeeksPerServiceCycle, org.StartDate, org.EndDate, org.Comment, org.FreeServices,
                                      //txtACN.Text, txtABN.Text,
                                      //Convert.ToBoolean(ddlIsDebtor.SelectedValue), Convert.ToBoolean(ddlIsCreditor.SelectedValue), txtBPayAccount.Text, Convert.ToInt32(ddlServiceCycle.SelectedValue),
                                      //org.StartDate, org.EndDate, org.Comment, Convert.ToInt32(ddlFreeServices.SelectedValue),

                                      org.ExclSun, org.ExclMon, org.ExclTue, org.ExclWed, org.ExclThu, org.ExclFri, org.ExclSat,
                                      org.SunStartTime, org.SunEndTime,
                                      org.MonStartTime, org.MonEndTime,
                                      org.TueStartTime, org.TueEndTime,
                                      org.WedStartTime, org.WedEndTime,
                                      org.ThuStartTime, org.ThuEndTime,
                                      org.FriStartTime, org.FriEndTime,
                                      org.SatStartTime, org.SatEndTime,
                                      org.SunLunchStartTime, org.SunLunchEndTime,
                                      org.MonLunchStartTime, org.MonLunchEndTime,
                                      org.TueLunchStartTime, org.TueLunchEndTime,
                                      org.WedLunchStartTime, org.WedLunchEndTime,
                                      org.ThuLunchStartTime, org.ThuLunchEndTime,
                                      org.FriLunchStartTime, org.FriLunchEndTime,
                                      org.SatLunchStartTime, org.SatLunchEndTime,
                                      org.LastBatchRun);
            }
        }
        else
        {
            OrganisationDB.Update(Convert.ToInt32(lblId.Text), Convert.ToInt32(ddlParent.SelectedValue), Convert.ToBoolean(ddlUseParentOffernigPrices.SelectedValue), Convert.ToInt32(ddlType.SelectedValue), Convert.ToInt32(ddlCustType.SelectedValue), txtName.Text, txtACN.Text, txtABN.Text,
                                  org.IsDebtor, org.IsCreditor, txtBPayAccount.Text, Convert.ToInt32(ddlServiceCycle.SelectedValue),
                                  startDate, endDate, org.Comment, Convert.ToInt32(ddlFreeServices.SelectedValue),
                                  org.ExclSun, org.ExclMon, org.ExclTue, org.ExclWed, org.ExclThu, org.ExclFri, org.ExclSat,
                                  org.SunStartTime, org.SunEndTime,
                                  org.MonStartTime, org.MonEndTime,
                                  org.TueStartTime, org.TueEndTime,
                                  org.WedStartTime, org.WedEndTime,
                                  org.ThuStartTime, org.ThuEndTime,
                                  org.FriStartTime, org.FriEndTime,
                                  org.SatStartTime, org.SatEndTime,
                                  org.SunLunchStartTime, org.SunLunchEndTime,
                                  org.MonLunchStartTime, org.MonLunchEndTime,
                                  org.TueLunchStartTime, org.TueLunchEndTime,
                                  org.WedLunchStartTime, org.WedLunchEndTime,
                                  org.ThuLunchStartTime, org.ThuLunchEndTime,
                                  org.FriLunchStartTime, org.FriLunchEndTime,
                                  org.SatLunchStartTime, org.SatLunchEndTime, org.LastBatchRun);
        }


        GrdOrganisation.EditIndex = -1;
        FillGrid();
    }
Beispiel #11
0
    protected void GrdOrganisation_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (!Utilities.IsDev() && e.Row.RowType != DataControlRowType.Pager)
        {
            e.Row.Cells[0].CssClass = "hiddencol";
        }


        UrlParamType urlParamType = GetUrlParamType();

        if (e.Row.Cells.Count > 2)
        {
            if (urlParamType == UrlParamType.External)
            {
                // dont have booking link for external orgs
                e.Row.Cells[16].CssClass = "hiddencol";
            }
        }

        if (urlParamType == UrlParamType.Insurance)
        {
            if (e.Row.Cells.Count > 1)
            {
                e.Row.Cells[1].CssClass = "hiddencol";
            }
            if (e.Row.Cells.Count > 2)
            {
                e.Row.Cells[2].CssClass = "hiddencol";
            }
        }


        if (e.Row.RowType != DataControlRowType.Pager)
        {
            foreach (DataControlField col in GrdOrganisation.Columns)
            {
                // remove type
                if (urlParamType == UrlParamType.Clinic && col.SortExpression == "organisation_type_id")
                {
                    e.Row.Cells[GrdOrganisation.Columns.IndexOf(col)].CssClass = "hiddencol";
                }

                // remove external stuff -- remember to insert/update it for inserts/updates
                if (urlParamType == UrlParamType.External)
                {
                    if (col.SortExpression == "bpay_account" ||
                        col.SortExpression == "weeks_per_service_cycle" ||
                        col.SortExpression == "free_services" ||
                        col.SortExpression == "start_date" ||
                        col.SortExpression == "end_date" ||
                        col.SortExpression == "last_batch_run")
                    {
                        e.Row.Cells[GrdOrganisation.Columns.IndexOf(col)].CssClass = "hiddencol";
                    }
                }

                if (urlParamType == UrlParamType.External && IsValidFormOrgTypeIDs() && GetFormOrgTypeIDs() == "191")
                {
                    if (col.SortExpression == "parent_organisation_id" ||
                        col.SortExpression == "use_parent_offernig_prices" ||
                        col.SortExpression == "organisation_type_id" ||
                        col.SortExpression == "ct_organisation_customer_type_id")
                    {
                        e.Row.Cells[GrdOrganisation.Columns.IndexOf(col)].CssClass = "hiddencol";
                    }
                }

                if (urlParamType == UrlParamType.Insurance)
                {
                    if (col.SortExpression == "parent_organisation_id" ||
                        col.SortExpression == "use_parent_offernig_prices" ||
                        col.SortExpression == "organisation_type_id" ||
                        col.SortExpression == "ct_organisation_customer_type_id" ||
                        col.SortExpression == "bpay_account" ||
                        col.SortExpression == "weeks_per_service_cycle" ||
                        col.SortExpression == "free_services" ||
                        col.SortExpression == "start_date" ||
                        col.SortExpression == "end_date" ||
                        col.SortExpression == "last_batch_run")
                    {
                        e.Row.Cells[GrdOrganisation.Columns.IndexOf(col)].CssClass = "hiddencol";
                    }
                }


                if (!chkShowDeleted.Checked)
                {
                    if (col.SortExpression == "is_deleted")
                    {
                        e.Row.Cells[GrdOrganisation.Columns.IndexOf(col)].CssClass = "hiddencol";
                    }
                }

                if (col.SortExpression == "is_debtor" || col.SortExpression == "is_creditor")
                {
                    e.Row.Cells[GrdOrganisation.Columns.IndexOf(col)].CssClass = "hiddencol";
                }

                // only admins can delete or view deleted
                if (GrdOrganisation.Columns.IndexOf(col) == GrdOrganisation.Columns.Count - 1)
                {
                    UserView userView = UserView.GetInstance();
                    if (!userView.IsAdminView)
                    {
                        e.Row.Cells[GrdOrganisation.Columns.IndexOf(col)].CssClass = "hiddencol";
                    }
                }
            }
        }
    }
    protected void ConfirmOrDeleteOrCancelBooking(UrlParamType urlParamType)
    {
        Booking booking = UrlBooking;
        if (booking == null)
            throw new Exception("Invalid url field booking_id");

        if (urlParamType == UrlParamType.Delete)
            BookingDB.UpdateSetDeleted(booking.BookingID, GetStaffID());
        else if (urlParamType == UrlParamType.Confirm)
            BookingDB.UpdateSetConfirmed(booking.BookingID, 1, GetStaffID());
        else if (urlParamType == UrlParamType.Unconfirm)
            BookingDB.UpdateSetUnconfirmed(booking.BookingID);
        else if (urlParamType == UrlParamType.Arrived)
            BookingDB.UpdateSetArrivalTime(booking.BookingID);
        else if (urlParamType == UrlParamType.Unarrived)
            BookingDB.RemoveArrivalTime(booking.BookingID);
        else if (urlParamType == UrlParamType.Cancel)
            BookingDB.UpdateSetCancelledByPatient(booking.BookingID, GetStaffID());
        else if (urlParamType == UrlParamType.Deceased)
        {
            PatientDB.UpdateDeceased(booking.Patient.PatientID, GetStaffID());
            BookingDB.UpdateSetDeceasedByPatient(booking.BookingID);
        }
    }
    protected DataTable GetOrgsDaTatable(UrlParamType urlParamType, bool showDeleted, string searchName = "", bool searchNameOnlyStartsWith = false)
    {
        DataTable dt = null;
        switch (GetUrlParamType())
        {
            case UrlParamType.Clinic:
                dt = OrganisationDB.GetDataTable_Clinics(chkShowDeleted.Checked, searchName, searchNameOnlyStartsWith);
                break;
            case UrlParamType.AgedCare:
                dt = OrganisationDB.GetDataTable_AgedCareFacs(chkShowDeleted.Checked, searchName, searchNameOnlyStartsWith);
                break;
            case UrlParamType.Insurance:
                dt = OrganisationDB.GetDataTable_Insurance(chkShowDeleted.Checked, searchName, searchNameOnlyStartsWith);
                break;
            case UrlParamType.External:
                if (IsValidFormOrgTypeIDs())
                    dt = OrganisationDB.GetDataTable_External(chkShowDeleted.Checked, searchName, searchNameOnlyStartsWith, true, GetFormOrgTypeIDs());
                else
                    dt = OrganisationDB.GetDataTable_External(chkShowDeleted.Checked, searchName, searchNameOnlyStartsWith);
                break;
            default:
                dt = OrganisationDB.GetDataTable(0, chkShowDeleted.Checked, true, false, false, true, false, searchName, searchNameOnlyStartsWith);
                break;
        }

        return dt;
    }