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.OA; namespace CY.WebForm.Pages.business { //吴辉 //商业信函 public partial class SendAllLetters : BasePage { OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null; OA_IntentionCustomerBLL bll_OA_IntentionCustomerBLL = null; EC_ExSingleTemBLL bll_EC_ExSingleTemBLL = null; public int PrintWidth = 0; public int PrintHeight = 0; public string PrintType = ""; //初始化 public SendAllLetters() { bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL(); bll_OA_IntentionCustomerBLL = new OA_IntentionCustomerBLL(); bll_EC_ExSingleTemBLL = new EC_ExSingleTemBLL(); } //页面加载 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(Request["s"].ToString2())) { switch (Request["s"].ToString2()) { case "corporate": //合作客户 DataBindCorporate(Request["i"].ToString2()); break; case "intention": //意向客户 DataBindIntention(Request["i"].ToString2()); break; default: break; } } } } /// /// 绑定合作客户 /// /// public void DataBindCorporate(string Keyid) { Keyid = Keyid.Trim(','); List m_OA_CorporateClientsList = bll_OA_CorporateClientsBLL.SelectListListByCustomId(Keyid, CurrentUser.MemberId) as List; OA_CustomerAccessRecord m_OA_CustomerAccessRecord = new OA_CustomerAccessRecord(); m_OA_CustomerAccessRecord.AccessContent = ""; m_OA_CustomerAccessRecord.AccesserId = CurrentUser.StaffId ?? 0; m_OA_CustomerAccessRecord.AccessTypeId = 5; m_OA_CustomerAccessRecord.CreateTime = DateTime.Now; m_OA_CustomerAccessRecord.CustomerId = ""; m_OA_CustomerAccessRecord.CutomerType = true; m_OA_CustomerAccessRecord.EndTime = DateTime.Now; m_OA_CustomerAccessRecord.LastUpdateTime = DateTime.Now; m_OA_CustomerAccessRecord.Operator = CurrentUser.ShortName; m_OA_CustomerAccessRecord.Receiver = ""; m_OA_CustomerAccessRecord.Remark = CurrentUser.MemberId.ToString2(); m_OA_CustomerAccessRecord.StartTime = DateTime.Now; m_OA_CustomerAccessRecord.StuffId = CurrentUser.StaffId ?? 0; m_OA_CustomerAccessRecord.TurnoverIntention = ""; OA_CustomerAccessRecordBLL bll_OA_CustomerAccessRecordBLL = new OA_CustomerAccessRecordBLL(); bll_OA_CustomerAccessRecordBLL.InsertModelList(Keyid.ToString2().Trim(',').Split(','), m_OA_CustomerAccessRecord); EC_ExSingleTem m_EC_ExSingleTem = bll_EC_ExSingleTemBLL.GetModelByType(Request["p"].ToString2()); string Printhtml = ""; switch (Request["p"].ToString2()) { case "普通信件": PrintWidth = 2100; PrintHeight = 2970; PrintType = "A4"; break; case "邮政EMS": PrintWidth = 2080; PrintHeight = 1270; PrintType = ""; break; case "顺丰快递": PrintWidth = 2310; PrintHeight = 1360; PrintType = ""; break; case "圆通快递": PrintWidth = 2310; PrintHeight = 1360; PrintType = ""; break; default: break; } int i = 0; string color = "Red"; foreach (var item in m_OA_CorporateClientsList) { OA_CustomerCommunications m_OA_CustomerCommunications = bll_OA_CorporateClientsBLL.GetModel_CustomerCommunications(item.Keyid); if (Request["p"].ToString2() == "普通信件") { if (i % 2 == 0) { Printhtml = Printhtml + "
"; } Printhtml = Printhtml + "
" + (string.IsNullOrEmpty(item.Postcode) ? "" : "(" + item.Postcode + ")") + item.Province + item.City.Replace("其他", "") + item.County.Replace("其他", "") + item.DetailedAddress + "
" + item.CompanyName + "
" + (string.IsNullOrEmpty(m_OA_CustomerCommunications.LegalRepresentative) ? "" : (m_OA_CustomerCommunications.LegalRepresentative) + "(收)") + (string.IsNullOrEmpty(m_OA_CustomerCommunications.CompanyPhone) ? m_OA_CustomerCommunications.Mobile : m_OA_CustomerCommunications.CompanyPhone) + "
印刷品
"; if (i % 2 != 0) { Printhtml = Printhtml + "
"; } i++; } else { if (m_EC_ExSingleTem != null) { //background-image:url('" + m_EC_ExSingleTem.EST_Background + "') Printhtml = Printhtml + "
" + m_EC_ExSingleTem.EST_Html .Replace("contentEditable", "x") .Replace("background-color: red;", "") .Replace("发-公司名称", CurrentUser.Name) .Replace("发-姓名", Request["d"]) .Replace("发-区域", CurrentUser.Province + CurrentUser.City.Replace("其他", "") + CurrentUser.County.Replace("其他", "")) .Replace("发-地址", CurrentMemberExtend.DetailedAddress) .Replace("发-邮编", CurrentMemberExtend.Postcode) .Replace("发-电话手机", string.IsNullOrEmpty(CurrentMemberExtend.PhoneNum) ? CurrentMemberExtend.MobileNum : CurrentMemberExtend.PhoneNum) .Replace("发-电话", CurrentMemberExtend.PhoneNum) .Replace("发-手机", CurrentMemberExtend.MobileNum) .Replace("发-省", CurrentUser.Province) .Replace("发-市", CurrentUser.City.Replace("其他", "")) .Replace("发-区", CurrentUser.County.Replace("其他", "")) .Replace("收-客户名称", item.CompanyName) .Replace("收-姓名", string.IsNullOrEmpty(m_OA_CustomerCommunications.BusinessManagers) ? m_OA_CustomerCommunications.LegalRepresentative : m_OA_CustomerCommunications.BusinessManagers) .Replace("收-区域", m_OA_CustomerCommunications.Province + m_OA_CustomerCommunications.City + m_OA_CustomerCommunications.County.Replace("其他", "")) .Replace("收-地址", item.DetailedAddress) .Replace("收-邮编", m_OA_CustomerCommunications.Postcode) .Replace("收-电话手机", string.IsNullOrEmpty(m_OA_CustomerCommunications.CompanyPhone) ? m_OA_CustomerCommunications.Mobile : m_OA_CustomerCommunications.CompanyPhone) .Replace("收-电话", m_OA_CustomerCommunications.CompanyPhone) .Replace("收-手机", m_OA_CustomerCommunications.Mobile) .Replace("收-省", m_OA_CustomerCommunications.Province) .Replace("收-市", m_OA_CustomerCommunications.City.Replace("其他", "")) .Replace("收-区", m_OA_CustomerCommunications.County.Replace("其他", "")) .Replace("内件品名", Request["h"]) .Replace("寄件时间", DateTime.Now.ToString("yyyy年MM月dd").Replace("年", "   ").Replace("月", "   ")) + "
"; } } } this.divPrintHtml.InnerHtml = Printhtml; } /// /// 绑定意向客户 /// /// public void DataBindIntention(string Keyid) { Keyid = Keyid.Trim(','); List m_OA_IntentionCustomerList = bll_OA_IntentionCustomerBLL.SelectListListByCustomId(Keyid, CurrentUser.MemberId) as List; OA_CustomerAccessRecord m_OA_CustomerAccessRecord = new OA_CustomerAccessRecord(); m_OA_CustomerAccessRecord.AccessContent = ""; m_OA_CustomerAccessRecord.AccesserId = CurrentUser.StaffId ?? 0; m_OA_CustomerAccessRecord.AccessTypeId = 5; m_OA_CustomerAccessRecord.CreateTime = DateTime.Now; m_OA_CustomerAccessRecord.CustomerId = ""; m_OA_CustomerAccessRecord.CutomerType = false; m_OA_CustomerAccessRecord.EndTime = DateTime.Now; m_OA_CustomerAccessRecord.LastUpdateTime = DateTime.Now; m_OA_CustomerAccessRecord.Operator = CurrentUser.ShortName; m_OA_CustomerAccessRecord.Receiver = ""; m_OA_CustomerAccessRecord.Remark = CurrentUser.MemberId.ToString2(); m_OA_CustomerAccessRecord.StartTime = DateTime.Now; m_OA_CustomerAccessRecord.StuffId = CurrentUser.StaffId ?? 0; m_OA_CustomerAccessRecord.TurnoverIntention = ""; OA_CustomerAccessRecordBLL bll_OA_CustomerAccessRecordBLL = new OA_CustomerAccessRecordBLL(); bll_OA_CustomerAccessRecordBLL.InsertModelList(Keyid.ToString2().Trim(',').Split(','), m_OA_CustomerAccessRecord); EC_ExSingleTem m_EC_ExSingleTem = bll_EC_ExSingleTemBLL.GetModelByType(Request["p"].ToString2()); string Printhtml = ""; switch (Request["p"].ToString2()) { case "普通信件": PrintWidth = 2100; PrintHeight = 2970; PrintType = "A4"; break; case "邮政EMS": PrintWidth = 2080; PrintHeight = 1270; PrintType = ""; break; case "顺丰快递": PrintWidth = 2310; PrintHeight = 1360; PrintType = ""; break; case "圆通快递": PrintWidth = 2310; PrintHeight = 1360; PrintType = ""; break; default: break; } int i = 0; foreach (var item in m_OA_IntentionCustomerList) { if (Request["p"].ToString2() == "普通信件") { if (i % 2 == 0) { Printhtml = Printhtml + "
"; } Printhtml = Printhtml + "
" + (string.IsNullOrEmpty(item.Postcode) ? "" : "(" + item.Postcode + ")") + item.Province + item.City.Replace("其他", "") + item.County.Replace("其他", "") + item.DetailedAddress + "
" + item.CompanyName + "
" + (string.IsNullOrEmpty(item.CompanyOfficers) ? "" : (item.CompanyOfficers) + "(收)") + (string.IsNullOrEmpty(item.PhoneNum) ? item.MobileNum : item.PhoneNum) + "
印刷品
"; if (i % 2 != 0) { Printhtml = Printhtml + "
"; } i++; } else { if (m_EC_ExSingleTem != null) { Printhtml = Printhtml + "
" + m_EC_ExSingleTem.EST_Html .Replace("contentEditable", "x") .Replace("background-color: red;", "") .Replace("发-公司名称", CurrentUser.Name) .Replace("发-姓名", Request["d"]) .Replace("发-区域", CurrentUser.Province + CurrentUser.City.Replace("其他", "") + CurrentUser.County.Replace("其他", "")) .Replace("发-地址", CurrentMemberExtend.DetailedAddress) .Replace("发-邮编", CurrentMemberExtend.Postcode) .Replace("发-电话手机", string.IsNullOrEmpty(CurrentMemberExtend.PhoneNum) ? CurrentMemberExtend.MobileNum : CurrentMemberExtend.PhoneNum) .Replace("发-电话", CurrentMemberExtend.PhoneNum) .Replace("发-手机", CurrentMemberExtend.MobileNum) .Replace("发-省", CurrentUser.Province) .Replace("发-市", CurrentUser.City.Replace("其他", "")) .Replace("发-区", CurrentUser.County.Replace("其他", "")) .Replace("收-客户名称", item.CompanyName) .Replace("收-姓名", string.IsNullOrEmpty(item.BusinessManagers) ? item.CompanyOfficers : item.BusinessManagers) .Replace("收-区域", item.Province + item.City.Replace("其他", "") + item.County.Replace("其他", "")) .Replace("收-地址", item.DetailedAddress) .Replace("收-邮编", item.Postcode) .Replace("收-电话手机", string.IsNullOrEmpty(item.PhoneNum) ? item.MobileNum : item.PhoneNum) .Replace("收-电话", item.PhoneNum) .Replace("收-手机", item.MobileNum) .Replace("收-省", item.Province) .Replace("收-市", item.City.Replace("其他", "")) .Replace("收-区", item.County.Replace("其他", "")) .Replace("内件品名", Request["h"]) .Replace("寄件时间", DateTime.Now.ToString("yyyy年MM月dd").Replace("年", "   ").Replace("月", "   ")) + "
"; } } } this.divPrintHtml.InnerHtml = Printhtml; } } }