using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ajax;
using System.Data;
public partial class ddselect_kehu_list : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["user"] == null)
{
Response.Redirect("../index.aspx");
}
}
Utility.RegisterTypeForAjax(typeof(ddselect_kehu_list));
Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]);
hiddenid.Value = user.juese.ToString();
Hiddenname.Value = user.zhanghao;
pdquanxian(user.juese);
}
#region 数据加载输出
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
public string page_change(int pg, int pageitem, string paixu, string tiaojian)
{
Maticsoft.Model.nr_z_yhzh zhanghao = (Maticsoft.Model.nr_z_yhzh)Session["user"];
string htmlcode = "";
string isexits = string.Format("select count(*) from nr_lt_paixu where userid='{0}' and tblname='{1}'", zhanghao.id, "view_nr_z_kehu");
int exitscount = DBHlper.getcount(isexits);
if (exitscount > 0)
{
string paixuselct = string.Format("select * from nr_lt_paixu where userid='{0}' and tblname='{1}' and isxianshi={2} order by shuixu ", zhanghao.id, "view_nr_z_kehu", 1);
DataTable dtselect = DBHlper.Execute(paixuselct).Tables[0];
string wherecode = string.Format("select top {0} ", pageitem);
foreach (DataRow dtr in dtselect.Rows)
{
wherecode += dtr["lieming"] + ",";
}
wherecode += "id";
if (DBHlper.getqx(zhanghao.juese, "客户档案", "nr_z_kehu", "查看全部"))
{
wherecode += string.Format(" from view_nr_z_kehu where " + tiaojian + " id not in(select top ({0}*{1}) id from view_nr_z_kehu)" + paixu, pg, pageitem);
}
else if (DBHlper.getqx(zhanghao.juese, "客户档案", "nr_z_kehu", "查看个人"))
{
wherecode += string.Format(" from view_nr_z_kehu where yewuyuan='" + zhanghao.zhanghao + "' and " + tiaojian + " id not in(select top ({0}*{1}) id from view_nr_z_kehu)" + paixu, pg, pageitem);
}
DataTable dt_paixu = DBHlper.Execute(wherecode).Tables[0];
if (dt_paixu.Rows.Count == 0)
{
return "
   没有数据
";
}
for (int i = 0; i < dt_paixu.Rows.Count; i++)
{
htmlcode += "