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;
|
|
namespace CY.WebForm.Pages.soft
|
{
|
//吴辉
|
//软件客户列表
|
public partial class ClientList : BasePage
|
{
|
Soft_ClientBLL bll_Soft_ClientBLL = null;
|
OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null;
|
public string Province = ""; //接收值 Request["selectProvince"].ToString2();
|
public string City = "";//接收值 Request["selectCity"].ToString2();
|
public string County = "";//接收值 Request["selectCounty"].ToString2();
|
|
//初始化
|
public ClientList()
|
{
|
bll_Soft_ClientBLL = new Soft_ClientBLL();
|
bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL();
|
}
|
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
|
Province = Request["selectProvince"].ToString2();
|
City = Request["selectCity"].ToString2();
|
County = Request["selectCounty"].ToString2();
|
if (!IsPostBack)
|
{
|
BindList();
|
}
|
if (Request["delete"] != null)
|
{
|
Soft_Client model = bll_Soft_ClientBLL.GetModelByKeyid(Request["delete"].ToInt32());
|
if (model != null && model.Keyid != null)
|
{
|
bll_Soft_ClientBLL.DeleteModel(model);
|
JavaScript.MessageBox("删除成功", this, "window.location='/Pages/Soft/ClientList.aspx';");
|
}
|
else
|
JavaScript.MessageBox("删除失败", this, "window.location='/Pages/Soft/ClientList.aspx';");
|
}
|
else if (Request["deleteKeyIds"] != null)
|
{
|
List<int> deleteKeyIdList = new List<int>();
|
string deleteKeyIds = Request["deleteKeyIds"].ToString().Trim(',');
|
string[] keyIdArry = deleteKeyIds.Split(',');
|
foreach (string keyId in keyIdArry)
|
{
|
Soft_Client model = bll_Soft_ClientBLL.GetModelByKeyid(keyId.ToInt32());
|
if (model.Keyid != null && model != null)
|
bll_Soft_ClientBLL.DeleteModel(model);
|
else
|
{
|
JavaScript.MessageBox("删除失败", this, "window.location='/Pages/Soft/ClientList.aspx';");
|
return;
|
}
|
}
|
JavaScript.MessageBox("删除成功", this, "window.location='/Pages/Soft/ClientList.aspx';");
|
}
|
else if (Request["importid"] != null)
|
{
|
Soft_Client m_Soft_Client = bll_Soft_ClientBLL.GetModelByKeyid(Request["importid"].ToInt32());
|
if (m_Soft_Client != null && m_Soft_Client.Keyid != null)
|
{
|
bool isExit = bll_OA_CorporateClientsBLL.isExistCompanyName(m_Soft_Client.ClientName.ToString2(), CurrentUser.MemberId, Guid.NewGuid());
|
|
if (!isExit)
|
{
|
OA_CorporateClients m_OA_CorporateClients = new OA_CorporateClients();
|
OA_CustomerCommunications m_OA_CustomerCommunications = new OA_CustomerCommunications();
|
EC_AcceptWayByCustomers m_EC_AcceptWayByCustomers = new EC_AcceptWayByCustomers();
|
|
#region 初始合作客户基础信息
|
|
m_OA_CorporateClients.CompanyName = m_Soft_Client.ClientName.ToString2();
|
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.LoginPwd = "";
|
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.OutVendorName = CurrentUser.Name;
|
m_OA_CorporateClients.LastUpdateTime = DateTime.Now;
|
m_OA_CorporateClients.Operator = CurrentUser.ShortName;
|
m_OA_CorporateClients.Remark = "来源于软件用户导入";
|
m_OA_CorporateClients.OutRate = 1;
|
|
#endregion
|
|
#region 初始合作客户通讯信息
|
|
m_OA_CustomerCommunications.Province = m_Soft_Client.ClientProvince;
|
m_OA_CustomerCommunications.City = m_Soft_Client.ClientCity;
|
m_OA_CustomerCommunications.County = m_Soft_Client.ClientCountry;
|
m_OA_CustomerCommunications.DetailedAddress = m_Soft_Client.ClientAddress;
|
m_OA_CustomerCommunications.CompanyPhone = m_Soft_Client.ClientPhone;
|
m_OA_CustomerCommunications.Postcode = m_Soft_Client.ClientPostcode;
|
m_OA_CustomerCommunications.Mobile = m_Soft_Client.ClientMobile;
|
m_OA_CustomerCommunications.Fax = "";
|
m_OA_CustomerCommunications.Email = m_Soft_Client.ClientEmail;
|
m_OA_CustomerCommunications.QQ = m_Soft_Client.ClientQQ;
|
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 = "";
|
m_EC_AcceptWayByCustomers.AppointCourierCompany = "";
|
|
#endregion
|
|
#region 新增操作
|
|
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 = Guid.NewGuid();
|
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;
|
m_OA_CorporateClients.MemberId = m_OA_CorporateClients.Keyid;
|
m_OA_CustomerCommunications.Keyid = m_OA_CorporateClients.Keyid;
|
m_EC_AcceptWayByCustomers.TargetId = m_OA_CorporateClients.Keyid;
|
|
#endregion
|
|
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;
|
JavaScript.MessageBox("导入成功", this, "window.location='/Pages/Soft/ClientList.aspx';");
|
}
|
else
|
JavaScript.MessageBox("导入失败", this, "window.location='/Pages/Soft/ClientList.aspx';");
|
}
|
else
|
{
|
JavaScript.MessageBox("导入失败,已存在此名称的的客户", this, "window.location='/Pages/Soft/ClientList.aspx';");
|
}
|
}
|
}
|
}
|
|
//绑定数据
|
private void BindList()
|
{
|
Pagination pa = new Pagination();
|
pa.PageSize = UCPager1.AspNetPager.PageSize;
|
pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
|
this.RepClientList.DataSource = bll_Soft_ClientBLL.SelectModelPage(pa, this.txtClientName.Value, null, "", "", "", Request["selectProvince"].ToString2(), Request["selectCity"].ToString2(), Request["selectCounty"].ToString2(), "", "", null, null, null, Guid.Empty, null, null, null, null, null, null, "");
|
this.RepClientList.DataBind();
|
UCPager1.AspNetPager.RecordCount = pa.RecordCount;
|
}
|
|
//分页事件
|
protected void AspNetPager1_PageChanged(object src, EventArgs e)
|
{
|
BindList();
|
}
|
|
//查询事件
|
protected void btn_Search_Click(object src, EventArgs e)
|
{
|
BindList();
|
}
|
}
|
}
|