using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.Model;
|
using CY.BLL;
|
using CY.Infrastructure.Common;
|
using System.Data;
|
using CY.BLL.Sys;
|
using System.Text;
|
|
namespace CY.WebForm.Pages.membermanage
|
{
|
//吴辉
|
//新增/修改订单
|
public partial class MemberOrderEdit : BasePage
|
{
|
Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;
|
EC_MemberBasicBLL bll_EC_MemberBasicBLL = null;
|
EC_PaymentRecordBLL bll_EC_PaymentRecordBLL = null;
|
OA_StaffBLL bll_OA_StaffBLL = null;
|
|
//初始化
|
public MemberOrderEdit()
|
{
|
bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
|
bll_EC_MemberBasicBLL = new EC_MemberBasicBLL();
|
bll_EC_PaymentRecordBLL = new EC_PaymentRecordBLL();
|
bll_OA_StaffBLL = new OA_StaffBLL();
|
}
|
|
//页面加载
|
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)
|
{
|
InitData();
|
}
|
return;
|
}
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
Response.Clear();
|
Response.Write("");
|
}
|
Response.End();
|
}
|
|
/// <summary>
|
/// 绑定会员订单类型
|
/// </summary>
|
private void BindOrderTypeList()
|
{
|
IList<Sys_Dictionary> sysDicList = new Sys_DictionaryBLL().GetDataByType("会员订单类型").OrderBy(p => p.MeanValue).ToList<Sys_Dictionary>();
|
|
this.selOrderType.DataSource = sysDicList;
|
this.selOrderType.DataTextField = "Name";
|
this.selOrderType.DataValueField = "Name";
|
this.selOrderType.DataBind();
|
|
this.selOrderType.Items.Insert(0, new ListItem("全部", ""));
|
|
}
|
|
//绑定数据
|
public void InitData()
|
{
|
BindOrderTypeList();
|
|
//业务经理
|
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("请选择", ""));
|
|
EC_PaymentRecord m_EC_PaymentRecord = bll_EC_PaymentRecordBLL.GetModelByKeyid(Request["Keyid"].ToInt32());
|
if (m_EC_PaymentRecord != null)
|
{
|
this.selOrderType.SelectedValue = m_EC_PaymentRecord.PayType;
|
this.selOrderType.Enabled = false;
|
this.spanOperator.InnerText = m_EC_PaymentRecord.Operator;
|
this.spanRemark.InnerText = m_EC_PaymentRecord.Remark;
|
this.selAccountManagerId.Value = m_EC_PaymentRecord.AccountManagerId.ToString2();
|
this.selBusinessManagerId.Value = m_EC_PaymentRecord.BusinessManagerId.ToString2();
|
this.txtAdInstallments.Text = m_EC_PaymentRecord.AdInstallments;
|
this.txtAdInstallments.Enabled = false;
|
this.txtAdForum.Text = m_EC_PaymentRecord.AdForum;
|
this.txtAdForum.Enabled = false;
|
this.txtAdLocation.Text = m_EC_PaymentRecord.AdLocation;
|
this.txtAdLocation.Enabled = false;
|
this.txtAdSize.Text = m_EC_PaymentRecord.AdSize;
|
this.txtAdSize.Enabled = false;
|
this.spanAdImg.InnerHtml = m_EC_PaymentRecord.AdImg;
|
this.txtCompanyPhone.Text = m_EC_PaymentRecord.CompanyPhone;
|
this.txtCompanyPhone.Enabled = false;
|
this.txtCompanyName.Text = m_EC_PaymentRecord.MemberName;
|
this.txtCompanyName.Enabled = false;
|
this.txtReset.Visible = false;
|
this.txtHideMemberId.Value = m_EC_PaymentRecord.MemberId.ToString2();
|
this.txtContact.Text = m_EC_PaymentRecord.Contact;
|
this.txtContact.Enabled = false;
|
this.txtEmail.Text = m_EC_PaymentRecord.Email;
|
this.txtEmail.Enabled = false;
|
this.txtQQ.Text = m_EC_PaymentRecord.QQ;
|
this.txtQQ.Enabled = false;
|
this.txtSoftwarePermissions.Value = m_EC_PaymentRecord.SoftwarePermissions;
|
this.txtSoftwarePermissions.Attributes.Add("readonly", "readonly");
|
this.txtPayAllMoney.Value = m_EC_PaymentRecord.PayAllMoney.Value.ToString("0");
|
//this.txtPayMoney.Value = m_EC_PaymentRecord.PayMoney.Value.ToString("0");
|
this.txtPayStartTime.Value = (m_EC_PaymentRecord.PayStartTime ?? DateTime.Now).ToString("yyyy-MM-dd");
|
this.txtPayEndTime.Value = (m_EC_PaymentRecord.PayEndTime ?? DateTime.Now).ToString("yyyy-MM-dd");
|
|
switch (m_EC_PaymentRecord.PayType)
|
{
|
case "印刷厂商注册费":
|
this.PanelAd.Visible = false;
|
this.PanelSoft.Visible = false;
|
break;
|
case "个人网店押金":
|
this.PanelAd.Visible = false;
|
this.PanelSoft.Visible = false;
|
break;
|
case "杂志广告费":
|
this.PanelAd.Visible = true;
|
this.PanelWebAd.Visible = false;
|
this.PanelBookAd.Visible = true;
|
this.PanelSoft.Visible = false;
|
break;
|
case "网站广告费":
|
this.PanelAd.Visible = true;
|
this.PanelWebAd.Visible = true;
|
this.PanelBookAd.Visible = false;
|
this.PanelSoft.Visible = false;
|
break;
|
case "管理软件费":
|
this.PanelAd.Visible = false;
|
this.PanelSoft.Visible = true;
|
break;
|
default:
|
break;
|
}
|
}
|
else
|
{
|
this.txtPayStartTime.Value = DateTime.Now.ToString("yyyy-MM-dd");
|
this.txtPayEndTime.Value = DateTime.Now.AddYears(1).ToString("yyyy-MM-dd");
|
this.selOrderType.Items.Remove(new ListItem("网站广告费", "网站广告费"));
|
this.spanRemark.InnerText = bll_EC_PaymentRecordBLL.GetNewOrderId();
|
this.spanOperator.InnerText = CurrentUser.ShortName;
|
}
|
}
|
|
//绑定关联会员列表
|
protected string BindCompanyList(string companyname)
|
{
|
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("CustormKeyId:'{0}',", item.Keyid);
|
sb_html.AppendFormat("CustormName:'{0}',", item.Name);
|
sb_html.AppendFormat("CustormContact:'{0}',", item.BusinessContacts);
|
sb_html.AppendFormat("CustormPhone:'{0}',", item.PhoneNum);
|
sb_html.AppendFormat("CustormQQ:'{0}',", item.QQ);
|
sb_html.AppendFormat("CustormEamil:'{0}'", item.Email);
|
result = "{" + sb_html.ToString() + "}";
|
modelArry[i] = result;
|
i++;
|
}
|
return ("[" + string.Join(",", modelArry) + "]");
|
}
|
|
//提交事件
|
protected void btn_Submit_Click(object sender, EventArgs e)
|
{
|
try
|
{
|
EC_PaymentRecord m_EC_PaymentRecord = bll_EC_PaymentRecordBLL.GetModelByKeyid(Request["Keyid"].ToInt32());
|
if (m_EC_PaymentRecord != null)
|
{
|
m_EC_PaymentRecord.BusinessManagerId = this.selBusinessManagerId.Value.ToInt32() ?? 0;
|
m_EC_PaymentRecord.AccountManagerId = this.selAccountManagerId.Value.ToInt32() ?? 0;
|
m_EC_PaymentRecord.PayStartTime = this.txtPayStartTime.Value.ToDateTime2();
|
m_EC_PaymentRecord.PayEndTime = this.txtPayEndTime.Value.ToDateTime2();
|
m_EC_PaymentRecord.PayAllMoney = this.txtPayAllMoney.Value.ToInt32();
|
//m_EC_PaymentRecord.PayMoney = this.txtPayAllMoney.Value.ToInt32();
|
m_EC_PaymentRecord.LastUpdateTime = DateTime.Now;
|
if (bll_EC_PaymentRecordBLL.UpdateModel(m_EC_PaymentRecord))
|
JavaScript.MessageBox("更新成功", this, true, true);
|
else
|
JavaScript.MessageBox("操作失败", this);
|
}
|
else
|
{
|
EC_MemberBasic m_EC_MemberBasic = bll_EC_MemberBasicBLL.GetMemberByMemberId(this.txtHideMemberId.Value.ToGuid2());
|
|
m_EC_PaymentRecord = new EC_PaymentRecord();
|
m_EC_PaymentRecord.BusinessManagerId = this.selBusinessManagerId.Value.ToInt32() ?? 0;
|
m_EC_PaymentRecord.AccountManagerId = this.selAccountManagerId.Value.ToInt32() ?? 0;
|
m_EC_PaymentRecord.PayStartTime = this.txtPayStartTime.Value.ToDateTime2();
|
m_EC_PaymentRecord.PayEndTime = this.txtPayEndTime.Value.ToDateTime2();
|
m_EC_PaymentRecord.LastUpdateTime = DateTime.Now;
|
m_EC_PaymentRecord.AdForum = this.txtAdForum.Text;
|
m_EC_PaymentRecord.AdImg = "";
|
m_EC_PaymentRecord.AdInstallments = this.txtAdInstallments.Text;
|
m_EC_PaymentRecord.AdLocation = this.txtAdLocation.Text;
|
m_EC_PaymentRecord.AdSize = this.txtAdSize.Text;
|
m_EC_PaymentRecord.CompanyPhone = this.txtCompanyPhone.Text;
|
m_EC_PaymentRecord.Contact = this.txtContact.Text;
|
m_EC_PaymentRecord.Email = this.txtEmail.Text;
|
m_EC_PaymentRecord.MemberId = this.txtHideMemberId.Value.ToGuid2();
|
m_EC_PaymentRecord.MemberName = this.txtCompanyName.Text;
|
m_EC_PaymentRecord.Operator = CurrentUser.ShortName;
|
m_EC_PaymentRecord.PayAllMoney = this.txtPayAllMoney.Value.ToInt32()??0;
|
m_EC_PaymentRecord.PayMoney = this.txtPayAllMoney.Value.ToInt32();
|
m_EC_PaymentRecord.PayRole = m_EC_MemberBasic.MemberType;
|
m_EC_PaymentRecord.PayType = this.selOrderType.SelectedValue;
|
m_EC_PaymentRecord.QQ = this.txtQQ.Text;
|
m_EC_PaymentRecord.Remark = bll_EC_PaymentRecordBLL.GetNewOrderId();
|
m_EC_PaymentRecord.SoftwarePermissions = this.txtSoftwarePermissions.Value;
|
|
if (bll_EC_PaymentRecordBLL.InsertModel(m_EC_PaymentRecord))
|
{
|
//int typeid = 0;
|
//if (!string.IsNullOrEmpty(m_EC_PaymentRecord.PayType))
|
//{
|
// switch (m_EC_PaymentRecord.PayType)
|
// {
|
// case "杂志广告费":
|
// typeid = 90;
|
// break;
|
// case "管理软件费":
|
// typeid = 91;
|
// break;
|
// case "印刷厂商注册费":
|
// typeid = 89;
|
// break;
|
// case "个人网店押金":
|
// typeid = 393;
|
// break;
|
// default:
|
// typeid = 0;
|
// break;
|
// }
|
// if (typeid > 0)
|
// {
|
// Pay_PaymentAccountBLL _pay_PaymentAccountBLL = new Pay_PaymentAccountBLL();
|
// _pay_PaymentAccountBLL.SendPoOrMoToMember(m_EC_MemberBasic.MemberId, typeid, m_EC_PaymentRecord.PayMoney);
|
// }
|
//}
|
JavaScript.MessageBox("新增成功", this, true, true);
|
}
|
else
|
JavaScript.MessageBox("操作失败", this);
|
}
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
return;
|
}
|
}
|
|
//订单类型切换事件
|
protected void ChangeType(object sender, EventArgs e)
|
{
|
var type = this.selOrderType.SelectedValue.ToString2();
|
switch (type)
|
{
|
case "印刷厂商注册费":
|
this.PanelAd.Visible = false;
|
this.PanelSoft.Visible = false;
|
break;
|
case "印刷厂商续费":
|
this.PanelAd.Visible = false;
|
this.PanelSoft.Visible = false;
|
break;
|
case "个人网店押金":
|
this.PanelAd.Visible = false;
|
this.PanelSoft.Visible = false;
|
break;
|
case "杂志广告费":
|
this.PanelAd.Visible = true;
|
this.PanelWebAd.Visible = false;
|
this.PanelBookAd.Visible = true;
|
this.PanelSoft.Visible = false;
|
this.txtAdForum.Attributes.Remove("readonly");
|
this.txtAdInstallments.Attributes.Remove("readonly");
|
this.txtAdLocation.Attributes.Remove("readonly");
|
this.txtAdSize.Attributes.Remove("readonly");
|
break;
|
case "网站广告费":
|
this.PanelAd.Visible = true;
|
this.PanelWebAd.Visible = true;
|
this.PanelBookAd.Visible = false;
|
this.PanelSoft.Visible = false;
|
this.txtAdForum.Attributes.Add("readonly", "readonly");
|
this.txtAdLocation.Attributes.Add("readonly", "readonly");
|
this.txtAdSize.Attributes.Add("readonly", "readonly");
|
break;
|
case "管理软件费":
|
this.PanelAd.Visible = false;
|
this.PanelSoft.Visible = true;
|
break;
|
default:
|
break;
|
}
|
}
|
}
|
}
|