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 System.Text;
using CY.BLL.OA;
namespace CY.WebForm.Pages.business
{
//吴辉
//新增/修改合作客户资料
public partial class AddCorporateClients : BasePage
{
OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null;
Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;//字典业务逻辑操作类对象
EC_MemberBasicBLL bll_EC_MemberBasicBLL = null;
OA_IntentionCustomerBLL bll_OA_IntentionCustomerBLL = null;
OA_StaffBLL bll_OA_StaffBLL = null;
public string Province = ""; //接收值 Request["selectProvince"].ToString2();
public string City = "";//接收值 Request["selectCity"].ToString2();
public string County = "";//接收值 Request["selectCounty"].ToString2();
public string Targetid = ""; //收货方式目标值
public string Shifouwanjie = ""; //完结状态
public string CorporateClientsid = "";
public string strNewKeyid = "";
///
/// 在新建时,保存或者是处理附件时先要生成这个Guid
///
public Guid NewKeyid{ get; set; }
//初始化
public AddCorporateClients()
{
bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL();
bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
bll_EC_MemberBasicBLL = new EC_MemberBasicBLL();
bll_OA_IntentionCustomerBLL = new OA_IntentionCustomerBLL();
bll_OA_StaffBLL = new OA_StaffBLL();
}
//页面加载
protected void Page_Load(object sender, EventArgs e)
{
try
{
GetKeyID();
this.saveKey.Value = NewKeyid.ToString();
Targetid = Request["Keyid"].ToString2();
CorporateClientsid = Targetid;
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;
BindData();
}
return;
}
}
catch (Exception ex)
{
PAGEHandleException(ex);
Response.Clear();
Response.Write("-1");
}
Response.End();
}
//提交事件
protected void btn_Submit_Config(object sender, EventArgs e)
{
OA_CorporateClients m_OA_CorporateClients = new OA_CorporateClients();
OA_CustomerCommunications m_OA_CustomerCommunications = new OA_CustomerCommunications();
EC_AcceptWayByCustomers m_EC_AcceptWayByCustomers = new EC_AcceptWayByCustomers();
try
{
//var files = Request.Files;
//for (int iFile = 0; iFile < files.Count; iFile++)
//{
// ///'检查文件扩展名字
// HttpPostedFile postedFile = files[iFile];
// string fileName, fileExtension;
// fileName = System.IO.Path.GetFileName(postedFile.FileName);
// if (fileName != "")
// {
// fileExtension = System.IO.Path.GetExtension(fileName);
// //strMsg.Append("上传的文件类型:" + postedFile.ContentType.ToString() + "
");
// //strMsg.Append("客户端文件地址:" + postedFile.FileName + "
");
// //strMsg.Append("上传文件的文件名:" + fileName + "
");
// //strMsg.Append("上传文件的扩展名:" + fileExtension + "
");
// ///'可根据扩展名字的不同保存到不同的文件夹
// ///注意:可能要修改你的文件夹的匿名写入权限。
// postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath("images/") + fileName);
// }
//}
Guid Keyid = Request["Keyid"].ToGuid2();
bool isExit = bll_OA_CorporateClientsBLL.isExistCompanyName(this.txtCompanyName.Value.ToString2(), CurrentUser.MemberId, Keyid);
if (!isExit)
{
bool resultxs = bll_OA_IntentionCustomerBLL.isExistCompanyName(this.txtCompanyName.Value.ToString2(), CurrentUser.MemberId, 0);
if (resultxs)
{
JavaScript.MessageBox("此客户已存在于意向客户中,请勿重复添加", this);
}
else
{
if (Request["Keyid"] != null)
{
m_OA_CorporateClients = bll_OA_CorporateClientsBLL.GetModel(Request["Keyid"].ToGuid2());
m_OA_CustomerCommunications = bll_OA_CorporateClientsBLL.GetModel_CustomerCommunications(Request["Keyid"].ToGuid2());
m_EC_AcceptWayByCustomers = bll_OA_CorporateClientsBLL.GetModel_AcceptWayByCustomers(Request["Keyid"].ToGuid2());
if (m_EC_AcceptWayByCustomers == null)
{
m_EC_AcceptWayByCustomers = new EC_AcceptWayByCustomers();
}
}
#region 初始合作客户基础信息
m_OA_CorporateClients.CompanyName = this.txtCompanyName.Value.ToString2();
m_OA_CorporateClients.CustomerIndustriesId = this.selCustomerIndustriesId.Value.ToInt32() ?? 0;
m_OA_CorporateClients.CustomerTypeId = this.selCustomerTypeId.Value.ToInt32() ?? 0;
m_OA_CorporateClients.SourcesInfoId = this.selSourcesInfoId.Value.ToInt32() ?? 0;
m_OA_CorporateClients.DegreeImportanId = this.selDegreeImportanId.Value.ToInt32() ?? 0;
m_OA_CorporateClients.AccountManagerId = this.selAccountManagerId.Value.ToInt32() ?? 0;
m_OA_CorporateClients.BusinessManagerId = this.selBusinessManagerId.Value.ToInt32() ?? 0;
m_OA_CorporateClients.Shifouwanjie = 2;
//add by zyyao
m_OA_CorporateClients.Paytime = this.selPaytime.Value.ToInt32() ?? 0;
m_OA_CorporateClients.Paydays = this.txtPaydays.Value.ToInt32() ?? 0;
m_OA_CorporateClients.Biddingcompany = this.selBiddingcompany.Value.ToInt32() ?? 0;
m_OA_CorporateClients.Contracttype = this.selContracttype.Value.ToInt32() ?? 0;
m_OA_CorporateClients.Contractmoney = this.txtContractmoney.Value.ToDecimal2() ?? 0;
m_OA_CorporateClients.ExpireTime = this.txtExpireTime.Value.ToDateTime2() ?? null;
m_OA_CorporateClients.Expiretype = this.selExpiretype.Value.ToInt32() ?? 0;
m_OA_CorporateClients.Jigoudaima = this.txtJigoudaima.Value.ToString();
m_OA_CorporateClients.Piaoju = this.selPiaoju.Value.ToInt32() ?? 0;
m_OA_CorporateClients.Kaipiaoziliao = this.txtKaipiaoziliao.Value.ToString();
m_OA_CorporateClients.Shifouwanjie = 2;
m_OA_CorporateClients.Note = this.txtNote.Value.ToString();
m_OA_CorporateClients.CreditId = this.selCreditId.Value.ToInt32() ?? 0;
m_OA_CorporateClients.LoginPhone = this.txtLoginPhone.Value.ToString2();
m_OA_CorporateClients.LoginPwd = this.txtPassWord.Value.ToString2();
m_OA_CorporateClients.CorporateWebsite = this.txtCorporateWebsite.Value.ToString2();
m_OA_CorporateClients.BusinessAnalysisId = this.selBusinessAnalysisId.Value.ToInt32() ?? 0;
m_OA_CorporateClients.IsLoginCorporateWeb = this.selIsLoginCorporateWeb.Value.ToBoolean2();
m_OA_CorporateClients.Credit = this.txtCredit.Value.ToDecimal2() ?? 0;
m_OA_CorporateClients.Bank = this.txtBank.Value.ToString2();
m_OA_CorporateClients.TaxID = this.txtTaxID.Value.ToString2();
m_OA_CorporateClients.AccountID = this.txtAccountID.Value.ToString2();
m_OA_CorporateClients.OutVendorName = CurrentUser.Name;
m_OA_CorporateClients.LastUpdateTime = DateTime.Now;
m_OA_CorporateClients.Operator = CurrentUser.ShortName;
m_OA_CorporateClients.Remark = this.txtRemark.InnerText.ToString2();
m_OA_CorporateClients.OutRate =1;
#endregion
#region 初始合作客户通讯信息
m_OA_CustomerCommunications.Province = Request["selectProvince"].ToString2();
m_OA_CustomerCommunications.City = Request["selectCity"].ToString2();
m_OA_CustomerCommunications.County = Request["selectCounty"].ToString2();
m_OA_CustomerCommunications.DetailedAddress = this.txtDetailedAddress.Value.ToString2();
m_OA_CustomerCommunications.CompanyPhone = this.txtCompanyPhone.Value.ToString2();
m_OA_CustomerCommunications.Postcode = this.txtPostcode.Value.ToString2();
m_OA_CustomerCommunications.Mobile = this.txtMobile.Value.ToString2();
m_OA_CustomerCommunications.Fax = this.txtFax.Value.ToString2();
m_OA_CustomerCommunications.Email = this.txtEmail.Value.ToString2();
m_OA_CustomerCommunications.QQ = this.txtQQ.Value.ToString2();
m_OA_CustomerCommunications.LegalRepresentative = this.txtLegalRepresentative.Value.ToString2();
m_OA_CustomerCommunications.LegalMobile = this.txtLegalMobile.Value.ToString2();
m_OA_CustomerCommunications.LegalQQ = this.txtLegalQQ.Value.ToString2();
m_OA_CustomerCommunications.BusinessManagers = this.txtBusinessManagers.Value.ToString2();
m_OA_CustomerCommunications.ManagersMobile = this.txtManagersMobile.Value.ToString2();
m_OA_CustomerCommunications.ManagersQQ = this.txtManagersQQ.Value.ToString2();
m_OA_CustomerCommunications.FinancialOfficers = this.txtFinancialOfficers.Value.ToString2();
m_OA_CustomerCommunications.OfficersMobile = this.txtOfficersMobile.Value.ToString2();
m_OA_CustomerCommunications.OfficersQQ = this.txtOfficersQQ.Value.ToString2();
m_OA_CustomerCommunications.Remark = "";
m_OA_CustomerCommunications.LastUpdateTime = DateTime.Now;
m_OA_CustomerCommunications.Operator = CurrentUser.ShortName;
#endregion
#region 初始合作客户收货地址
m_EC_AcceptWayByCustomers.AcceptTypeId = Request["AcceptTypeId"].ToInt32();
m_EC_AcceptWayByCustomers.InvoiceDemand = Request["InvoiceId"].ToString2();
m_EC_AcceptWayByCustomers.Remark = Request["Remark"].ToString2();
m_EC_AcceptWayByCustomers.LastUpdateTime = DateTime.Now;
m_EC_AcceptWayByCustomers.Operator = CurrentUser.ShortName;
m_EC_AcceptWayByCustomers.City = "";
m_EC_AcceptWayByCustomers.Accepter = "";
m_EC_AcceptWayByCustomers.AccepterPhone = "";
m_EC_AcceptWayByCustomers.AppointCourierCompany = "";
m_EC_AcceptWayByCustomers.AccepterAddress = Request["AccepterAddress_HomeDelivery"].ToString2() ?? Request["selectProvince"].ToString2() + Request["selectCity"].ToString2() + Request["selectCounty"].ToString2() + this.txtDetailedAddress.Value.ToString2();
m_EC_AcceptWayByCustomers.AccepterPhoneNum = "";
m_EC_AcceptWayByCustomers.AcceptContacts = "";
m_EC_AcceptWayByCustomers.FetchAddress = "";
m_EC_AcceptWayByCustomers.FetchPhoneNum = "";
m_EC_AcceptWayByCustomers.FetchContacts = "";
m_EC_AcceptWayByCustomers.AppointCourierCompany = "";
string ReceiptType = bll_Sys_DictionaryBLL.GetModelByKeyid(Request["AcceptTypeId"].ToInt32());
switch (ReceiptType)
{
case "自提":
break;
case "代发货运":
m_EC_AcceptWayByCustomers.City = Request["City_OnBehalfOfCargo"].ToString2();
m_EC_AcceptWayByCustomers.Accepter = Request["Accepter_OnBehalfOfCargo"].ToString2();
m_EC_AcceptWayByCustomers.AccepterPhone = Request["AccepterPhone_OnBehalfOfCargo"].ToString2();
break;
case "送货上门":
m_EC_AcceptWayByCustomers.City = Request["City_HomeDelivery"].ToString2();
m_EC_AcceptWayByCustomers.Accepter = Request["Accepter_HomeDelivery"].ToString2();
m_EC_AcceptWayByCustomers.AccepterPhone = Request["AccepterPhone_HomeDelivery"].ToString2();
break;
case "指定货运公司":
m_EC_AcceptWayByCustomers.City = Request["City_OfficialFreightForwarder"].ToString2();
m_EC_AcceptWayByCustomers.Accepter = Request["Accepter_OfficialFreightForwarder"].ToString2();
m_EC_AcceptWayByCustomers.AccepterPhone = Request["AccepterPhone_OfficialFreightForwarder"].ToString2();
m_EC_AcceptWayByCustomers.AppointCourierCompany = Request["AppointCourierCompany"].ToString2();
m_EC_AcceptWayByCustomers.AccepterAddress = Request["AccepterAddress"].ToString2();
m_EC_AcceptWayByCustomers.AccepterPhoneNum = Request["AccepterPhoneNum"].ToString2();
m_EC_AcceptWayByCustomers.AcceptContacts = Request["AcceptContacts"].ToString2();
m_EC_AcceptWayByCustomers.FetchAddress = Request["FetchAddress"].ToString2();
m_EC_AcceptWayByCustomers.FetchPhoneNum = Request["FetchPhoneNum"].ToString2();
m_EC_AcceptWayByCustomers.FetchContacts = Request["FetchContacts"].ToString2();
m_EC_AcceptWayByCustomers.AppointCourierCompany = Request["AppointCourierCompany"].ToString2();
break;
default:
break;
}
#endregion
#region 添加或编辑
if (Request["Keyid"] != null)
{
bool result = bll_OA_CorporateClientsBLL.UpdateModel(m_OA_CorporateClients, m_OA_CustomerCommunications, m_EC_AcceptWayByCustomers);//更新信息
if (result)
JavaScript.MessageBox("更新成功", this, true, true);
else
JavaScript.MessageBox("更新失败", this);
}
else
{
m_OA_CorporateClients.OrderCount = 0;
m_OA_CorporateClients.OrderMoney = 0;
m_OA_CorporateClients.Prepayments = 0;
m_OA_CorporateClients.IsOutsourcing = false;
m_OA_CorporateClients.IsPriority = false;
m_OA_CorporateClients.CumulativePrepayments = 0;
m_OA_CorporateClients.Keyid = new Guid( this.saveKey.Value);// Guid.NewGuid();//GetKeyID();
m_OA_CorporateClients.CreateTime = DateTime.Now;
m_OA_CorporateClients.CustomerId = bll_OA_CorporateClientsBLL.GetLastIdByFirmId(CurrentUser.MemberId) + 1;
m_OA_CorporateClients.FirmId = CurrentUser.MemberId;
m_OA_CorporateClients.InquiryId = CurrentUser.InquiryId;
if (this.txtHideMemberType.Value == "网站会员")
{
m_OA_CorporateClients.MemberId = this.txtHideMemberId.Value.ToGuid2();
}
else
{
m_OA_CorporateClients.MemberId = m_OA_CorporateClients.Keyid;
}
m_OA_CustomerCommunications.Keyid = m_OA_CorporateClients.Keyid;
m_EC_AcceptWayByCustomers.TargetId = m_OA_CorporateClients.Keyid;
bool result = bll_OA_CorporateClientsBLL.InsertModel(m_OA_CorporateClients, m_OA_CustomerCommunications, m_EC_AcceptWayByCustomers);//添加信息
if (result)
{
Province = CurrentUser.Province;
City = CurrentUser.City;
County = CurrentUser.County;
if (Request["src"] == "order")
{
JavaScript.MessageBox("添加成功", this, "top.document.getElementById('frmright').contentWindow.ReBindClients();top.Dialog.close();");
}
else
{
JavaScript.MessageBox("添加成功", this, false, true);
BindData();
}
}
else
JavaScript.MessageBox("添加失败", this);
}
#endregion
}
}
else
{
JavaScript.MessageBox("此客户已存在,请勿重复添加", this);
}
}
catch (Exception ex)
{
PAGEHandleException(ex);
JavaScript.MessageBox("操作失败", this);
}
}
//完结事件
protected void btn_Submit_Wanjie(object sender, EventArgs e)
{
OA_CorporateClients m_OA_CorporateClients = new OA_CorporateClients();
try
{
Guid Keyid = Request["Keyid"].ToGuid2();
if (Request["Keyid"] != null)
{
m_OA_CorporateClients = bll_OA_CorporateClientsBLL.GetModel(Request["Keyid"].ToGuid2());
}
else
{
JavaScript.MessageBox("请先保存客户", this);
}
m_OA_CorporateClients.Shifouwanjie = 1;
m_OA_CorporateClients.LastUpdateTime = DateTime.Now;
#region 添加或编辑
bool result = bll_OA_CorporateClientsBLL.UpdateModel(m_OA_CorporateClients);//更新信息
if (result)
JavaScript.MessageBox("完结成功", this, true, true);
else
JavaScript.MessageBox("完结失败", this);
#endregion
}
catch (Exception ex)
{
PAGEHandleException(ex);
JavaScript.MessageBox("操作失败", this);
}
}
////完结事件
//protected void btn_Submit_Visit(object sender, EventArgs e)
//{
// OA_CorporateClientsVisit m_OA_CorporateClientsVisit = new OA_CorporateClientsVisit();
// try
// {
// Guid Keyid = Request["Keyid"].ToGuid2();
// if (Request["Keyid"] != null)
// {
// }
// else
// {
// JavaScript.MessageBox("请先保存客户", this);
// }
// if (this.txtVisitTime.Value == "")
// {
// JavaScript.MessageBox("请选择日期", this);
// }
// if (this.txtVisitTime.Value == "")
// {
// JavaScript.MessageBox("请填写维护记录", this);
// }
// m_OA_CorporateClientsVisit.Keyid = Guid.NewGuid();
// m_OA_CorporateClientsVisit.CorporateClientsid = Keyid;
// m_OA_CorporateClientsVisit.VisitTime = this.txtVisitTime.Value.ToDateTime2();
// m_OA_CorporateClientsVisit.Remark = this.txtvisitRemark.Value.ToString2();
// m_OA_CorporateClientsVisit.Creater = CurrentUser.TrueMemberId;
// m_OA_CorporateClientsVisit.CreateTime = DateTime.Now;
// m_OA_CorporateClientsVisit.Updater = CurrentUser.TrueMemberId;
// m_OA_CorporateClientsVisit.LastUpdateTime = DateTime.Now;
// #region 添加或编辑
// bool result = bll_OA_CorporateClientsBLL.InsertModelVisit(m_OA_CorporateClientsVisit);//更新信息
// if (result)
// {
// //this.RepClientList.DataSource = bll_OA_CorporateClientsBLL.SelectVisitListByCorId(Keyid);
// //this.RepClientList.DataBind();
// this.txtVisitTime.Value = "";
// this.txtvisitRemark.Value = "";
// JavaScript.MessageBox("维护保存成功", this, false, false);
// }
// else
// JavaScript.MessageBox("维护保存失败", this);
// Province = CurrentUser.Province;
// City = CurrentUser.City;
// County = CurrentUser.County;
// BindData();
// #endregion
// }
// catch (Exception ex)
// {
// PAGEHandleException(ex);
// JavaScript.MessageBox("操作失败", this);
// }
//}
//绑定数据
protected void BindData()
{
#region 初始字典表数据
this.selSourcesInfoId.DataSource = bll_Sys_DictionaryBLL.GetDataByType("客户来源");
this.selSourcesInfoId.DataValueField = "Keyid";
this.selSourcesInfoId.DataTextField = "Name";
this.selSourcesInfoId.DataBind();
this.selSourcesInfoId.Value = "452";
this.selCustomerIndustriesId.DataSource = bll_Sys_DictionaryBLL.GetDataByType("客户所属行业");
this.selCustomerIndustriesId.DataValueField = "Keyid";
this.selCustomerIndustriesId.DataTextField = "Name";
this.selCustomerIndustriesId.DataBind();
this.selCustomerIndustriesId.Value = "454";
this.selCustomerTypeId.DataSource = bll_Sys_DictionaryBLL.GetDataByType("客户类型");
this.selCustomerTypeId.DataValueField = "Keyid";
this.selCustomerTypeId.DataTextField = "Name";
this.selCustomerTypeId.DataBind();
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("请选择", ""));
this.selCreditId.DataSource = bll_Sys_DictionaryBLL.GetDataByType("客户信誉");
this.selCreditId.DataValueField = "Keyid";
this.selCreditId.DataTextField = "Name";
this.selCreditId.DataBind();
this.selCreditId.Value = "76";
this.selDegreeImportanId.DataSource = bll_Sys_DictionaryBLL.GetDataByType("客户重要程度");
this.selDegreeImportanId.DataValueField = "Keyid";
this.selDegreeImportanId.DataTextField = "Name";
this.selDegreeImportanId.DataBind();
this.selBusinessAnalysisId.DataSource = bll_Sys_DictionaryBLL.GetDataByType("客户业务分析量");
this.selBusinessAnalysisId.DataValueField = "Keyid";
this.selBusinessAnalysisId.DataTextField = "Name";
this.selBusinessAnalysisId.DataBind();
this.selBusinessAnalysisId.Value = "83";
//add by zyyao
this.selPaytime.DataSource = bll_Sys_DictionaryBLL.GetDataByType("付款时间");
this.selPaytime.DataValueField = "MeanValue";
this.selPaytime.DataTextField = "Name";
this.selPaytime.DataBind();
this.selBiddingcompany.DataSource = bll_OA_CorporateClientsBLL.SelectBiddingcompanyByFirmId(CurrentUser.MemberId);
this.selBiddingcompany.DataValueField = "Keyid1";
this.selBiddingcompany.DataTextField = "CompanyName";
this.selBiddingcompany.DataBind();
this.selContracttype.DataSource = bll_Sys_DictionaryBLL.GetDataByType("合同金额");
this.selContracttype.DataValueField = "MeanValue";
this.selContracttype.DataTextField = "Name";
this.selContracttype.DataBind();
this.selExpiretype.DataSource = bll_Sys_DictionaryBLL.GetDataByType("到期时间");
this.selExpiretype.DataValueField = "MeanValue";
this.selExpiretype.DataTextField = "Name";
this.selExpiretype.DataBind();
this.selPiaoju.DataSource = bll_Sys_DictionaryBLL.GetDataByType("票据");
this.selPiaoju.DataValueField = "MeanValue";
this.selPiaoju.DataTextField = "Name";
this.selPiaoju.DataBind();
this.selShifouwanjie.DataSource = bll_Sys_DictionaryBLL.GetDataByType("客户完结状态").OrderByDescending(x=>x.MeanValue);
this.selShifouwanjie.DataValueField = "MeanValue";
this.selShifouwanjie.DataTextField = "Name";
this.selShifouwanjie.DataBind();
#endregion
if (Request["Keyid"] != null)
{
OA_CorporateClients m_OA_CorporateClients = bll_OA_CorporateClientsBLL.GetModel(Request["Keyid"].ToGuid2());
OA_CustomerCommunications m_OA_CustomerCommunications = bll_OA_CorporateClientsBLL.GetModel_CustomerCommunications(Request["Keyid"].ToGuid2());
EC_AcceptWayByCustomers m_EC_AcceptWayByCustomers = bll_OA_CorporateClientsBLL.GetModel_AcceptWayByCustomers(Request["Keyid"].ToGuid2());
#region 页面初始合作客户基础信息
this.selSourcesInfoId.Value = m_OA_CorporateClients.SourcesInfoId.ToString2();
this.selCustomerIndustriesId.Value = m_OA_CorporateClients.CustomerIndustriesId.ToString2();
this.selCustomerTypeId.Value = m_OA_CorporateClients.CustomerTypeId.ToString2();
this.selBusinessManagerId.Value = m_OA_CorporateClients.BusinessManagerId.ToString2();
this.selAccountManagerId.Value = m_OA_CorporateClients.AccountManagerId.ToString2();
this.selDegreeImportanId.Value = m_OA_CorporateClients.DegreeImportanId.ToString2();
this.selBusinessAnalysisId.Value = m_OA_CorporateClients.BusinessAnalysisId.ToString2();
this.selIsLoginCorporateWeb.Value = m_OA_CorporateClients.IsLoginCorporateWeb.ToString2();
//add by zyyao
this.selPaytime.Value = m_OA_CorporateClients.Paytime.ToString2();
this.txtPaydays.Value = m_OA_CorporateClients.Paydays.ToString2();
this.selBiddingcompany.Value = m_OA_CorporateClients.Biddingcompany.ToString2();
this.selContracttype.Value = m_OA_CorporateClients.Contracttype.ToString2();
this.txtContractmoney.Value = m_OA_CorporateClients.Contractmoney.ToDecimal2Yen();
this.txtExpireTime.Value = m_OA_CorporateClients.ExpireTime==null?"": m_OA_CorporateClients.ExpireTime.Value.ToString("yyyy-MM-dd");
this.selExpiretype.Value = m_OA_CorporateClients.Expiretype.ToString2();
this.txtJigoudaima.Value = m_OA_CorporateClients.Jigoudaima.ToString2();
this.selPiaoju.Value = m_OA_CorporateClients.Piaoju.ToString2();
this.txtKaipiaoziliao.Value = m_OA_CorporateClients.Kaipiaoziliao.ToString2();
this.selShifouwanjie.Value = m_OA_CorporateClients.Shifouwanjie.ToString2();
Shifouwanjie = m_OA_CorporateClients.Shifouwanjie.ToString2();
this.txtNote.Value = m_OA_CorporateClients.Note.ToString2();
this.selCreditId.Value = m_OA_CorporateClients.CreditId.ToString2();
this.txtCompanyName.Value = m_OA_CorporateClients.CompanyName.ToString2();
this.txtCorporateWebsite.Value = m_OA_CorporateClients.CorporateWebsite.ToString2();
this.txtCredit.Value = m_OA_CorporateClients.Credit.ToString2().ToDecimal2Yen();
this.txtLoginPhone.Value = m_OA_CorporateClients.LoginPhone.ToString2();
this.txtBank.Value = m_OA_CorporateClients.Bank.ToString2();
this.txtTaxID.Value = m_OA_CorporateClients.TaxID.ToString2();
this.txtAccountID.Value = m_OA_CorporateClients.AccountID.ToString2();
this.txtRemark.InnerText = m_OA_CorporateClients.Remark.ToString2();
this.txtPassWord.Value = m_OA_CorporateClients.LoginPwd.ToString2();
#endregion
#region 页面初始合作客户通讯信息
this.txtDetailedAddress.Value = m_OA_CustomerCommunications.DetailedAddress.ToString2();
this.txtCompanyPhone.Value = m_OA_CustomerCommunications.CompanyPhone.ToString2();
this.txtPostcode.Value = m_OA_CustomerCommunications.Postcode.ToString2();
this.txtMobile.Value = m_OA_CustomerCommunications.Mobile.ToString2();
this.txtFax.Value = m_OA_CustomerCommunications.Fax.ToString2();
this.txtEmail.Value = m_OA_CustomerCommunications.Email.ToString2();
this.txtQQ.Value = m_OA_CustomerCommunications.QQ.ToString2();
this.txtLegalRepresentative.Value = m_OA_CustomerCommunications.LegalRepresentative.ToString2();
this.txtLegalMobile.Value = m_OA_CustomerCommunications.LegalMobile.ToString2();
this.txtLegalQQ.Value = m_OA_CustomerCommunications.LegalQQ.ToString2();
this.txtBusinessManagers.Value = m_OA_CustomerCommunications.BusinessManagers.ToString2();
this.txtManagersMobile.Value = m_OA_CustomerCommunications.ManagersMobile.ToString2();
this.txtManagersQQ.Value = m_OA_CustomerCommunications.ManagersQQ.ToString2();
this.txtFinancialOfficers.Value = m_OA_CustomerCommunications.FinancialOfficers.ToString2();
this.txtOfficersMobile.Value = m_OA_CustomerCommunications.OfficersMobile.ToString2();
this.txtOfficersQQ.Value = m_OA_CustomerCommunications.OfficersQQ.ToString2();
Province = m_OA_CustomerCommunications.Province.ToString2();
City = m_OA_CustomerCommunications.City.ToString2();
County = m_OA_CustomerCommunications.County.ToString2();
#endregion
//this.RepClientList.DataSource = bll_OA_CorporateClientsBLL.SelectVisitListByCorId(Request["Keyid"].ToGuid2());
//this.RepClientList.DataBind();
this.Repeater1.DataSource = bll_OA_CorporateClientsBLL.SelectPrintListByCorId(Request["Keyid"].ToGuid2());
this.Repeater1.DataBind();
}
else
{
#region 页面初始合作客户基础信息
this.selIsLoginCorporateWeb.Value = "";
this.txtCompanyName.Value = "";
this.txtCorporateWebsite.Value = "";
this.txtCredit.Value = "0";
this.txtLoginPhone.Value = "";
this.txtBank.Value = "";
this.txtTaxID.Value = "";
this.txtAccountID.Value = "";
this.txtRemark.InnerText = "";
this.txtPassWord.Value = "";
#endregion
#region 页面初始合作客户通讯信息
this.txtDetailedAddress.Value = "";
this.txtCompanyPhone.Value = "";
this.txtPostcode.Value = "";
this.txtMobile.Value = "";
this.txtFax.Value = "";
this.txtEmail.Value = "";
this.txtQQ.Value = "";
this.txtLegalRepresentative.Value = "";
this.txtLegalMobile.Value = "";
this.txtLegalQQ.Value = "";
this.txtBusinessManagers.Value = "";
this.txtManagersMobile.Value = "";
this.txtManagersQQ.Value = "";
this.txtFinancialOfficers.Value = "";
this.txtOfficersMobile.Value = "";
this.txtOfficersQQ.Value = "";
#endregion
//this.RepClientList.DataSource = null;
//this.RepClientList.DataBind();
}
}
//绑定关联会员列表以及意向客户列表
protected string BindCompanyList(string companyname)
{
Guid Keyid = Request["Keyid"].ToGuid2();
bool isExit = bll_OA_CorporateClientsBLL.isExistCompanyName(companyname, CurrentUser.MemberId, Keyid);
if (isExit)
return "0";
if (Request["xs"].ToString2() == "blur")
{
bool resultxs = bll_OA_IntentionCustomerBLL.isExistCompanyName(Request["companyname"].ToString2(), CurrentUser.MemberId, 0);
if (resultxs)
return "1";
else
return "2";
}
else
{
List m_OA_IntentionCustomerList = bll_OA_IntentionCustomerBLL.SelectListByName(companyname, CurrentUser.MemberId) as List;
string[] modelArry = new string[m_OA_IntentionCustomerList.Count];
int i = 0;
foreach (var item in m_OA_IntentionCustomerList)
{
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.CompanyName);
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}',", "");
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) + "]");
}
}
///
/// 获取Guid
///
///
public Guid GetKeyID()
{
if (NewKeyid != null && NewKeyid != new Guid("00000000-0000-0000-0000-000000000000"))
{
strNewKeyid = NewKeyid.ToString();
return NewKeyid;
}
if (Request["Keyid"] != null)
{
NewKeyid = Request["Keyid"].ToGuid2();
// this.SaveNewKeyID.Value = NewKeyid.ToString();
strNewKeyid = NewKeyid.ToString();
return NewKeyid;
}
if (this.saveKey.Value == "")
{
NewKeyid = Guid.NewGuid();
this.saveKey.Value = NewKeyid.ToString();
return NewKeyid;
}
else
{
NewKeyid = new Guid(this.saveKey.Value);
return NewKeyid;
}
}
//CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult1 = CY.WebForm.cs.UploadCS.Upload(
//提交事件
protected void btn_SubmitClientsBiddingcompany_Config(object sender, EventArgs e)
{
OA_CorporateClients m_OA_CorporateClients = new OA_CorporateClients();
try
{
if (string.IsNullOrWhiteSpace(this.txtBiddingcompany.Value))
{
JavaScript.MessageBox("请填写中标单位", this);
}
string Biddingcompany = this.txtBiddingcompany.Value.Trim();
OA_CorporateClients oA_CorporateClients = bll_OA_CorporateClientsBLL.SelectBiddingcompanyByFirmId(CurrentUser.MemberId).Where(x=>x.CompanyName== Biddingcompany).FirstOrDefault();
if (oA_CorporateClients==null)
{
m_OA_CorporateClients.FirmId = CurrentUser.MemberId;
m_OA_CorporateClients.CompanyName = Biddingcompany;
m_OA_CorporateClients.CreateTime = DateTime.Now;
bool result = bll_OA_CorporateClientsBLL.InsertModelBiddingcompany(m_OA_CorporateClients);//添加信息
if (result)
{
JavaScript.MessageBox("添加成功", this);
this.selBiddingcompany.DataSource = bll_OA_CorporateClientsBLL.SelectBiddingcompanyByFirmId(CurrentUser.MemberId);
this.selBiddingcompany.DataValueField = "Keyid1";
this.selBiddingcompany.DataTextField = "CompanyName";
this.selBiddingcompany.DataBind();
}
else
{
JavaScript.MessageBox("添加失败", this);
}
}
else
{
JavaScript.MessageBox("此中标单位已存在,请勿重复添加", this);
}
Province = CurrentUser.Province;
City = CurrentUser.City;
County = CurrentUser.County;
BindData();
}
catch (Exception ex)
{
PAGEHandleException(ex);
JavaScript.MessageBox("操作失败", this);
}
}
}
}