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 OutsourceFirmEdit : BasePage
|
{
|
OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null;
|
Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;//字典业务逻辑操作类对象
|
EC_MemberBasicBLL bll_EC_MemberBasicBLL = null;
|
EC_AcceptWayBySellerBLL bll_EC_AcceptWayBySellerBLL = null;
|
|
//初始化
|
public OutsourceFirmEdit()
|
{
|
bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL();
|
bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
|
bll_EC_MemberBasicBLL = new EC_MemberBasicBLL();
|
bll_EC_AcceptWayBySellerBLL = new EC_AcceptWayBySellerBLL();
|
}
|
|
//页面加载
|
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)
|
{
|
|
}
|
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();
|
EC_MemberBasic m_EC_MemberBasic = new EC_MemberBasic();
|
Guid NewGuid = Guid.NewGuid();
|
try
|
{
|
switch (Request["txtHideMemberType"].ToString2())
|
{
|
case "已添加我":
|
m_OA_CorporateClients = bll_OA_CorporateClientsBLL.GetModel(Request["txtHideMemberId"].ToGuid2());
|
m_OA_CustomerCommunications = bll_OA_CorporateClientsBLL.GetModel_CustomerCommunications(Request["txtHideMemberId"].ToGuid2());
|
m_EC_AcceptWayByCustomers = bll_OA_CorporateClientsBLL.GetModel_AcceptWayByCustomers(Request["txtHideMemberId"].ToGuid2());
|
|
m_OA_CorporateClients.OutVendorName = this.txtCompanyName.Value.ToString2();
|
m_OA_CorporateClients.IsOutsourcing = true;
|
m_OA_CorporateClients.IsPriority = false;
|
m_OA_CorporateClients.OutRate = 1;
|
break;
|
case "网站会员":
|
m_EC_MemberBasic = bll_EC_MemberBasicBLL.GetMemberByMemberId(Request["txtHideMemberId"].ToGuid2());
|
EC_AcceptWayBySeller bll_EC_AcceptWayBySeller = bll_EC_AcceptWayBySellerBLL.GetModelByTargetId(Request["txtHideMemberId"].ToGuid2());
|
|
#region 初始合作客户基础信息
|
m_OA_CorporateClients.CompanyName = CurrentUser.Name;
|
m_OA_CorporateClients.CustomerIndustriesId = 55;
|
m_OA_CorporateClients.CustomerTypeId = 72;
|
m_OA_CorporateClients.SourcesInfoId = 53;
|
m_OA_CorporateClients.DegreeImportanId = 78;
|
m_OA_CorporateClients.AccountManagerId = 0;
|
m_OA_CorporateClients.BusinessManagerId = 0;
|
|
m_OA_CorporateClients.CreditId = 0;
|
m_OA_CorporateClients.LoginPhone = "";
|
m_OA_CorporateClients.CorporateWebsite = "";
|
m_OA_CorporateClients.BusinessAnalysisId = 0;
|
m_OA_CorporateClients.IsLoginCorporateWeb = false;
|
m_OA_CorporateClients.Credit = 0;
|
m_OA_CorporateClients.Bank = "";
|
m_OA_CorporateClients.TaxID = "";
|
m_OA_CorporateClients.AccountID = "";
|
m_OA_CorporateClients.OrderCount = 0;
|
m_OA_CorporateClients.OrderMoney = 0;
|
|
m_OA_CorporateClients.Prepayments = 0;
|
m_OA_CorporateClients.IsOutsourcing = true;
|
m_OA_CorporateClients.OutVendorName = this.txtCompanyName.Value.ToString2();
|
m_OA_CorporateClients.IsPriority = false;
|
m_OA_CorporateClients.CumulativePrepayments = 0;
|
m_OA_CorporateClients.LastUpdateTime = DateTime.Now;
|
m_OA_CorporateClients.Operator = CurrentUser.ShortName;
|
m_OA_CorporateClients.Remark = "";
|
m_OA_CorporateClients.LoginPwd = "";
|
m_OA_CorporateClients.OutRate = 1;
|
|
#endregion
|
|
#region 初始合作客户通讯信息
|
m_OA_CustomerCommunications.Province = CurrentUser.Province;
|
m_OA_CustomerCommunications.City = CurrentUser.City;
|
m_OA_CustomerCommunications.County = CurrentUser.County;
|
m_OA_CustomerCommunications.DetailedAddress = CurrentMemberExtend.DetailedAddress;
|
m_OA_CustomerCommunications.CompanyPhone = CurrentMemberExtend.PhoneNum;
|
m_OA_CustomerCommunications.Postcode = CurrentMemberExtend.Postcode;
|
m_OA_CustomerCommunications.Mobile = CurrentMemberExtend.MobileNum;
|
m_OA_CustomerCommunications.Fax = CurrentMemberExtend.Fax;
|
m_OA_CustomerCommunications.Email = CurrentMemberExtend.Email;
|
m_OA_CustomerCommunications.QQ = CurrentMemberExtend.QQ;
|
m_OA_CustomerCommunications.LegalRepresentative = "";
|
m_OA_CustomerCommunications.LegalMobile = "";
|
m_OA_CustomerCommunications.LegalQQ = "";
|
m_OA_CustomerCommunications.BusinessManagers = "";
|
m_OA_CustomerCommunications.ManagersMobile = "";
|
m_OA_CustomerCommunications.ManagersQQ = "";
|
m_OA_CustomerCommunications.FinancialOfficers = "";
|
m_OA_CustomerCommunications.OfficersMobile = "";
|
m_OA_CustomerCommunications.OfficersQQ = "";
|
m_OA_CustomerCommunications.Remark = "";
|
m_OA_CustomerCommunications.LastUpdateTime = DateTime.Now;
|
m_OA_CustomerCommunications.Operator = CurrentUser.ShortName;
|
#endregion
|
|
#region 初始合作客户收货地址
|
m_EC_AcceptWayByCustomers.AcceptTypeId = bll_EC_AcceptWayBySeller.AcceptTypeId;
|
m_EC_AcceptWayByCustomers.InvoiceDemand = bll_EC_AcceptWayBySeller.InvoiceDemand;
|
m_EC_AcceptWayByCustomers.Remark = bll_EC_AcceptWayBySeller.AcceptContacts;
|
m_EC_AcceptWayByCustomers.LastUpdateTime = DateTime.Now;
|
m_EC_AcceptWayByCustomers.Operator = CurrentUser.ShortName;
|
|
m_EC_AcceptWayByCustomers.City = bll_EC_AcceptWayBySeller.City;
|
m_EC_AcceptWayByCustomers.Accepter = bll_EC_AcceptWayBySeller.Accepter;
|
m_EC_AcceptWayByCustomers.AccepterPhone = bll_EC_AcceptWayBySeller.AccepterPhone;
|
m_EC_AcceptWayByCustomers.AppointCourierCompany = bll_EC_AcceptWayBySeller.AppointCourierCompany;
|
m_EC_AcceptWayByCustomers.AccepterAddress = bll_EC_AcceptWayBySeller.AccepterAddress;
|
m_EC_AcceptWayByCustomers.AccepterPhoneNum = bll_EC_AcceptWayBySeller.AccepterPhoneNum;
|
m_EC_AcceptWayByCustomers.AcceptContacts = bll_EC_AcceptWayBySeller.AcceptContacts;
|
m_EC_AcceptWayByCustomers.FetchAddress = bll_EC_AcceptWayBySeller.FetchAddress;
|
m_EC_AcceptWayByCustomers.FetchPhoneNum = bll_EC_AcceptWayBySeller.FetchPhoneNum;
|
m_EC_AcceptWayByCustomers.FetchContacts = bll_EC_AcceptWayBySeller.FetchContacts;
|
#endregion
|
break;
|
default:
|
#region 初始合作客户基础信息
|
m_OA_CorporateClients.CompanyName = CurrentUser.Name;
|
m_OA_CorporateClients.CustomerIndustriesId = 0;
|
m_OA_CorporateClients.CustomerTypeId = 0;
|
m_OA_CorporateClients.SourcesInfoId = 0;
|
m_OA_CorporateClients.DegreeImportanId = 0;
|
m_OA_CorporateClients.AccountManagerId = 0;
|
m_OA_CorporateClients.BusinessManagerId = 0;
|
|
m_OA_CorporateClients.CreditId = 0;
|
m_OA_CorporateClients.LoginPhone = "";
|
m_OA_CorporateClients.CorporateWebsite = "";
|
m_OA_CorporateClients.BusinessAnalysisId = 0;
|
m_OA_CorporateClients.IsLoginCorporateWeb = false;
|
m_OA_CorporateClients.Credit = 0;
|
m_OA_CorporateClients.Bank = "";
|
m_OA_CorporateClients.TaxID = "";
|
m_OA_CorporateClients.AccountID = "";
|
m_OA_CorporateClients.OrderCount = 0;
|
m_OA_CorporateClients.OrderMoney = 0;
|
|
m_OA_CorporateClients.Prepayments = 0;
|
m_OA_CorporateClients.IsOutsourcing = true;
|
m_OA_CorporateClients.OutVendorName = this.txtCompanyName.Value.ToString2();
|
m_OA_CorporateClients.IsPriority = false;
|
m_OA_CorporateClients.CumulativePrepayments = 0;
|
m_OA_CorporateClients.LastUpdateTime = DateTime.Now;
|
m_OA_CorporateClients.Operator = CurrentUser.ShortName;
|
m_OA_CorporateClients.Remark = "";
|
m_OA_CorporateClients.OutRate = 1;
|
m_OA_CorporateClients.LoginPwd = "";
|
|
#endregion
|
|
#region 初始合作客户通讯信息
|
m_OA_CustomerCommunications.Province = CurrentUser.Province;
|
m_OA_CustomerCommunications.City = CurrentUser.City;
|
m_OA_CustomerCommunications.County = CurrentUser.County;
|
m_OA_CustomerCommunications.DetailedAddress = CurrentMemberExtend.DetailedAddress;
|
m_OA_CustomerCommunications.CompanyPhone = CurrentMemberExtend.PhoneNum;
|
m_OA_CustomerCommunications.Postcode = CurrentMemberExtend.Postcode;
|
m_OA_CustomerCommunications.Mobile = CurrentMemberExtend.MobileNum;
|
m_OA_CustomerCommunications.Fax = CurrentMemberExtend.Fax;
|
m_OA_CustomerCommunications.Email = CurrentMemberExtend.Email;
|
m_OA_CustomerCommunications.QQ = CurrentMemberExtend.QQ;
|
m_OA_CustomerCommunications.LegalRepresentative = "";
|
m_OA_CustomerCommunications.LegalMobile = "";
|
m_OA_CustomerCommunications.LegalQQ = "";
|
m_OA_CustomerCommunications.BusinessManagers = "";
|
m_OA_CustomerCommunications.ManagersMobile = "";
|
m_OA_CustomerCommunications.ManagersQQ = "";
|
m_OA_CustomerCommunications.FinancialOfficers = "";
|
m_OA_CustomerCommunications.OfficersMobile = "";
|
m_OA_CustomerCommunications.OfficersQQ = "";
|
m_OA_CustomerCommunications.Remark = "";
|
m_OA_CustomerCommunications.LastUpdateTime = DateTime.Now;
|
m_OA_CustomerCommunications.Operator = CurrentUser.ShortName;
|
#endregion
|
|
#region 初始合作客户收货地址
|
m_EC_AcceptWayByCustomers.AcceptTypeId = 0;
|
m_EC_AcceptWayByCustomers.InvoiceDemand = "";
|
m_EC_AcceptWayByCustomers.Remark = "";
|
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 = "";
|
m_EC_AcceptWayByCustomers.AccepterPhoneNum = "";
|
m_EC_AcceptWayByCustomers.AcceptContacts = "";
|
m_EC_AcceptWayByCustomers.FetchAddress = "";
|
m_EC_AcceptWayByCustomers.FetchPhoneNum = "";
|
m_EC_AcceptWayByCustomers.FetchContacts = "";
|
|
#endregion
|
break;
|
}
|
|
#region 添加或编辑
|
|
if (Request["txtHideMemberType"].ToString2() == "已添加我")
|
{
|
bool result = bll_OA_CorporateClientsBLL.UpdateModel(m_OA_CorporateClients, m_OA_CustomerCommunications, m_EC_AcceptWayByCustomers);//更新信息
|
if (result)
|
JavaScript.RefreshDIVOpener(this);
|
else
|
JavaScript.MessageBox("操作失败", this);
|
}
|
else
|
{
|
m_OA_CorporateClients.Keyid = NewGuid;
|
m_OA_CorporateClients.CreateTime = DateTime.Now;
|
m_OA_CorporateClients.MemberId = CurrentUser.MemberId;
|
|
if (this.txtHideMemberType.Value == "网站会员")
|
{
|
m_OA_CorporateClients.FirmId = this.txtHideMemberId.Value.ToGuid2();
|
m_OA_CorporateClients.InquiryId = m_EC_MemberBasic.InquiryId;
|
}
|
else
|
{
|
m_OA_CorporateClients.FirmId = NewGuid;
|
m_OA_CorporateClients.InquiryId = AdminAccount.MemberId;
|
}
|
m_OA_CorporateClients.CustomerId = bll_OA_CorporateClientsBLL.GetLastIdByFirmId(m_OA_CorporateClients.FirmId) + 1;
|
|
m_OA_CustomerCommunications.Keyid = NewGuid;
|
m_EC_AcceptWayByCustomers.TargetId = NewGuid;
|
m_OA_CorporateClients.Paytime = 0;
|
m_OA_CorporateClients.Paydays = 0;
|
m_OA_CorporateClients.Biddingcompany = 0;
|
m_OA_CorporateClients.Contracttype = 0;
|
m_OA_CorporateClients.Contractmoney = 0;
|
m_OA_CorporateClients.Jigoudaima = "";
|
m_OA_CorporateClients.Piaoju = 0;
|
m_OA_CorporateClients.Kaipiaoziliao = "";
|
m_OA_CorporateClients.Expiretype = 0;
|
m_OA_CorporateClients.Shifouwanjie = 2;
|
m_OA_CorporateClients.Note = "";
|
bool result = bll_OA_CorporateClientsBLL.InsertModel(m_OA_CorporateClients, m_OA_CustomerCommunications, m_EC_AcceptWayByCustomers);//添加信息
|
if (result)
|
JavaScript.MessageBox("添加成功", this,true,true);
|
else
|
JavaScript.MessageBox("添加失败", this);
|
}
|
#endregion
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
JavaScript.MessageBox("操作失败", this);
|
}
|
}
|
|
//绑定关联会员列表以及意向客户列表
|
protected string BindCompanyList(string companyname)
|
{
|
List<EC_MemberExtend> m_EC_MemberExtendList = bll_EC_MemberBasicBLL.SelectExtendListByName(companyname) as List<EC_MemberExtend>;
|
|
List<OA_CorporateClients> m_OA_IntentionCustomerList = bll_OA_CorporateClientsBLL.SelectListListByName(companyname, CurrentUser.MemberId) as List<OA_CorporateClients>;
|
|
|
string[] modelArry = new string[m_EC_MemberExtendList.Count + 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.OutVendorName);
|
|
result = "{" + sb_html.ToString() + "}";
|
modelArry[i] = result;
|
i++;
|
}
|
|
foreach (var item in m_EC_MemberExtendList)
|
{
|
if (string.Join(",", modelArry).IndexOf(item.Name) > 0 || item.Name == CurrentUser.Name)
|
{
|
string result = "";
|
StringBuilder sb_html = new StringBuilder();
|
|
sb_html.AppendFormat("CustormType:'{0}',", "xx");
|
sb_html.AppendFormat("CustormKeyId:'{0}',", "");
|
sb_html.AppendFormat("CustormName:'{0}'", "");
|
|
result = "{" + sb_html.ToString() + "}";
|
modelArry[i] = result;
|
i++;
|
}
|
else
|
{
|
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);
|
|
result = "{" + sb_html.ToString() + "}";
|
modelArry[i] = result;
|
i++;
|
}
|
}
|
|
|
return ("[" + string.Join(",", modelArry) + "]");
|
}
|
|
}
|
}
|