Esempio n. 1
0
        //private void displayData(DataTable dt)
        //{
        //    string name = "";
        //    string sname = "";

        //    dt.Columns.Add("linktext", typeof(string));

        //    int idx = 1;
        //    string sidx = "";
        //    foreach (DataRow dr in dt.Rows)
        //    {
        //        name = "<b><i>" + dr["name"].ToString().Replace(" f. ", " </i>f.<i> ") + "</i> " + dr["author"] + "</b>";
        //        sname = "<i>" + dr["name1"].ToString().Replace(" f. ", " </i>f.<i> ") + "</i> " + dr["author1"];
        //        sidx = String.Format("{0,4}", idx).Replace(" ", "&nbsp;");

        //        if (dr["tid"].ToString() == dr["tid1"].ToString())
        //            dr["linktext"] = sidx + ". <a href='../taxonomydetail.aspx?id=" + dr["tid"] + "'>" + name.Trim() + "</a>";
        //        else
        //            dr["linktext"] = sidx + ". <a href='../taxonomydetail.aspx?id=" + dr["tid"] + "'>" + sname.Trim() + " (=" + name.Trim() + ")</a>";

        //        idx++;
        //    }

        //    rptResult.DataSource = dt;
        //    rptResult.DataBind();
        //}

        private void displayData(DataTable dt)
        {
            string name  = "";
            string sname = "";

            dt.Columns.Add("linktext", typeof(string));
            dt.Columns.Add("sorttext", typeof(string));

            foreach (DataRow dr in dt.Rows)
            {
                name  = "<b><i>" + dr["name"].ToString().Replace(" f. ", " </i>f.<i> ") + "</i> " + dr["author"] + "</b>";
                sname = "<i>" + dr["name1"].ToString().Replace(" f. ", " </i>f.<i> ") + "</i> " + dr["author1"];

                if (dr["tid"].ToString() == dr["tid1"].ToString())
                {
                    dr["linktext"] = TaxonUtil.ItalicTaxon(" <a href='../taxonomydetail.aspx?id=" + dr["tid"] + "'>" + name.Trim() + "</a>");
                }
                else
                {
                    dr["linktext"] = TaxonUtil.ItalicTaxon(" <a href='../taxonomydetail.aspx?id=" + dr["tid"] + "'>" + sname.Trim() + " (=" + name.Trim() + ")</a>");
                }

                dr["sorttext"] = TaxonUtil.RemoveTaxon(dr["name1"].ToString());
            }
            dt.DefaultView.Sort = "sorttext";

            rptResult.DataSource = dt;
            rptResult.DataBind();
        }
        //private string displayData(string search, DataTable dt, string level)
        //{
        //    pnlSearch.Visible = false;
        //    pnlResult.Visible = true;
        //    txtSearch2.Text = "New Search";

        //    string name = "";
        //    string sname = "";

        //    dt.Columns.Add("linktext", typeof(string));

        //    int idx = 1;
        //    string sidx = "";
        //    foreach (DataRow dr in dt.Rows)
        //    {
        //        name = "<b><i>" + dr["name"].ToString().Replace(" f. ", " </i>f.<i> ") + "</i> " + dr["author"] + "</b>";
        //        sname = "<i>" + dr["name1"].ToString().Replace(" f. ", " </i>f.<i> ") + "</i> " + dr["author1"];
        //        sidx = String.Format("{0,4}", idx).Replace(" ", "&nbsp;");

        //        if (dr["tid"].ToString() == dr["tid1"].ToString())
        //            dr["linktext"] = sidx + ". <a href='../taxonomydetail.aspx?id=" + dr["tid"] + "'>" + name.Trim() + "</a>";
        //        else
        //            dr["linktext"] = sidx + ". <a href='../taxonomydetail.aspx?id=" + dr["tid1"] + "'>" + sname.Trim() + " (=" + name.Trim() + ")</a>";

        //        //dr["linktext"] = inx + ". <a href='../taxonomydetail.aspx?id=" + dr["tid"] + "'>" + "<i>" + dr["name"].ToString().Replace(" f. ", " </i>f.<i> ") + "</i> " + dr["species_authority"] + "</a>";
        //        idx++;
        //    }

        //    rptResult.DataSource = dt;
        //    rptResult.DataBind();
        //    lblCriteria.Text = "(for the query: <b>" + level + "</b> = <i>" + search + "</i>)";
        //    lblCriteria.Focus();

        //    return "(for the query: <b>" + level + "</b> = <i>" + search + "</i>)";
        //}

        private string displayData(string search, DataTable dt, string level)
        {
            pnlSearch.Visible = false;
            pnlResult.Visible = true;
            txtSearch2.Text   = "New Search";

            string name  = "";
            string sname = "";

            dt.Columns.Add("linktext", typeof(string));
            dt.Columns.Add("sorttext", typeof(string));

            foreach (DataRow dr in dt.Rows)
            {
                name  = "<b><i>" + dr["name"].ToString() + "</i> " + dr["author"] + "</b>";
                sname = "<i>" + dr["name1"].ToString() + "</i> " + dr["author1"];

                if (dr["tid"].ToString() == dr["tid1"].ToString())
                {
                    dr["linktext"] = TaxonUtil.ItalicTaxon(" <a href='../taxonomydetail.aspx?id=" + dr["tid"] + "'>" + name.Trim() + "</a>");
                }
                else
                {
                    dr["linktext"] = TaxonUtil.ItalicTaxon(" <a href='../taxonomydetail.aspx?id=" + dr["tid1"] + "'>" + sname.Trim() + " (=" + name.Trim() + ")</a>");
                }

                //dr["sorttext"] = dr["name1"].ToString().Replace(" subsp. ", " ").Replace(" var. ", " ");
                dr["sorttext"] = TaxonUtil.RemoveTaxon(dr["name1"].ToString());
            }
            dt.DefaultView.Sort = "sorttext";

            rptResult.DataSource = dt;
            rptResult.DataBind();
            lblCriteria.Text = "(for the query: <b>" + level + "</b> = <i>" + search + "</i>)";
            lblCriteria.Focus();

            return("(for the query: <b>" + level + "</b> = <i>" + search + "</i>)");
        }