📄 clientcontact.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.IO;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using UDS.Components;
namespace UDS.SubModule.CM
{
/// <summary>
/// ClientContact 的摘要说明。
/// </summary>
public class ClientContact : System.Web.UI.Page
{
#region 控件声明
protected UDS.Inc.ControlClientContactHistory ControlClientContactHistory1;
protected System.Web.UI.WebControls.Literal ltl_ClientShortName;
protected System.Web.UI.WebControls.DropDownList ddl_bargainprognosis;
protected System.Web.UI.WebControls.CheckBox cbx_travel;
protected System.Web.UI.WebControls.CheckBox cbx_food;
protected System.Web.UI.WebControls.CheckBox cbx_gift;
protected System.Web.UI.WebControls.CheckBox cbx_out;
protected System.Web.UI.WebControls.TextBox tbx_nextcontacttime;
protected System.Web.UI.WebControls.Button btn_OK;
protected System.Web.UI.WebControls.Label lbl_Message;
protected System.Web.UI.WebControls.Literal ltl_Birthday;
protected System.Web.UI.WebControls.Literal ltl_sellphase;
protected System.Web.UI.WebControls.Literal ltl_fee;
#endregion
protected int clientid;
protected System.Web.UI.WebControls.Panel pnl_clientselect;
protected System.Web.UI.WebControls.Literal ltl_ClientName;
protected System.Web.UI.WebControls.DropDownList ddl_ClientName;
protected System.Web.UI.WebControls.TextBox tbx_quicksearch;
protected System.Web.UI.WebControls.Button btn_search;
protected System.Web.UI.WebControls.Literal ltl_UpdateTime;
protected System.Web.UI.WebControls.TextBox tbx_contacttime;
protected System.Web.UI.WebControls.Literal ltl_ContactTimes;
protected System.Web.UI.WebControls.Label lbl_BargainPrognosis;
protected System.Web.UI.WebControls.DropDownList ddl_SellMan;
protected System.Web.UI.WebControls.Literal ltl_AddMan;
protected System.Web.UI.WebControls.ListBox lbx_Cooperater;
protected System.Web.UI.WebControls.Button btn_in;
protected System.Web.UI.WebControls.Button btn_out;
protected System.Web.UI.WebControls.ListBox lbx_Staff;
protected System.Web.UI.WebControls.ListBox lbx_Linkman;
protected System.Web.UI.WebControls.Button btn_inlinkman;
protected System.Web.UI.WebControls.Button btn_outlinkman;
protected System.Web.UI.WebControls.ListBox lbx_ClientLinkman;
protected System.Web.UI.WebControls.TextBox tbx_contactaim;
protected System.Web.UI.WebControls.TextBox tbx_sellmoney;
protected System.Web.UI.WebControls.RangeValidator RangeValidator3;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
protected System.Web.UI.WebControls.CheckBox cbx_telephone;
protected System.Web.UI.WebControls.CheckBox cbx_fax;
protected System.Web.UI.WebControls.CheckBox cbx_email;
protected System.Web.UI.WebControls.CheckBox cbx_mail;
protected System.Web.UI.WebControls.CheckBox cbx_meeting;
protected System.Web.UI.WebControls.CheckBox cbx_interview;
protected System.Web.UI.WebControls.CheckBox cbx_callin;
protected System.Web.UI.WebControls.CheckBox cbx_sms;
protected System.Web.UI.WebControls.CheckBox cbx_trace;
protected System.Web.UI.WebControls.CheckBox cbx_boot;
protected System.Web.UI.WebControls.CheckBox cbx_commend;
protected System.Web.UI.WebControls.CheckBox cbx_requirement;
protected System.Web.UI.WebControls.CheckBox cbx_submit;
protected System.Web.UI.WebControls.CheckBox cbx_negotiate;
protected System.Web.UI.WebControls.CheckBox cbx_actualize;
protected System.Web.UI.WebControls.CheckBox cbx_traceservice;
protected System.Web.UI.WebControls.CheckBox cbx_last;
protected System.Web.UI.WebControls.RadioButton rbtn_trace;
protected System.Web.UI.WebControls.RadioButton rbtn_boot;
protected System.Web.UI.WebControls.RadioButton rbtn_commend;
protected System.Web.UI.WebControls.RadioButton rbtn_requirement;
protected System.Web.UI.WebControls.RadioButton rbtn_submit;
protected System.Web.UI.WebControls.RadioButton rbtn_negotiate;
protected System.Web.UI.WebControls.RadioButton rbtn_actualize;
protected System.Web.UI.WebControls.RadioButton rbtn_traceservice;
protected System.Web.UI.WebControls.RadioButton rbtn_last;
protected System.Web.UI.WebControls.TextBox tbx_thisfee;
protected System.Web.UI.WebControls.RangeValidator RangeValidator2;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.TextBox tbx_contactcontent;
protected System.Web.UI.WebControls.TextBox tbx_nextcontactaim;
protected System.Web.UI.HtmlControls.HtmlInputFile File1;
protected System.Web.UI.HtmlControls.HtmlInputFile File2;
protected System.Web.UI.HtmlControls.HtmlInputFile File3;
private int contactid = 0;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
UDS.Components.CM cm = new UDS.Components.CM();
SqlDataReader dr = null;
if(!Page.IsPostBack)
{
tbx_contacttime.Text = DateTime.Now.ToShortDateString();
tbx_nextcontacttime.Text = DateTime.Now.AddDays(1).ToShortDateString();
clientid = Int32.Parse((Request.QueryString["ClientID"]==null)||(Request.QueryString["ClientID"]=="")?"-1":Request.QueryString["ClientID"].ToString());
pnl_clientselect.Visible = true;
//绑定客户列表
dr = cm.GetMyClients(Int32.Parse(Request.Cookies["UserID"].Value));
ddl_ClientName.DataSource = dr;
ddl_ClientName.DataValueField = "id";
ddl_ClientName.DataTextField = "name";
ddl_ClientName.DataBind();
dr.Close();
if(clientid!=-1)
{
if(ddl_ClientName.Items.Count!=0)
{
foreach(ListItem li in ddl_ClientName.Items)
{
if(li.Value==clientid.ToString())
{
li.Selected = true;
}
else
{
li.Selected = false;
}
}
ViewState["ClientID"] = clientid;
}
//显示销售人员
UDS.Components.ClientInfo client = cm.GetClientAllInfo(clientid);
UDS.Components.Staff staff = new UDS.Components.Staff();
SqlDataReader dr_staff = staff.GetStaffInfo(client.AddManID);
while(dr_staff.Read())
{
ltl_AddMan.Text = dr_staff["realname"].ToString();
}
dr_staff.Close();
}
else
{
if(ddl_ClientName.Items.Count!=0)
{
clientid = Int32.Parse(ddl_ClientName.Items[0].Value);
ViewState["ClientID"] = clientid;
}
else
{
ViewState["ClientID"] = clientid;
}
}
DisplayClientInfo();
BindData();
ViewState["ContactID"] = contactid.ToString();
}
else
{
clientid = Int32.Parse(ViewState["ClientID"].ToString());
contactid = Int32.Parse(ViewState["ContactID"].ToString());
}
tbx_contacttime.Attributes["onfocus"] = "setday(this)";
tbx_nextcontacttime.Attributes["onfocus"] = "setday(this)";
}
private void BindData()
{
string staffids = "";
UDS.Components.Staff staff = new UDS.Components.Staff();
//绑定该客户的联系人
UDS.Components.Database db = new UDS.Components.Database();
SqlDataReader dr_ClientLinkman = null;
SqlParameter[] prams = {
db.MakeInParam("@clientid",SqlDbType.Int,4,clientid)
};
db.RunProc("sp_CM_GetAllLinkmanFromClient",prams,out dr_ClientLinkman);
lbx_ClientLinkman.DataSource = dr_ClientLinkman;
lbx_ClientLinkman.DataTextField = "Name";
lbx_ClientLinkman.DataValueField = "id";
lbx_ClientLinkman.DataBind();
dr_ClientLinkman.Close();
//绑定协同人员候选列表
SqlDataReader dr_staff = null;
for(int i=0;i<lbx_Cooperater.Items.Count;i++)
{
staffids += lbx_Cooperater.Items[i].Value + ",";
}
if(staffids.Length!=0)
staffids = staffids.Substring(0,staffids.Length-1);
dr_staff = staff.GetRemainStaff(staffids);
lbx_Staff.DataSource = dr_staff;
lbx_Staff.DataTextField = "realname";
lbx_Staff.DataValueField = "staff_id";
lbx_Staff.DataBind();
dr_staff.Close();
ControlClientContactHistory1.ClientID = clientid;
ControlClientContactHistory1.BindData();
}
/// <summary>
/// 显示客户信息
/// </summary>
private void DisplayClientInfo()
{
UDS.Components.CM cm = new UDS.Components.CM();
//得到客户信息
SqlDataReader dr_client = cm.GetClientInfo(clientid);
while(dr_client.Read())
{
ltl_ClientName.Text = dr_client["Name"].ToString();
ltl_ClientShortName.Text = dr_client["ShortName"].ToString();
ltl_ContactTimes.Text = dr_client["ContactTimes"].ToString();
ltl_Birthday.Text = dr_client["Birthday"].ToString();
ltl_UpdateTime.Text = dr_client["UpdateTime"].ToString();
ltl_fee.Text = dr_client["Fee"].ToString();
lbl_BargainPrognosis.Text = dr_client["BargainPrognosis"].ToString();
ltl_sellphase.Text = GetCurStatus(dr_client["sellphase"].ToString());
}
dr_client.Close();
}
private string GetCurStatus(string curstatus)
{
switch(curstatus.Split(',')[0])
{
case "trace":
return ("跟踪");
case "boot":
return ("启动");
case "commend":
return ("产品推荐");
case "requirement":
return ("需求定义");
case "submit":
return ("方案提交");
case "negotiate":
return ("商务谈判");
case "actualize":
return ("项目实施");
case "traceservice":
return ("跟踪服务");
case "last":
return ("收尾款");
}
return("");
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -