using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; public partial class Customer_browse : CommonPage { //创建一个共用的客户bll Maticsoft.BLL.nr_z_kehu kehubll = new Maticsoft.BLL.nr_z_kehu(); //创建一个客户联系人bll Maticsoft.BLL.nr_z_lianxiren_kh khlxrbll = new Maticsoft.BLL.nr_z_lianxiren_kh(); //创建一个客户模板 Maticsoft.Model.nr_z_kehu kehumd = new Maticsoft.Model.nr_z_kehu(); //创建一个操作记录模板 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(); Maticsoft.BLL.nr_z_yhzh yonghu = new Maticsoft.BLL.nr_z_yhzh(); 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"]); initdata(id.Value); pdquanxian(user.juese); jialxr(); } } #region 获取真正数据值 private void initdata(string did) { int idz = Convert.ToInt32(did); kehumd = kehubll.GetModel(idz); if (kehumd != null) { bh.Text = kehumd.bianhao; khjc.Text = kehumd.khjc; mingcheng.Text = kehumd.mingcheng; //mingchengyw.Text = kehumd.mingchengyw; youbian.Text = kehumd.youbian; wangzhi.InnerText = kehumd.wangzhi; kaihuhang.Text = kehumd.kaihuhang; zhanghao.Text = kehumd.zhanghao; shuihao.Text = kehumd.shuihao; dianhua.Text = kehumd.dianhua; chuanzhen.Text = kehumd.chuanzhen; youjian.Text = kehumd.youxiang; xyed.Text = kehumd.shouxianedu.ToString(); riqi.Text =DateTime.Parse(kehumd.riqi.ToString()).ToString("yyyy-MM-dd"); try { //hangye.Text = bianma.GetModel(Convert.ToInt32(kehumd.hangye)).mingcheng; //xingzhi.Text = bianma.GetModel(Convert.ToInt32(kehumd.xingzhi)).mingcheng; //laiyuan.Text = bianma.GetModel(Convert.ToInt32(kehumd.laiyuan)).mingcheng; //leixing.Text = bianma.GetModel(Convert.ToInt32(kehumd.leixing)).mingcheng; //guimo.Text = bianma.GetModel(Convert.ToInt32(kehumd.guimo)).mingcheng; diqu.Text = bianma.GetModel(Convert.ToInt32( kehumd.diqu)).mingcheng; } catch { } //zhaopian.Src = "../Client_Folder/" + kehumd.zhaopian+ ""; //mingpian.Src = "../Client_Folder/" + kehumd.mingpian + ""; ywy.Text = kehumd.yewuyuan; dizhi.InnerText= kehumd.dizhi; //dizhiyw.InnerText = kehumd.dizhiyw; beizhu.Text = kehumd.beizhu; } } #endregion #region 添加联系人 private void jialxr() { DataSet lxrs=khlxrbll.GetList("kh_bh='" + bh.Text + "'"); string pin = "

联系人信息

" + ""; foreach(DataRow l in lxrs.Tables[0].Rows) { pin += "" + "" + "" + ""; } lianxiren.InnerHtml = pin + "
联系人分支部门联系方式备注
" + l["lianxiren"].ToString() + "" + l["zhiwei"].ToString() + "" + l["shouji"].ToString() + "" + l["beizhu"].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_kehu", "查看全部") == false && DBHlper.GetPermission(juese, "客户档案", "nr_z_kehu", "查看个人") == false) { Response.Redirect("../Common/nopower.htm"); } if (DBHlper.GetPermission(juese, "客户档案", "nr_z_kehu", "编辑个人") &&ywy.Text==user.zhanghao) { bt_tj.Visible = true; } if (DBHlper.GetPermission(juese, "客户档案", "nr_z_kehu", "编辑全部") ) { bt_tj.Visible = true; } if (DBHlper.GetPermission(juese, "客户档案", "nr_z_kehu", "删除个人") && ywy.Text == user.zhanghao) { bt_shanchu.Visible = true; shanchu.Visible = true; } if (DBHlper.GetPermission(juese, "客户档案", "nr_z_kehu", "删除全部") ) { bt_shanchu.Visible = true; shanchu.Visible = true; } if (DBHlper.GetPermission(juese, "客户档案", "nr_z_kehu", "添加")) { fuzhi.Visible = true; bt_add.Visible = true; } if (DBHlper.GetPermission(juese, "客户档案", "nr_z_kehu", "转交")) { zhuanjiao.Visible = true; } if (DBHlper.GetPermission(juese, "订单管理", "nr_z_dd", "添加")) { add_dd.Visible = true; } } #endregion protected void Shanchu_Click(object sender, EventArgs e) { if (DBHlper.ExecuteReid("select count(*) from nr_z_dd where kh_bh='" + bh.Text + "'") > 0) { z_error.Text = "该客户已有订单,不能删除!"; return; } if (DBHlper.ExecuteReid("select count(*) from nr_z_wuliao where kh_bh='" + bh.Text + "'") > 0) { z_error.Text = "该客户已有客户纸库了,不能删除!"; return; } kehumd = kehubll.GetModel(Convert.ToInt32(id.Value)); kehumd.zt = 0; bool ci = kehubll.Update(kehumd); 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("Customer_list.aspx", false); } else { Response.Write(""); } } }