141 lines
4.7 KiB
C#
141 lines
4.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using Maticsoft.BLL;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
public partial class CustomerTransfer : CommonPage
|
|
{
|
|
//创建一个共用的客户bll
|
|
Maticsoft.BLL.nr_z_kehu kehubll = new Maticsoft.BLL.nr_z_kehu();
|
|
//创建一个客户模板
|
|
Maticsoft.Model.nr_z_kehu kehumd = new Maticsoft.Model.nr_z_kehu();
|
|
//创建一个用户模板
|
|
Maticsoft.Model.nr_z_yhzh yonghumd = new Maticsoft.Model.nr_z_yhzh();
|
|
//创建一个用户bll
|
|
Maticsoft.BLL.nr_z_yhzh yonghubll = new Maticsoft.BLL.nr_z_yhzh();
|
|
//创建一个操作记录模板
|
|
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();
|
|
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"]);
|
|
pdquanxian(user.juese);
|
|
if (Request.QueryString["uid"] != null && Request.QueryString["uid"] != "")
|
|
{
|
|
id.Value = Request.QueryString["uid"].ToString();
|
|
initdata(id.Value);
|
|
binddata();
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#region 用来初始化绑定下拉框等值
|
|
private void binddata()
|
|
{
|
|
DataSet yhlist = yonghubll.GetList("1=1");
|
|
if (yhlist != null)
|
|
{
|
|
to_ywy.DataSource = yhlist.Tables[0].DefaultView;
|
|
to_ywy.DataValueField = "zhanghao";
|
|
to_ywy.DataTextField = "zhanghao";
|
|
to_ywy.DataBind();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 获取真正数据值
|
|
private void initdata(string did)
|
|
{
|
|
int idz = Convert.ToInt32(did);
|
|
kehumd = kehubll.GetModel(idz);
|
|
if (kehumd != null)
|
|
{
|
|
bh.Text = kehumd.bianhao.ToString();
|
|
ywy.Text = kehumd.yewuyuan.ToString();
|
|
mc.Text = kehumd.mingcheng.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)
|
|
{
|
|
Response.Redirect("../Common/nopower.htm");
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
protected void bt_tj_Click(object sender, EventArgs e)
|
|
{
|
|
if (rb_sign.SelectedValue == "N")
|
|
{
|
|
int idz = Convert.ToInt32(id.Value);
|
|
kehumd = kehubll.GetModel(idz);
|
|
kehumd.yewuyuan = to_ywy.SelectedValue;
|
|
bool pd = kehubll.Update(kehumd);
|
|
if (pd)
|
|
{
|
|
|
|
//给日志模板赋值
|
|
rizhi.riqi = DateTime.Now;
|
|
rizhi.leixing = "客户档案";
|
|
//将session转换对象取值
|
|
Maticsoft.Model.nr_z_yhzh zh = (Maticsoft.Model.nr_z_yhzh)Session["user"];
|
|
//拼接字符串插入日志
|
|
rizhi.jilu = zh.zhanghao + "转交了客户档案,接受人为:" + to_ywy.SelectedValue + ";档案编号为:" + bh.Text.Trim();
|
|
rizhi.yonghuming = zh.zhanghao.ToString();
|
|
rizhibll.Add(rizhi);
|
|
Response.Redirect("Customer_list.aspx", false);
|
|
}
|
|
else
|
|
{
|
|
Response.Redirect("../Common/error.aspx");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
int rt= DBHlper.excutecmd("update nr_z_kehu set yewuyuan='" + to_ywy.SelectedValue + "'where yewuyuan='" + ywy.Text + "'");
|
|
if (rt>0)
|
|
{
|
|
//给日志模板赋值
|
|
rizhi.riqi = DateTime.Now;
|
|
rizhi.leixing = "客户档案";
|
|
//将session转换对象取值
|
|
Maticsoft.Model.nr_z_yhzh zh = (Maticsoft.Model.nr_z_yhzh)Session["user"];
|
|
//拼接字符串插入日志
|
|
rizhi.jilu = zh.zhanghao + "转交了全部客户档案,接受人为:" + to_ywy.SelectedValue;
|
|
rizhi.yonghuming = zh.zhanghao.ToString();
|
|
rizhibll.Add(rizhi);
|
|
|
|
Response.Redirect("Customer_list.aspx", false);
|
|
}
|
|
else
|
|
{
|
|
Response.Redirect("../Common/error.aspx");
|
|
}
|
|
|
|
}
|
|
}
|
|
} |