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_kc",1);
}
else
{
paixuselct=string.Format("select * from nr_lt_paixu where userid='{0}' and tblname='{1}' and lieming!='kh_bh' and isxianshi={2} order by shuixu ",zhanghao.id,"view_nr_z_kc",1);
stringwherecode=string.Format("select top {0} ",pageitem);
foreach(DataRowdtrindtselect.Rows)
{
wherecode+=dtr["lieming"]+",";
}
wherecode+="id";
wherecode+=string.Format(" from view_nr_z_kc where "+tiaojian+" id not in(select top ({0}*{1}) id from view_nr_z_kc"+" where "+tiaojian+" 1=1 "+paixu+")"+paixu,pg,pageitem);
stringcmdinsert=string.Format("insert into nr_lt_paixu values('{0}','{1}','{2}','{3}',{4},{5})",zhanghao.id,"view_nr_z_kc",liedr["ywlieming"],liedr["zwlieming"],lieshuixu,1);
DBHlper.excutecmd(cmdinsert);
}
return"";
}
}
#endregion
#region传入条数返回页数以便前台调用
[Ajax.AjaxMethod]
publicintmaxpage(intcount,stringtj)
{
intfanhuizhi=0;
stringcmd=string.Format("select count(*) from view_nr_z_kc "+tj);
stringupdatepaixu=string.Format("update nr_lt_paixu set shuixu={0},isxianshi={1} where id={2}",codezu[0],codezu[3],idfanhui);
DBHlper.excutecmd(updatepaixu);
}
else
{
stringpaixuinsert=string.Format("insert into nr_paixu (userid,tblname,lieming,zhongwen,shuixu,isxianshi) values('{0}','{1}','{2}','{3}',{4},{5})",yhzh.id,"nr_z_wuliao",codezu[2],codezu[1],codezu[0],codezu[3]);
stringpaixuselct=string.Format("select * from nr_lt_paixu where userid='{0}' and tblname='{1}' and isxianshi={2} order by shuixu ",zhanghao.id,"view_nr_z_kc",1);
cmd=string.Format("select CONVERT(varchar(12),riqi,111) as 'riqi' from view_nr_z_kc where riqi>='{0}' and riqi<='{1}' ",yuechu,yuemo);
}
else
{
cmd=string.Format("select CONVERT(varchar(12),riqi,111) as 'riqi' from view_nr_z_kc where riqi>='{0}' and riqi<='{1}' and kufang='"+option+"'",yuechu,yuemo);
DataTabledtcolmnname=DBHlper.Execute("select lieming,zhongwen from nr_lt_paixu where tblname='view_nr_z_kc' and isxianshi=1 and userid='"+((Maticsoft.Model.nr_z_yhzh)Session["user"]).id+"' order by shuixu").Tables[0];
stringtj=strwhere.Value;
stringselzt=drp_zt.SelectedItem.Value;
foreach(DataRowrindtcolmnname.Rows)
{
if(r["lieming"].ToString()=="kh_bh")
{
if(selzt=="客户纸库")
{
colmn+=r["lieming"].ToString()+',';
sList.Add(r["zhongwen"].ToString());
}
}
else
{
colmn+=r["lieming"].ToString()+',';
sList.Add(r["zhongwen"].ToString());
}
}
colmn=colmn.TrimEnd(',');
stringselectcode="";
if(selzt=="主料库")
{
selectcode="select "+colmn+" from view_nr_z_kc where zt='1' and kufang='主料库' ";
}
elseif(selzt=="辅料库")
{
selectcode="select "+colmn+" from view_nr_z_kc where zt='1' and kufang='辅料库' ";
}
elseif(selzt=="客户纸库")
{
selectcode="select "+colmn+" from view_nr_z_kc where zt='1' and kufang='客户纸库' ";
}
elseif(selzt=="")
{
selectcode="select "+colmn+" from view_nr_z_kc where zt='1' ";
}
if(tj!="")
{
selectcode+=tj.Replace("where","and");
}
if(selectid!="")
{
selectcode+=" and id in("+selectid.TrimEnd(',')+")";
}
DataTabledt=DBHlper.Execute(selectcode+" order by id desc").Tables[0];
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_kc",1);
}
else
{
paixuselct=string.Format("select * from nr_lt_paixu where userid='{0}' and tblname='{1}' and lieming!='kh_bh' and isxianshi={2} order by shuixu ",zhanghao.id,"view_nr_z_kc",1);