Example #1
0
        protected void BindTemplateList()
        {
            int    i, j;
            string TemplateName           = txtTemplateName.Text.Trim();
            string StartDate              = txtStartDate.Text.Trim();
            string EndDate                = txtEndDate.Text.Trim();
            string Author                 = txtAuthor.Text.Trim();
            string TemplateStatus         = "";
            int    startIndex             = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize + 1;
            int    PageSize               = AspNetPager1.PageSize;
            TemplateManageComponent tmbll = new TemplateManageComponent();
            DataTable dt = tmbll.GetTemplateList(TemplateName, StartDate, EndDate, Author, TemplateStatus, AspNetPager1.CurrentPageIndex, PageSize, out i, out j);

            AspNetPager1.RecordCount = i;
            TemplateList.DataSource  = dt;
            TemplateList.DataBind();
        }
Example #2
0
        protected void BindTemplateList()
        {
            ViewState["id"] = null;
            int    i, j;
            string TemplateName = txtTemplateName.Text.Trim();

            ViewState["txtTemplateName"] = TemplateName;
            string StartDate = txtStartDate.Text.Trim();
            string EndDate   = txtEndDate.Text.Trim();
            string Author    = txtAuthor.Text.Trim();

            ViewState["txtAuthor"] = Author;
            string TemplateStatus = "";

            if (!string.IsNullOrWhiteSpace(hidisdefault.Value))
            {
                TemplateStatus = (ddlStatus.SelectedValue == "all" ? "" : ddlStatus.SelectedValue);
            }
            ViewState["ddlStatus"] = TemplateStatus;
            int    startIndex = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize + 1;
            int    PageSize   = AspNetPager1.PageSize;
            string bigcate    = (ddlCATEGORY.SelectedValue == "all" ? "" : ddlCATEGORY.SelectedValue);

            ViewState["ddlCATEGORY"] = bigcate;
            string smallcate = (ddlsmallcategory.SelectedValue == "all" ? "" : ddlsmallcategory.SelectedValue);

            ViewState["ddlsmallcategory"] = smallcate;
            DataTable dt = tmbll.GetTemplateList(TemplateName, bigcate, smallcate, Author, TemplateStatus, "", AspNetPager1.CurrentPageIndex, PageSize, out i, out j);

            if (dt != null && dt.Rows.Count > 0)
            {
                dt.Columns.Add("bs_row_num", Type.GetType("System.String"));
                dt.Columns.Add("bigcate", Type.GetType("System.String"));
                dt.Columns.Add("smallcate", Type.GetType("System.String"));
                dt.Columns.Add("statusname", Type.GetType("System.String"));
                dt.Columns.Add("pagelist", Type.GetType("System.String"));
                int       pindex     = (AspNetPager1.CurrentPageIndex - 1) * PageSize;
                DataTable bigdata    = null;
                DataTable statusdata = null;
                DataTable pagelist   = null;
                DataTable smalldata  = null;
                if (ViewState["bigcate"] != null)
                {
                    bigdata    = ViewState["bigcate"] as DataTable;
                    smalldata  = ViewState["smalldata"] as DataTable;
                    statusdata = ViewState["statusdata"] as DataTable;
                    pagelist   = ViewState["pagelist"] as DataTable;
                }
                else
                {
                    bigdata    = BaseComponent.GetBigCateData("/Lists/USER_LOOKUP_TYPES");
                    smalldata  = BaseComponent.GetBigCateData("/Lists/USER_LOOKUP_VALUES");
                    statusdata = BaseComponent.GetBigCateData("/Lists/SYS_LOOKUP_VALUES");
                    TemplateManageComponent pbll = new TemplateManageComponent();
                    pagelist                = pbll.GetPageList();
                    ViewState["bigcate"]    = bigdata;
                    ViewState["smalldata"]  = smalldata;
                    ViewState["statusdata"] = statusdata;
                    ViewState["pagelist"]   = pagelist;
                }
                foreach (DataRow dr in dt.Rows)
                {
                    pindex++;
                    dr["bs_row_num"] = pindex.ToString();
                    dr["bigcate"]    = BaseComponent.GetBigCateName(bigdata, dr["BigCategory"].ToString());
                    dr["smallcate"]  = BaseComponent.GetSmallCateName(smalldata, "模板-" + dr["BigCategory"].ToString(), dr["SmallCategory"].ToString());
                    dr["statusname"] = BaseComponent.GetStatusName(statusdata, "BS_TEMPLATE_STATUS", Convert.ToString(dr["TemplateStatus"]));
                    DataRow[] drs   = pagelist.Select("Templateid='" + dr["Templateid"].ToString() + "'");
                    string    pinfo = string.Empty;
                    if (drs != null)
                    {
                        foreach (DataRow dd in drs)
                        {
                            pinfo += "<a href='" + dd["Url"].ToString() + "' target='_blank' class='operateLink'>" + dd["PageName"].ToString() + "</a><br/>";
                        }
                    }
                    dr["pagelist"] = pinfo;
                }
            }
            AspNetPager1.RecordCount = i;
            TemplateList.DataSource  = dt;
            TemplateList.DataBind();
            if (dt == null || dt.Rows.Count == 0)
            {
                lblnodata.Visible = true;
            }
            else
            {
                lblnodata.Visible = false;
            }
            //ViewState["TemplateList"] = dt;
            ReCodePager();
        }