using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.BLL;
|
using CY.Model;
|
using CY.Infrastructure.Query;
|
using CY.Infrastructure.Common;
|
using CY.BLL.Sys;
|
using CY.BLL.OA;
|
using System.Text;
|
namespace CY.WebForm.Pages.adminclient
|
{
|
//吴辉
|
//意向客户编辑
|
public partial class IntentionCustomerEdit : BasePage
|
{
|
public string Province = ""; //接收值 Request["selectProvince"].ToString2();
|
public string City = "";//接收值 Request["selectCity"].ToString2();
|
public string County = "";//接收值 Request["selectCounty"].ToString2();
|
Sys_DictionaryBLL _Sys_DictionaryBLL = null; //字典类业务逻辑操作对象
|
OA_IntentionCustomerBLL _OA_IntentionCustomerBLL = null;
|
OA_IntentionCustomer m_OA_IntentionCustomer = null;
|
OA_StaffBLL bll_OA_StaffBLL = null;
|
EC_MemberBasicBLL bll_EC_MemberBasicBLL = null;
|
OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null;
|
|
//初始化
|
public IntentionCustomerEdit()
|
{
|
bll_OA_StaffBLL = new OA_StaffBLL();
|
m_OA_IntentionCustomer = new OA_IntentionCustomer();
|
_Sys_DictionaryBLL = new Sys_DictionaryBLL();
|
_OA_IntentionCustomerBLL = new OA_IntentionCustomerBLL();
|
bll_EC_MemberBasicBLL = new EC_MemberBasicBLL();
|
bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL();
|
}
|
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
try
|
{
|
switch (Request["datatype"].ToString2())
|
{
|
case "check":
|
if (Request["companyName"] != null && Request["datatype"].ToString2() == "check")
|
Response.Write(BindCompanyList(Request["companyName"].ToString2().Trim()));
|
break;
|
default:
|
if (!IsPostBack)
|
{
|
Province = CurrentUser.Province;
|
City = CurrentUser.City;
|
//County = CurrentUser.County;
|
InitialSelectData();
|
if (Request["Keyid"].ToInt32() > 0)
|
{
|
InitialModifyData();
|
}
|
}
|
return;
|
}
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
Response.Clear();
|
Response.Write("-1");
|
}
|
Response.End();
|
}
|
|
/// <summary>
|
/// 初始化下拉列表中的数据
|
/// </summary>
|
protected void InitialSelectData()
|
{
|
|
this.selSourcesInfoId.DataSource = _Sys_DictionaryBLL.GetDataByType("软件客户来源");
|
this.selSourcesInfoId.DataBind();
|
|
this.selCustomerIndustriesId.DataSource = _Sys_DictionaryBLL.GetDataByType("软件所属行业");
|
this.selCustomerIndustriesId.DataBind();
|
this.selCustomerIndustriesId.Value = "435";
|
|
this.selCustomerTypeId.DataSource = _Sys_DictionaryBLL.GetDataByType("软件客户类型");
|
this.selCustomerTypeId.DataBind();
|
|
this.selDegreeImportanId.DataSource = _Sys_DictionaryBLL.GetDataByType("客户重要程度");
|
this.selDegreeImportanId.DataBind();
|
|
this.selCustomerStatusId.DataSource = _Sys_DictionaryBLL.GetDataByType("意向客户状态");
|
this.selCustomerStatusId.DataBind();
|
|
this.selTurnoverIntentionId.DataSource = _Sys_DictionaryBLL.GetDataByType("成交意向");
|
this.selTurnoverIntentionId.DataBind();
|
this.selTurnoverIntentionId.Value = "102";
|
|
this.selBusinessManagerId.DataSource = bll_OA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, true, false);
|
this.selBusinessManagerId.DataTextField = "Name";
|
this.selBusinessManagerId.DataValueField = "Keyid";
|
this.selBusinessManagerId.DataBind();
|
this.selBusinessManagerId.Items.Insert(0, new ListItem("请选择", ""));
|
|
this.selAccountManagerId.DataSource = bll_OA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, false, true);
|
this.selAccountManagerId.DataTextField = "Name";
|
this.selAccountManagerId.DataValueField = "Keyid";
|
this.selAccountManagerId.DataBind();
|
this.selAccountManagerId.Items.Insert(0, new ListItem("请选择", ""));
|
|
}
|
|
/// <summary>
|
/// 加载要修改的数据
|
/// </summary>
|
protected void InitialModifyData()
|
{
|
|
string Keyid = Request["Keyid"].ToString2();
|
m_OA_IntentionCustomer = _OA_IntentionCustomerBLL.getSingleIntentionCustomer(Keyid);
|
if (m_OA_IntentionCustomer != null)
|
{
|
this.selAccountManagerId.Value = m_OA_IntentionCustomer.AccountManagerId.ToString2();
|
this.selBusinessManagerId.Value = m_OA_IntentionCustomer.BusinessManagerId.ToString2();
|
this.selCustomerIndustriesId.Value = m_OA_IntentionCustomer.CustomerIndustriesId.ToString2();
|
this.selCustomerStatusId.Value = m_OA_IntentionCustomer.CustomerStatusId.ToString2();
|
this.selCustomerTypeId.Value = m_OA_IntentionCustomer.CustomerTypeId.ToString2();
|
this.selDegreeImportanId.Value = m_OA_IntentionCustomer.DegreeImportanId.ToString2();
|
|
this.selTurnoverIntentionId.Value = m_OA_IntentionCustomer.TurnoverIntentionId.ToString2();
|
this.selSourcesInfoId.Value = m_OA_IntentionCustomer.SourcesInfoId.ToString2();
|
this.txtBusinessManagers.Value = m_OA_IntentionCustomer.BusinessManagers.ToString2();
|
this.txtBusinessMobile.Value = m_OA_IntentionCustomer.BusinessMobile.ToString2();
|
this.txtCompanyName.Value = m_OA_IntentionCustomer.CompanyName.ToString2();
|
this.txtCompanyOfficers.Value = m_OA_IntentionCustomer.CompanyOfficers.ToString2();
|
this.txtCompanyPhone.Value = m_OA_IntentionCustomer.PhoneNum.ToString2();
|
this.txtCuPost.Value = m_OA_IntentionCustomer.CuPost.ToString2();
|
this.txtDetailedAddress.Value = m_OA_IntentionCustomer.DetailedAddress.ToString2();
|
this.txtEmail.Value = m_OA_IntentionCustomer.Email.ToString2();
|
this.txtMobile.Value = m_OA_IntentionCustomer.MobileNum.ToString2();
|
this.txtOfficersMobileD.Value = m_OA_IntentionCustomer.OfficersMobile.ToString2();
|
this.txtQQ.Value = m_OA_IntentionCustomer.QQ.ToString2();
|
this.txtRemark.Value = m_OA_IntentionCustomer.Remark.ToString2();
|
this.txtPostcode.Value = m_OA_IntentionCustomer.Postcode.ToString2();
|
Province = m_OA_IntentionCustomer.Province.ToString2();
|
City = m_OA_IntentionCustomer.City.ToString2();
|
County = m_OA_IntentionCustomer.County.ToString2();
|
}
|
else
|
{
|
this.txtBusinessManagers.Value = "";
|
this.txtCompanyName.Value = "";
|
this.txtCompanyOfficers.Value = "";
|
this.txtCompanyPhone.Value = "";
|
this.txtCuPost.Value = "";
|
this.txtDetailedAddress.Value = "";
|
this.txtEmail.Value = "";
|
this.txtMobile.Value = "";
|
this.txtOfficersMobileD.Value = "";
|
this.txtBusinessMobile.Value = "";
|
this.txtQQ.Value = "";
|
this.txtRemark.Value = "";
|
this.txtPostcode.Value = "";
|
}
|
}
|
|
//提交事件
|
protected void btn_Submit_Click(object sender, EventArgs e)
|
{
|
if (Request["Keyid"].ToInt32() > 0)//如果keyid 大于0 则再加载一次对象,方便利用对象里面的不变属性
|
{
|
string Keyid = Request["Keyid"].ToString2();
|
m_OA_IntentionCustomer = _OA_IntentionCustomerBLL.getSingleIntentionCustomer(Keyid);
|
}
|
|
m_OA_IntentionCustomer.AccountManagerId = this.selAccountManagerId.Value.ToInt32() ?? 0;
|
m_OA_IntentionCustomer.BusinessManagerId = this.selBusinessManagerId.Value.ToInt32() ?? 0;
|
m_OA_IntentionCustomer.BusinessManagers = this.txtBusinessManagers.Value;
|
m_OA_IntentionCustomer.City = Request["selectCity"].ToString2();
|
m_OA_IntentionCustomer.County = Request["selectCounty"].ToString2();
|
m_OA_IntentionCustomer.Province = Request["selectProvince"].ToString2();
|
m_OA_IntentionCustomer.CuPost = this.txtCuPost.Value;
|
m_OA_IntentionCustomer.CompanyName = this.txtCompanyName.Value;
|
m_OA_IntentionCustomer.CustomerIndustriesId = this.selCustomerIndustriesId.Value.ToInt32() ?? 0;
|
m_OA_IntentionCustomer.CustomerStatusId = this.selCustomerStatusId.Value.ToInt32() ?? 0;
|
m_OA_IntentionCustomer.CustomerTypeId = this.selCustomerTypeId.Value.ToInt32() ?? 0;
|
m_OA_IntentionCustomer.DegreeImportanId = this.selDegreeImportanId.Value.ToInt32() ?? 0;
|
m_OA_IntentionCustomer.DetailedAddress = this.txtDetailedAddress.Value;
|
m_OA_IntentionCustomer.Email = this.txtEmail.Value;
|
m_OA_IntentionCustomer.LastUpdateTime = System.DateTime.Now;
|
m_OA_IntentionCustomer.MobileNum = this.txtMobile.Value;
|
m_OA_IntentionCustomer.BusinessMobile = this.txtBusinessMobile.Value;
|
m_OA_IntentionCustomer.Fax = "";
|
m_OA_IntentionCustomer.OfficersMobile = this.txtOfficersMobileD.Value;
|
m_OA_IntentionCustomer.CompanyOfficers = this.txtCompanyOfficers.Value;
|
m_OA_IntentionCustomer.Operator = CurrentUser.ShortName;
|
m_OA_IntentionCustomer.PhoneNum = this.txtCompanyPhone.Value;
|
m_OA_IntentionCustomer.Postcode = this.txtPostcode.Value;
|
m_OA_IntentionCustomer.QQ = this.txtQQ.Value;
|
m_OA_IntentionCustomer.Remark = this.txtRemark.Value;
|
m_OA_IntentionCustomer.SourcesInfoId = this.selSourcesInfoId.Value.ToInt32() ?? 0;
|
m_OA_IntentionCustomer.TurnoverIntentionId = this.selTurnoverIntentionId.Value.ToInt32() ?? 0;
|
|
if ((Request["Keyid"].ToInt32() > 0))
|
{
|
if (_OA_IntentionCustomerBLL.UpdateModel(m_OA_IntentionCustomer))
|
{
|
JavaScript.MessageBox("更新成功", this, true, true);
|
}
|
else
|
{
|
JavaScript.MessageBox("更新失败", this);
|
}
|
}
|
else
|
{
|
m_OA_IntentionCustomer.FirmId = CurrentUser.MemberId;
|
m_OA_IntentionCustomer.CustomerId = _OA_IntentionCustomerBLL.getMaxCustomerId(CurrentUser.MemberId) + 1;
|
m_OA_IntentionCustomer.CreateTime = System.DateTime.Now;
|
if (_OA_IntentionCustomerBLL.InsertModel(m_OA_IntentionCustomer))
|
{
|
InitialModifyData();
|
JavaScript.MessageBox("添加成功", this, false, true);
|
}
|
else
|
{
|
JavaScript.MessageBox("添加失败", this);
|
}
|
}
|
}
|
|
//绑定关联会员列表以及意向客户列表
|
protected string BindCompanyList(string companyname)
|
{
|
int id = Request["Keyid"].ToInt32() ?? 0;
|
|
List<OA_CorporateClients> m_OA_CorporateClientsList = bll_OA_CorporateClientsBLL.SelectCustomListByName(companyname, CurrentUser.MemberId) as List<OA_CorporateClients>;
|
|
bool resultxs = _OA_IntentionCustomerBLL.isExistCompanyName(Request["companyname"].ToString2(), CurrentUser.MemberId, id);
|
|
if (m_OA_CorporateClientsList != null && m_OA_CorporateClientsList.Count > 0)
|
{
|
return "0";
|
}
|
if (resultxs)
|
{
|
return "1";
|
}
|
return "2";
|
|
//List<EC_MemberExtend> m_EC_MemberExtendList = bll_EC_MemberBasicBLL.SelectExtendListByName(companyname) as List<EC_MemberExtend>;
|
//string[] modelArry = new string[m_EC_MemberExtendList.Count];
|
//int i = 0;
|
//foreach (var item in m_EC_MemberExtendList)
|
//{
|
// string result = "";
|
// StringBuilder sb_html = new StringBuilder();
|
|
// sb_html.AppendFormat("CustormType:'{0}',", "网站会员");
|
// sb_html.AppendFormat("CustormKeyId:'{0}',", item.Keyid);
|
// sb_html.AppendFormat("CustormName:'{0}',", item.Name);
|
// sb_html.AppendFormat("CustormAddress:'{0}',", item.DetailedAddress);
|
// sb_html.AppendFormat("CustormPhone:'{0}',", item.PhoneNum);
|
// sb_html.AppendFormat("CustormMobile:'{0}',", item.MobileNum);
|
// sb_html.AppendFormat("CustormFax:'{0}',", item.Fax);
|
// sb_html.AppendFormat("CustormQQ:'{0}',", item.QQ);
|
// sb_html.AppendFormat("CustormEmail:'{0}',", item.Email);
|
// sb_html.AppendFormat("CustormPostCode:'{0}',", item.Postcode);
|
// sb_html.AppendFormat("CustormWeb:'{0}',", "");
|
|
// result = "{" + sb_html.ToString() + "}";
|
// modelArry[i] = result;
|
// i++;
|
//}
|
//return ("[" + string.Join(",", modelArry) + "]");
|
}
|
}
|
}
|