164 lines
5.4 KiB
C#
164 lines
5.4 KiB
C#
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;
|
|
using System.IO;
|
|
using System.Data.OleDb;
|
|
using System.Collections;
|
|
using System.Text;
|
|
public partial class BaozhuangXinxi : System.Web.UI.Page
|
|
{
|
|
|
|
Maticsoft.Model.nr_sys_rizhi rizhi = new Maticsoft.Model.nr_sys_rizhi();
|
|
//创建一个操作记录bll
|
|
Maticsoft.BLL.nr_sys_rizhi rizhibll = new Maticsoft.BLL.nr_sys_rizhi();
|
|
|
|
int jsid = 0;
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
if (Session["user"] == null)
|
|
{
|
|
Response.Redirect("../index.aspx");
|
|
}
|
|
|
|
}
|
|
Utility.RegisterTypeForAjax(typeof(BaozhuangXinxi));
|
|
Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]);
|
|
hiddenid.Value = user.juese.ToString();
|
|
Hiddenname.Value = user.zhanghao;
|
|
jsid = user.juese;
|
|
pdquanxian(jsid);
|
|
}
|
|
|
|
#region 数据加载输出
|
|
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
|
|
public string page_change(int pg, int pageitem, string paixu, string tiaojian)
|
|
{
|
|
return "";
|
|
}
|
|
#endregion
|
|
|
|
#region 传入条数返回页数以便前台调用
|
|
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
|
|
public int maxpage(int count, string tj)
|
|
{
|
|
int fanhuizhi = 0;
|
|
|
|
return fanhuizhi;
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 数据排序
|
|
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
|
|
public void itempaixu(string code)
|
|
{
|
|
Maticsoft.Model.nr_z_yhzh yhzh = (Maticsoft.Model.nr_z_yhzh)Session["user"];
|
|
string[] codezu = code.Split(',');
|
|
string cmdexits = string.Format("select id from nr_lt_paixu where userid='{0}' and tblname='{1}' and lieming='{2}'", yhzh.id, "view_nr_z_cpkc", codezu[2]);
|
|
DataTable paixutable = DBHlper.Execute(cmdexits).Tables[0];
|
|
if (paixutable.Rows.Count > 0)
|
|
{
|
|
int idfanhui = Convert.ToInt32(paixutable.Rows[0][0]);
|
|
string updatepaixu = string.Format("update nr_lt_paixu set shuixu={0},isxianshi={1} where id={2}", codezu[0], codezu[3], idfanhui);
|
|
DBHlper.excutecmd(updatepaixu);
|
|
|
|
}
|
|
else
|
|
{
|
|
string paixuinsert = string.Format("insert into nr_paixu (userid,tblname,lieming,zhongwen,shuixu,isxianshi) values('{0}','{1}','{2}','{3}',{4},{5})", yhzh.id, "view_nr_z_cpkc", codezu[2], codezu[1], codezu[0], codezu[3]);
|
|
DBHlper.excutecmd(paixuinsert);
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 列头排序
|
|
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
|
|
public string paixu()
|
|
{
|
|
Maticsoft.Model.nr_z_yhzh zhanghao = (Maticsoft.Model.nr_z_yhzh)Session["user"];
|
|
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_cpkc", 1);
|
|
DataTable dtselect = DBHlper.Execute(paixuselct).Tables[0];
|
|
string htmlcode = "<td style='width:20px'></td>";
|
|
foreach (DataRow dr in dtselect.Rows)
|
|
{
|
|
htmlcode += string.Format("<td tag='{0}'>{1}</td>", dr["lieming"], dr["zhongwen"]);
|
|
}
|
|
return htmlcode;
|
|
}
|
|
#endregion
|
|
|
|
#region 获取隐藏的列
|
|
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
|
|
public string yincanglie(int endid)
|
|
{
|
|
Maticsoft.Model.nr_z_yhzh zhanghao = (Maticsoft.Model.nr_z_yhzh)Session["user"];
|
|
endid = endid - 1;
|
|
string displaycmd = "select * from nr_lt_paixu where isxianshi=0 and tblname='view_nr_z_cpkc' and userid='" + zhanghao.id + "'";
|
|
DataTable distable = DBHlper.Execute(displaycmd).Tables[0];
|
|
string htmlcode = "";
|
|
foreach (DataRow dr in distable.Rows)
|
|
{
|
|
endid++;
|
|
htmlcode += "<tr class='tr_item' id='tr_" + endid + "'><td style='width:30%'>" + endid + "</td><td style='width:30%' tag=" + dr["lieming"] + ">" + dr["zhongwen"] + "</td><td style='width:30%'><input type='checkbox'/></td> </tr>";
|
|
}
|
|
return htmlcode;
|
|
}
|
|
#endregion
|
|
|
|
#region 查询数据总数
|
|
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
|
|
public int sumitem(string wheretj)
|
|
{
|
|
string selectcmd = "select count(*) from view_nr_z_cpkc " + wheretj;
|
|
Maticsoft.Model.nr_z_yhzh yhzh = (Maticsoft.Model.nr_z_yhzh)Session["user"];
|
|
if (!DBHlper.GetPermission(yhzh.juese, "产品档案", "nr_z_cpkc", "查看全部"))
|
|
{
|
|
if (wheretj == "")
|
|
{
|
|
selectcmd += " where yewuyuan='" + yhzh.zhanghao + "'";
|
|
}
|
|
else
|
|
{
|
|
selectcmd += " and yewuyuan='" + yhzh.zhanghao + "'";
|
|
}
|
|
}
|
|
int sumcount = DBHlper.getcount(selectcmd);
|
|
return sumcount;
|
|
}
|
|
#endregion
|
|
|
|
#region 敏感权限查看
|
|
void pdquanxian(int juese)
|
|
{
|
|
Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]);
|
|
if (DBHlper.getzt(user.id) != 1)
|
|
{
|
|
Response.Redirect("../index.aspx");
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
#endregion
|
|
#region 判断查看权限
|
|
[Ajax.AjaxMethod]
|
|
public string isquanxian(int uid)
|
|
{
|
|
|
|
|
|
return "1";
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
} |