Пример #1
0
 /// <summary>
 /// 获得数据列表分页
 /// </summary>
 /// <returns></returns>
 public DataTable GetActiveSuccessfullProductInfoList(ActiveSuccessfullProductInfoTO TO, int pageIndex, int pageSize, string orderBy, out int rowCount)
 {
     return(service.GetActiveSuccessfullProductInfoList(TO, pageIndex, pageSize, orderBy, out rowCount));
 }
Пример #2
0
    private void DataBind()
    {
        ActiveSuccessfullProductInfoTO sto = new ActiveSuccessfullProductInfoTO();

        #region 条件
        if (!string.IsNullOrEmpty(Request["cname"]))
        {
            sto.CustomerName = Request["cname"].ToString().Trim();//存 客户名称
        }
        if (!string.IsNullOrEmpty(Request["uname"]))
        {
            sto.LoginName = Request["uname"].ToString().Trim();//存 客户名称
        }
        if (!string.IsNullOrEmpty(Request["stime"]))
        {
            DateTime dtStime = Convert.ToDateTime("1980-01-01");
            DateTime.TryParse(Request["stime"].ToString().Trim(), out dtStime);
            sto.StartTime = dtStime.ToString();//保存操作开始时间
        }
        if (!string.IsNullOrEmpty(Request["etime"]))
        {
            DateTime dtEtime = Convert.ToDateTime("2250-01-01");
            DateTime.TryParse(Request["etime"].ToString().Trim(), out dtEtime);
            sto.EndTime = dtEtime.ToString();//保存操作结束时间
        }

        #endregion
        if (!string.IsNullOrEmpty(Request.QueryString["pageIndex"]))
        {
            int.TryParse(Request.QueryString["pageIndex"], out pageIndex);
        }
        BLL.ActiveSuccessfullProductInfoBLL bll = new BLL.ActiveSuccessfullProductInfoBLL();
        DataTable dt = bll.GetActiveSuccessfullProductInfoList(sto, pageIndex, pageSize, "", out rowCount);
        //分页
        string getUrl = "";
        if (Request.Url.Query.Length > 0 && Request.Url.Query.IndexOf("pageIndex") > -1 && Request.Url.Query.IndexOf("&") > -1)
        {
            getUrl = Request.Url.Query.Substring(Request.Url.Query.IndexOf("&"));
        }
        else if (Request.Url.Query.Length > 0)
        {
            getUrl = Request.Url.Query.Substring(1);
        }
        string url = "CustomerSuccessfullList.aspx?pageIndex={0}&" + getUrl.Trim('&');
        strtt = DividePage.Pager(pageSize, rowCount, pageIndex, url);

        if (dt.Rows.Count > 0)
        {
            StringBuilder sbContent = new StringBuilder();
            string        strNew    = string.Empty;
            string        strEdit   = string.Empty;
            foreach (DataRow dr in dt.Rows)
            {
                strNew = string.Format("&nbsp;&nbsp;<a href=\"#\" name=\"WorkBill\" tid=\"{0}\" onclick=\"showErrorInfo(this)\" >查看</a>", dr["ID"], dr["CC_ID"]);
                sbContent.AppendFormat("<tbody>");
                sbContent.AppendFormat("<tr>");
                sbContent.AppendFormat("<td class=\"by\" style=\"width:120px;\" title=\"{0}\">{0}&nbsp;</td>", dr["CC_Name"]);
                sbContent.AppendFormat("<td class=\"num\" title=\"{0}\">{0}&nbsp;</td>", dr["CC_UserName"]);
                sbContent.AppendFormat("<td class=\"num\" title=\"{0}\">{0}&nbsp;</td>", dr["CC_Tel"]);
                sbContent.AppendFormat("<td class=\"num\" title=\"{0}\">{0}&nbsp;</td>", dr["LoginName"]);
                sbContent.AppendFormat("<td class=\"num\" title=\"{0}\">{0}&nbsp;</td>", dr["CName"]);
                sbContent.AppendFormat("<td class=\"num\" title=\"{0}\">{0}&nbsp;</td>", dr["IP"]);
                sbContent.AppendFormat("<td class=\"num\" style=\"width:100px;\" title=\"{0}\">{0}&nbsp;</td>", getDataFormate(dr["CreateDate"].ToString()));
                sbContent.AppendFormat("<td class=\"num\" tt='{0}'><div style='height:22px;overflow:hidden;width:120px'>{1}</div></td>", dr["ID"], dr["ErrorMessage"].ToString().Replace("$$", "$$<br \\>"));
                sbContent.AppendFormat("<td class=\"num\" >{0}&nbsp;</td>", strNew);
                sbContent.AppendFormat("</tr>");
                sbContent.AppendFormat("</tbody>");
            }

            script = sbContent.ToString();
        }
        else
        {
            script = "没有搜索到相关内容!";
        }
        //获取当前页
        //if (rowCount % pageSize == 0)
        //{
        //    pageNum = rowCount / pageSize;
        //}
        //else
        //{
        //    pageNum = (rowCount / pageSize) + 1;
        //}
    }
