Пример #1
0
    protected void Sort(string sortExpression, params string[] sortExpr)
    {
        DataTable dataTable = Session["organisationinfo_data"] as DataTable;

        if (dataTable != null)
        {
            if (Session["organisationinfo_sortexpression"] == null)
            {
                Session["organisationinfo_sortexpression"] = "";
            }

            DataView dataView = new DataView(dataTable);
            string[] sortData = Session["organisationinfo_sortexpression"].ToString().Trim().Split(' ');

            string newSortExpr = (sortExpr.Length == 0) ?
                                 (sortExpression == sortData[0] && sortData[1] == "ASC") ? "DESC" : "ASC" :
                                 sortExpr[0];

            dataView.Sort = sortExpression + " " + newSortExpr;
            Session["organisationinfo_sortexpression"] = sortExpression + " " + newSortExpr;

            GrdOrganisation.DataSource = dataView;
            GrdOrganisation.DataBind();
        }
    }
    protected void GrdOrganisation_Sorting(object sender, GridViewSortEventArgs e)
    {
        // dont allow sorting if in edit mode
        if (GrdOrganisation.EditIndex >= 0)
        {
            return;
        }

        DataTable dataTable = Session["organisationlist_data"] as DataTable;

        if (dataTable != null)
        {
            if (Session["organisationlist_sortexpression"] == null)
            {
                Session["organisationlist_sortexpression"] = "";
            }

            DataView dataView    = new DataView(dataTable);
            string[] sortData    = Session["organisationlist_sortexpression"].ToString().Trim().Split(' ');
            string   newSortExpr = (e.SortExpression == sortData[0] && sortData[1] == "ASC") ? "DESC" : "ASC";
            dataView.Sort = e.SortExpression + " " + newSortExpr;
            Session["organisationlist_sortexpression"] = e.SortExpression + " " + newSortExpr;

            GrdOrganisation.DataSource = dataView;
            GrdOrganisation.DataBind();
        }
    }
    protected void FillOrganisationGrid()
    {
        UserView userView = UserView.GetInstance();

        lblHeading.Text = !userView.IsAgedCareView ? "Facilitys" : "Clinics";

        int       patientID = IsValidFormPatient() ? GetFormPatient(false) : -1;
        DataTable dt        = patientID == -1 ?
                              OrganisationDB.GetDataTable(0, false, true, !userView.IsClinicView && !userView.IsGPView, !userView.IsAgedCareView, true, true, txtSearchOrganisation.Text.Trim(), chkOrganisationSearchOnlyStartWith.Checked) :
                              RegisterPatientDB.GetDataTable_OrganisationsOf(patientID, true, !userView.IsClinicView && !userView.IsGPView, !userView.IsAgedCareView, true, true, txtSearchOrganisation.Text.Trim(), chkOrganisationSearchOnlyStartWith.Checked);

        Session["organisationlist_data"] = dt;

        if (dt.Rows.Count > 0)
        {
            if (IsPostBack && Session["organisationlist_sortexpression"] != null && Session["organisationlist_sortexpression"].ToString().Length > 0)
            {
                DataView dataView = new DataView(dt);
                dataView.Sort = Session["organisationlist_sortexpression"].ToString();
                GrdOrganisation.DataSource = dataView;
            }
            else
            {
                GrdOrganisation.DataSource = dt;
            }


            try
            {
                GrdOrganisation.DataBind();
                GrdOrganisation.PagerSettings.FirstPageText = "1";
                GrdOrganisation.PagerSettings.LastPageText  = GrdOrganisation.PageCount.ToString();
                GrdOrganisation.DataBind();
            }
            catch (Exception ex)
            {
                this.lblErrorMessage.Visible = true;
                this.lblErrorMessage.Text    = ex.ToString();
            }
        }
        else
        {
            dt.Rows.Add(dt.NewRow());
            GrdOrganisation.DataSource = dt;
            GrdOrganisation.DataBind();

            int TotalColumns = GrdOrganisation.Rows[0].Cells.Count;
            GrdOrganisation.Rows[0].Cells.Clear();
            GrdOrganisation.Rows[0].Cells.Add(new TableCell());
            GrdOrganisation.Rows[0].Cells[0].ColumnSpan = TotalColumns;
            GrdOrganisation.Rows[0].Cells[0].Text       = "No Record Found";
        }
    }
