2024-05-18 15:28:29 +08:00
|
|
|
|
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 = "<table width='100%' class='bule'> <tr class='tdlietou'><td colspan='4'><h4>联系人信息</h4></td></tr></table><table width='100%' class='bule'>"
|
|
|
|
|
+ "<tr class='tbtilt'><td><span>联系人</span></td><td><span>职务</span></td><td><span>联系方式</span></td></tr>";
|
|
|
|
|
foreach (DataRow l in lxrs.Tables[0].Rows)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
pin += "<tr><td ><span>" + l["lxr_name"].ToString() + "</span></td>"
|
|
|
|
|
+ "<td><span>" + l["zhiwei"].ToString() + "</span></td>"
|
|
|
|
|
+ "<td ><span >" + l["dianhua"].ToString() + "</span></td></tr>";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
lianxiren.InnerHtml = pin + "</table>";
|
|
|
|
|
}
|
|
|
|
|
#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");
|
|
|
|
|
}
|
2024-05-21 15:05:24 +08:00
|
|
|
|
if (DBHlper.GetPermission(juese, "供应商档案", "nr_z_gyshang", "查看全部") == false )
|
2024-05-18 15:28:29 +08:00
|
|
|
|
{
|
|
|
|
|
Response.Redirect("../Common/nopower.htm");
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-21 15:05:24 +08:00
|
|
|
|
if (DBHlper.GetPermission(juese, "供应商档案", "nr_z_gyshang", "编辑") )
|
2024-05-18 15:28:29 +08:00
|
|
|
|
{
|
|
|
|
|
bt_tj.Visible = true;
|
|
|
|
|
}
|
2024-05-21 15:05:24 +08:00
|
|
|
|
if (DBHlper.GetPermission(juese, "供应商档案", "nr_z_gyshang", "删除") )
|
2024-05-18 15:28:29 +08:00
|
|
|
|
{
|
|
|
|
|
shanchu.Visible = true;
|
|
|
|
|
svshanchu.Visible = true;
|
|
|
|
|
}
|
2024-05-21 15:05:24 +08:00
|
|
|
|
if (DBHlper.GetPermission(juese, "供应商档案", "nr_z_gyshang", "添加") )
|
2024-05-18 15:28:29 +08:00
|
|
|
|
{
|
|
|
|
|
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("<script>alert('删除失败')</script>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|