Пример #3
0
        /// <summary>
        /// 获取实体分页
        /// </summary>
        public DataTable GetActiveSuccessfullProductInfoList(ActiveSuccessfullProductInfoTO TO, int pageIndex, int pageSize, string orderBy, out int rowCount)
        {
            string table  = " ActiveSuccessfullProductInfo a left join (select Code,CName from ActiveProduct) c on c.Code=a.ProductID left join Call_Customer b on a.CustomerID=b.CC_ID ";
            string pk     = " ID ";
            string fields = " * ";
            string filter = "1=1";

            #region 组织查询条件

            if (!string.IsNullOrEmpty(TO.CustomerName))
            {
                filter += string.Format(" and CC_Name like '%{0}%' ", StringHelper.SQLFilter(TO.CustomerName));
            }

            if (!string.IsNullOrEmpty(TO.LoginName))
            {
                filter += string.Format(" and LoginName like '%{0}%' ", StringHelper.SQLFilter(TO.LoginName));
            }
            if (!string.IsNullOrEmpty(TO.StartTime))
            {
                DateTime dtStart = DateTime.Now;
                DateTime.TryParse(TO.StartTime, out dtStart);
                dtStart = dtStart.AddDays(-1);
                filter += string.Format(" and CreateDate >'{0}' ", dtStart.ToShortDateString());
            }
            if (!string.IsNullOrEmpty(TO.EndTime))
            {
                DateTime dtEnd = DateTime.Now;
                DateTime.TryParse(TO.EndTime, out dtEnd);
                dtEnd   = dtEnd.AddDays(1);
                filter += string.Format(" and CreateDate < '{0}' ", dtEnd.ToShortDateString());
            }
            #endregion

            string sort = " ID DESC ";//排序
            if (!string.IsNullOrEmpty(orderBy))
            {
                sort = orderBy;
            }

            SqlParameter[] parameters =
            {
                new SqlParameter("@Tables",    SqlDbType.VarChar, 1000),
                new SqlParameter("@PK",        SqlDbType.VarChar,  100),
                new SqlParameter("@Fields",    SqlDbType.VarChar, 1000),
                new SqlParameter("@Pageindex", SqlDbType.Int),
                new SqlParameter("@PageSize",  SqlDbType.Int),
                new SqlParameter("@Filter",    SqlDbType.VarChar, 1000),
                new SqlParameter("@Sort",      SqlDbType.VarChar,  200),
                new SqlParameter("@RowCount",  SqlDbType.Int)
            };
            parameters[0].Value     = table;
            parameters[1].Value     = pk;
            parameters[2].Value     = fields;
            parameters[3].Value     = pageIndex;
            parameters[4].Value     = pageSize;
            parameters[5].Value     = filter;
            parameters[6].Value     = sort;
            parameters[7].Direction = ParameterDirection.Output;

            DataSet ds = SqlHelper.RunProcedure("SP_DividePage", parameters, "ActiveSuccessfullProductInfoList");
            rowCount = (int)parameters[7].Value;
            return(ds.Tables[0]);
        }