Пример #4
0
    protected void FillGrid()
    {
        Page.Title = ((SystemVariables)Session["SystemVariables"])["Site"].Value + " - " + (UserView.GetInstance().IsClinicView ? "Clinics" : "Facilies");

        string searchName = "";

        if (Request.QueryString["name_search"] != null && Request.QueryString["name_search"].Length > 0)
        {
            searchName         = Request.QueryString["name_search"];
            txtSearchName.Text = Request.QueryString["name_search"];
        }
        bool searchNameOnlyStartsWith = true;

        if (Request.QueryString["name_starts_with"] != null && Request.QueryString["name_starts_with"].Length > 0)
        {
            searchNameOnlyStartsWith       = Request.QueryString["name_starts_with"] == "0" ? false : true;
            chkSearchOnlyStartWith.Checked = searchNameOnlyStartsWith;
        }
        else
        {
            chkSearchOnlyStartWith.Checked = searchNameOnlyStartsWith;
        }


        DataTable dt = GetOrgsDaTatable(GetUrlParamType(), chkShowDeleted.Checked, searchName, searchNameOnlyStartsWith);

        Session["organisationinfo_data"] = dt;

        if (dt.Rows.Count > 0)
        {
            if (IsPostBack && Session["organisationinfo_sortexpression"] != null && Session["organisationinfo_sortexpression"].ToString().Length > 0)
            {
                DataView dataView = new DataView(dt);
                dataView.Sort = Session["organisationinfo_sortexpression"].ToString();
                GrdOrganisation.DataSource = dataView;
            }
            else
            {
                GrdOrganisation.DataSource = dt;
            }

            GrdOrganisation.AllowPaging = false;

            try
            {
                GrdOrganisation.DataBind();
                GrdOrganisation.PagerSettings.FirstPageText = "1";
                GrdOrganisation.PagerSettings.LastPageText  = GrdOrganisation.PageCount.ToString();
                GrdOrganisation.DataBind();
            }
            catch (Exception ex)
            {
                HideTableAndSetErrorMessage("", ex.ToString());
            }
        }
        else
        {
            dt.Rows.Add(dt.NewRow());
            GrdOrganisation.DataSource = dt;
            GrdOrganisation.DataBind();

            int TotalColumns = GrdOrganisation.Rows[0].Cells.Count;
            GrdOrganisation.Rows[0].Cells.Clear();
            GrdOrganisation.Rows[0].Cells.Add(new TableCell());
            GrdOrganisation.Rows[0].Cells[0].ColumnSpan = TotalColumns;
            GrdOrganisation.Rows[0].Cells[0].Text       = "No Record Found";
        }
    }
Пример #5
0
    protected void FillOrganisationGrid()
    {
        UserView userView = UserView.GetInstance();

        int patientID = IsValidFormPatient() ? GetFormPatient(false) : -1;
        //DataTable dt = patientID == -1 ?
        //    OrganisationDB.GetDataTable(false, true, !incClinics, !incAgedCare, true, txtSearchOrganisation.Text.Trim(), chkOrganisationSearchOnlyStartWith.Checked) :
        //    RegisterPatientDB.GetDataTable_OrganisationsOf(patientID, true, !incClinics, !incAgedCare, true, txtSearchOrganisation.Text.Trim(), chkOrganisationSearchOnlyStartWith.Checked);
        //DataTable dt = patientID == -1 ?
        //    OrganisationDB.GetDataTable(false, true, !incClinics, !incAgedCare, true, "", false) :
        //    RegisterPatientDB.GetDataTable_OrganisationsOf(patientID, true, !incClinics, !incAgedCare, true, "", false);
        DataTable dt = OrganisationDB.GetDataTable(0, false, true, !userView.IsClinicView && !userView.IsGPView, !userView.IsAgedCareView, true, true, "", false);

        if (dt.Rows.Count == 1)
        {
            Response.Redirect("~/BookingsV2.aspx?orgs=" + dt.Rows[0]["organisation_id"] + (Request.QueryString["patient"] != null ? "&patient=" + Request.QueryString["patient"] : ""));
            return;
        }

        Session["selectorganisation_data"] = dt;

        if (dt.Rows.Count > 0)
        {
            if (IsPostBack && Session["selectorganisation_sortexpression"] != null && Session["selectorganisation_sortexpression"].ToString().Length > 0)
            {
                DataView dataView = new DataView(dt);
                dataView.Sort = Session["selectorganisation_sortexpression"].ToString();
                GrdOrganisation.DataSource = dataView;
            }
            else
            {
                GrdOrganisation.DataSource = dt;
            }


            try
            {
                GrdOrganisation.DataBind();
                GrdOrganisation.PagerSettings.FirstPageText = "1";
                GrdOrganisation.PagerSettings.LastPageText  = GrdOrganisation.PageCount.ToString();
                GrdOrganisation.DataBind();
            }
            catch (Exception ex)
            {
                this.lblErrorMessage.Visible = true;
                this.lblErrorMessage.Text    = ex.ToString();
            }
        }
        else
        {
            dt.Rows.Add(dt.NewRow());
            GrdOrganisation.DataSource = dt;
            GrdOrganisation.DataBind();

            int TotalColumns = GrdOrganisation.Rows[0].Cells.Count;
            GrdOrganisation.Rows[0].Cells.Clear();
            GrdOrganisation.Rows[0].Cells.Add(new TableCell());
            GrdOrganisation.Rows[0].Cells[0].ColumnSpan = TotalColumns;
            GrdOrganisation.Rows[0].Cells[0].Text       = "No Record Found";
        }
    }