using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; public partial class OtherIncome_browse : System.Web.UI.Page { Maticsoft.BLL.nr_z_qtsr qtsrbll = new Maticsoft.BLL.nr_z_qtsr(); Maticsoft.Model.nr_z_qtsr qtsrmodel = new Maticsoft.Model.nr_z_qtsr(); Maticsoft.BLL.nr_sys_rizhi rizhibll = new Maticsoft.BLL.nr_sys_rizhi(); Maticsoft.Model.nr_sys_rizhi rizhimodel = new Maticsoft.Model.nr_sys_rizhi(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["user"] == null) { Response.Redirect("../index.aspx"); } Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]); if (Request.QueryString["uid"] != null && Request.QueryString["uid"].ToString().Length > 0) { string uid = Request.QueryString["uid"].ToString(); id.Value = uid; } initdata(id.Value); pdquanxian(user.juese); } } #region 修改时获取真正数据值 private void initdata(string did) { DataTable dt = DBHlper.Execute("select * from view_nr_z_qtsr where id=" + did).Tables[0]; bh.Text = dt.Rows[0]["bh"].ToString(); riqi.Text = DateTime.Parse(dt.Rows[0]["riqi"].ToString()).ToString("yyyy-MM-dd"); srzhonglei.Text = dt.Rows[0]["srzl"].ToString(); jine.Text = dt.Rows[0]["je"].ToString(); jsr.Text = dt.Rows[0]["jsr"].ToString(); sx.Text = dt.Rows[0]["sx"].ToString(); beizhu.Text = dt.Rows[0]["bz"].ToString(); shzt.Text = dt.Rows[0]["zt"].ToString(); khbh.Text = dt.Rows[0]["khbh"].ToString(); khmc.Text = dt.Rows[0]["khmc"].ToString(); if (shzt.Text == "通过") { btn_tongguo.Enabled = false; btn_tongguo.BackColor = System.Drawing.Color.Gray; shanchu.Enabled = false; shanchu.BackColor = System.Drawing.Color.Gray; btn_bj.Enabled = false; btn_bj.BackColor = System.Drawing.Color.Gray; } if (shzt.Text == "不过") { btn_butongguo.Enabled = false; btn_butongguo.BackColor = System.Drawing.Color.Gray; shanchu.Enabled = false; shanchu.BackColor = System.Drawing.Color.Gray; } } #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"); } if (DBHlper.GetPermission(juese, "其它收入", "nr_z_qtsr", "查看全部") == false && DBHlper.GetPermission(juese, "其它收入", "nr_z_qtsr", "查看个人") == false) { Response.Redirect("../Common/nopower.htm"); } if (DBHlper.GetPermission(juese, "其它收入", "nr_z_qtsr", "编辑个人") && jsr.Text == user.zhanghao) { btn_bj.Visible = true; } if (DBHlper.GetPermission(juese, "其它收入", "nr_z_qtsr", "编辑全部")) { btn_bj.Visible = true; } if (DBHlper.GetPermission(juese, "其它收入", "nr_z_qtsr", "删除个人") && jsr.Text == user.zhanghao) { shanchu.Visible = true; } if (DBHlper.GetPermission(juese, "其它收入", "nr_z_qtsr", "删除全部")) { shanchu.Visible = true; } if (DBHlper.GetPermission(juese, "其它收入", "nr_z_qtsr", "审核")) { btn_tongguo.Visible = true; btn_butongguo.Visible = true; } if (DBHlper.GetPermission(juese, "其它收入", "nr_z_qtsr", "添加")) { bt_add.Visible = true; } } #endregion //删除 protected void btn_delete(object o, EventArgs e) { int qtskid = Convert.ToInt32(id.Value); if (qtsrbll.Delete(qtskid)) { Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]); rizhimodel.leixing = "其它收入"; rizhimodel.yonghuming = user.zhanghao; rizhimodel.riqi = DateTime.Now; rizhimodel.jilu = rizhimodel.yonghuming+"删除了其它收入;编号为:"+bh.Text; rizhibll.Add(rizhimodel); Response.Redirect("OtherIncome_list.aspx"); } } //审核通过 protected void btntongguo_Click(object sender, EventArgs e) { DBHlper.excutecmd("update nr_z_qtsr set zt='通过' where id=" + id.Value); Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]); rizhimodel.leixing = "其它收入"; rizhimodel.yonghuming = user.zhanghao; rizhimodel.riqi = DateTime.Now; rizhimodel.jilu = rizhimodel.yonghuming + "审核通过了其它收入;编号为:" + bh.Text; rizhibll.Add(rizhimodel); Response.Redirect("OtherIncome_browse.aspx?uid=" + id.Value); } //审核不通过 protected void btn_butong_Click(object sender, EventArgs e) { DBHlper.excutecmd("update nr_z_qtsr set zt='不过' where id=" + id.Value); Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]); rizhimodel.leixing = "其它收入"; rizhimodel.yonghuming = user.zhanghao; rizhimodel.riqi = DateTime.Now; rizhimodel.jilu = rizhimodel.yonghuming + "审核不过了其它收入;编号为:" + bh.Text; rizhibll.Add(rizhimodel); Response.Redirect("OtherIncome_browse.aspx?uid=" + id.Value); } protected void bt_tj_Click(object sender, EventArgs e) { Response.Redirect("OtherIncome_Form.aspx?uid=" + id.Value); } protected void bt_add_Click(object sender, EventArgs e) { Response.Redirect("OtherIncome_Form.aspx"); } }