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 Supplier_browse : CommonPage { //创建一个共用的客户bll Maticsoft.BLL.nr_z_gyshang gysbll = new Maticsoft.BLL.nr_z_gyshang(); //创建一个供应商联系人bll Maticsoft.BLL.nr_z_lianxiren_gys gyslxrbll = new Maticsoft.BLL.nr_z_lianxiren_gys(); //创建一个供应商模板 Maticsoft.Model.nr_z_gyshang gysmd = new Maticsoft.Model.nr_z_gyshang(); //创建一个操作记录模板 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(); //创建一个编码模板 Maticsoft.BLL.nr_sys_bianma bianma = new Maticsoft.BLL.nr_sys_bianma(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["user"] == null) { Response.Redirect("../index.aspx"); } if (Request.QueryString["uid"] != null && Request.QueryString["uid"] != "") { id.Value = Request.QueryString["uid"].ToString(); } Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]); pdquanxian(user.juese); initdata(id.Value); jialxr(); } } #region 修改时获取真正数据值 private void initdata(string did) { int idz = Convert.ToInt32(did); gysmd = gysbll.GetModel(idz); if (gysmd != null) { bh.Text = gysmd.bianhao.ToString(); mingcheng.Text = gysmd.mingcheng.ToString(); youbian.Text = gysmd.youbian.ToString(); wangzhi.InnerText = gysmd.wangzhi.ToString(); kaihuhang.Text = gysmd.kaihuhang.ToString(); zhanghao.Text = gysmd.zhanghao.ToString(); shuihao.Text = gysmd.shuihao.ToString(); dianhua.Text = gysmd.dianhua.ToString(); chuanzhen.Text = gysmd.chuanzhen.ToString(); youjian.Text = gysmd.youjian; try { leixing.Text = bianma.GetModel(Convert.ToInt32(gysmd.leixing)).mingcheng; } catch { } riqi.Text = DateTime.Parse(gysmd.riqi.ToString()).ToString("yyyy-MM-dd"); dizhi.InnerText = gysmd.dizhi.ToString(); beizhu.Text = gysmd.beizhu.ToString(); } } #endregion #region 添加联系人 private void jialxr() { DataSet lxrs = gyslxrbll.GetList("gys_bh='" + bh.Text + "'"); string pin = "

联系人信息

" + ""; foreach (DataRow l in lxrs.Tables[0].Rows) { pin += "" + "" + ""; } lianxiren.InnerHtml = pin + "
联系人职务联系方式
" + l["lxr_name"].ToString() + "" + l["zhiwei"].ToString() + "" + l["dianhua"].ToString() + "
"; } #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_gyshang", "查看全部") == false ) { Response.Redirect("../Common/nopower.htm"); } if (DBHlper.GetPermission(juese, "供应商档案", "nr_z_gyshang", "编辑") ) { bt_tj.Visible = true; } if (DBHlper.GetPermission(juese, "供应商档案", "nr_z_gyshang", "删除") ) { shanchu.Visible = true; svshanchu.Visible = true; } if (DBHlper.GetPermission(juese, "供应商档案", "nr_z_gyshang", "添加") ) { fuzhi.Visible = true; bt_add.Visible = true; } } #endregion protected void Shanchu_Click(object sender, EventArgs e) { if (DBHlper.ExecuteReid("select count(*) from nr_z_caigoudan where gyshangid='" + id.Value + "'") > 0) { z_error.Text = "该供应商已有采购单,不能删除!"; return; } if (DBHlper.ExecuteReid("select count(*) from nr_z_caigoudan where gyshangid='" + id.Value + "'") > 0) { z_error.Text = "该供应商已有采购单,不能删除!"; return; } gysmd = gysbll.GetModel(Convert.ToInt32(id.Value)); gysmd.zt = 0; bool ci = gysbll.Update(gysmd); if (ci) { //给日志模板赋值 rizhi.riqi = DateTime.Now; rizhi.leixing = "供应商档案"; //将session转换对象取值 Maticsoft.Model.nr_z_yhzh zh = (Maticsoft.Model.nr_z_yhzh)Session["user"]; //拼接字符串插入日志 rizhi.jilu = zh.zhanghao + "删除了供应商档案,档案编号为:" + bh.Text.Trim(); rizhi.yonghuming = zh.zhanghao.ToString(); rizhibll.Add(rizhi); Response.Redirect("Supplier_list.aspx", false); } else { Response.Write(""); } } }