/// <summary> /// 获取实体分页 /// </summary> public DataTable GetCall_SatisfactionNewList(Call_SatisfactionNewTO TO, int pageIndex, int pageSize, string orderBy, out int rowCount) { string table = @" Call_SatisfactionNew a left join Call_Customer on CC_ID=CSN_CC_ID "; string pk = " CSN_ID "; string fields = " CC_Name,a.* "; string filter = ""; #region 组织查询条件 //if (!string.IsNullOrEmpty(TO.MC)) //{ // filter += string.Format(" and MC like '%{0}%' ", StringHelper.SQLFilter(TO.MC)); //} #endregion string sort = " CSN_ID ASC ";//排序 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, "Call_SatisfactionNewList"); rowCount = (int)parameters[7].Value; return(ds.Tables[0]); }
private void DataBind() { Call_SatisfactionNewTO sto = new Call_SatisfactionNewTO(); #region 条件 //if (!string.IsNullOrEmpty(Request["code"])) //{ // sto.CWB_Code = Request["code"].ToString().Trim();//存 客户名称 //} //if (!string.IsNullOrEmpty(Request["cname"])) //{ // sto.CWB_Remark = Request["cname"].ToString().Trim();//存 客户名称 //} //if (!string.IsNullOrEmpty(Request["uname"])) //{ // sto.CWB_Solution = Request["uname"].ToString().Trim();//存 用户名称 //} //else // sto.CWB_Solution = strLoginUserName; //if (!string.IsNullOrEmpty(Request["stime"])) //{ // DateTime dtStime = Convert.ToDateTime("1980-01-01"); // DateTime.TryParse(Request["stime"].ToString().Trim(), out dtStime); // sto.CWB_CreateTime = dtStime;//保存操作开始时间 //} //if (!string.IsNullOrEmpty(Request["etime"])) //{ // DateTime dtEtime = Convert.ToDateTime("2250-01-01"); // DateTime.TryParse(Request["etime"].ToString().Trim(), out dtEtime); // sto.CWB_OperationTime = dtEtime;//保存操作结束时间 //} //if (!string.IsNullOrEmpty(Request["Owner"])) //存 客户所属工程师 //{ // sto.CWB_Description = Request["Owner"].ToString().Trim(); //} //if (!string.IsNullOrEmpty(Request["sltType"])) //{ // sto.CWB_Type = Convert.ToInt16(Request["sltType"].ToString().Trim()); // intSelected = sto.CWB_Type; //} //if (!string.IsNullOrEmpty(Request["status"])) //{ // int intStatus = 0; // int.TryParse(Request["status"].ToString().Trim(), out intStatus); // sto.CWB_Status = intStatus; // intSelected = sto.CWB_Type; //} #endregion if (!string.IsNullOrEmpty(Request.QueryString["pageIndex"])) { int.TryParse(Request.QueryString["pageIndex"], out pageIndex); } HYTD.BLL.Call_SatisfactionNewBLL bll = new HYTD.BLL.Call_SatisfactionNewBLL(); DataTable dt = bll.GetCall_SatisfactionNewList(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 = "MYDList.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) { strEdit = string.Format("<a href=\"javascript:;\" name=\"EditWorkBill\" onclick=\"EditWorkBill({0})\">查看</a>", dr["CSN_ID"].ToString()); //if (dr["CWB_Status"].ToString() != ((int)PublicEnum.CallWorkBillStatus.Visited).ToString()) // strEdit += string.Format(" <a href=\"javascript:;\" name=\"EditWorkBill\" onclick=\"HuifangWorkBill({0})\">回访</a>", dr["CSN_ID"].ToString()); //sbContent.AppendFormat("<tbody>"); //if (dr["CWB_Status"].ToString() == "服务中") // sbContent.AppendFormat("<tr style=\"color:red;\">"); //else // sbContent.AppendFormat("<tr>"); sbContent.AppendFormat("<td class=\"num\" title=\"{0}\"><a href=\"javascript:;\" >{0}</a></td>", dr["CC_Name"].ToString()); sbContent.AppendFormat("<td class=\"num\" title=\"{0}\">{0} </td>", dr["CSN_UserIP"].ToString()); sbContent.AppendFormat("<td class=\"by\" style=\"width:120px;\" title=\"{0}\">{0} </td>", dr["CSN_UserUrl"]); sbContent.AppendFormat("<td class=\"num\" title=\"{0}\">{0} </td>", dr["CSN_UserCode"]); sbContent.AppendFormat("<td class=\"num\" title=\"{0}\">{0} </td>", dr["CSN_ServiceUserCode"]); sbContent.AppendFormat("<td class=\"num\" style=\"width:100px;\" title=\"{0}\">{0} </td>", getDataFormate(dr["CSN_CreateDate"].ToString())); sbContent.AppendFormat("<td class=\"num\" title=\"{0}\">{0} </td>", dr["CSN_IsSolve"] == "0"?"未解决":"已解决"); int intI = 0; int.TryParse(dr["CSN_ServiceEvaluation"].ToString(), out intI); sbContent.AppendFormat("<td class=\"num\" title=\"{0}\">{0} </td>", getResultForDC(intI)); intI = 0; int.TryParse(dr["CSN_ServiceEfficiency"].ToString(), out intI); sbContent.AppendFormat("<td class=\"num\" title=\"{0}\">{0} </td>", getResultForDC(intI)); intI = 0; int.TryParse(dr["CSN_ServiceAttitude"].ToString(), out intI); sbContent.AppendFormat("<td class=\"num\" title=\"{0}\">{0} </td>", getResultForDC(intI)); sbContent.AppendFormat("<td class=\"num\" title=\"{0}\">{0} </td>", dr["CSN_Improvement"]); sbContent.AppendFormat("<td class=\"num\">{0} </td>", strNew + strEdit); sbContent.AppendFormat("</tr>"); sbContent.AppendFormat("</tbody>"); } script = sbContent.ToString(); } else { script = "没有搜索到相关内容!"; } }
/// <summary> /// 获得数据列表分页 /// </summary> /// <returns></returns> public DataTable GetCall_SatisfactionNewList(Call_SatisfactionNewTO TO, int pageIndex, int pageSize, string orderBy, out int rowCount) { return(service.GetCall_SatisfactionNewList(TO, pageIndex, pageSize, orderBy, out rowCount)); }