using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL.Integrity;
using CY.BLL.Sys;
using CY.Model;
using CY.BLL;
using CY.Infrastructure.Common;
using CY.BLL.EC;
namespace CY.WebForm.Pages.business
{
public partial class ComplainanEdit : BasePage
{
#region 变量
Integrity_ComplainanInfoBLL _integrity_ComplainanInfoBLL = new Integrity_ComplainanInfoBLL();
Sys_DictionaryBLL _sys_DictionaryBLL = new Sys_DictionaryBLL();
EC_MemberBasicBLL _eC_MemberBasicBLL = new EC_MemberBasicBLL();
EC_OrderBasicBLL bll_EC_OrderBasicBLL = new EC_OrderBasicBLL();
#endregion
#region 属性
#endregion
#region 方法
///
/// 绑定投诉类别
///
private void BindComplaintsType()
{
IEnumerable typeList = _sys_DictionaryBLL.GetDataByType("投诉类型");
this.ddlComplaintsType.DataSource = typeList;
this.ddlComplaintsType.DataTextField = "Name";
this.ddlComplaintsType.DataValueField = "MeanValue";
this.ddlComplaintsType.DataBind();
this.ddlComplaintsType.Items.Insert(0, new ListItem("请选择", ""));
if (string.IsNullOrEmpty(Request["type"].ToString2()))
{
this.ddlComplaintsType.Items.Remove(new ListItem("订单质量", "0"));
this.ddlComplaintsType.Items.Remove(new ListItem("恶意下单", "1"));
}
this.spanMemberName.InnerText = CurrentUser.Name;
this.spanContact.InnerText = CurrentMemberExtend.BusinessContacts;
this.spanPhoneNum.InnerText = CurrentMemberExtend.PhoneNum;
}
///
/// 绑定被投诉人
///
///
private void BindRespondent()
{
IList _list = _eC_MemberBasicBLL.GetAllMember().Where(p => p.MemberId != CurrentUser.MemberId).ToList();
this.ddlRespondent.DataSource = _list;
this.ddlRespondent.DataTextField = "Name";
this.ddlRespondent.DataValueField = "MemberId";
this.ddlRespondent.DataBind();
this.ddlRespondent.Items.Insert(0, new ListItem("请选择", ""));
this.ddlRespondent.Items.Insert(1, new ListItem("四川印刷网", "11111111-1111-1111-1111-111111111111"));
}
#endregion
#region 事件
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindComplaintsType();
BindRespondent();
if (Request["orderId"] != null)
{
this.hidOrderId.Value = Request["orderId"].ToString2();
this.txtOrderCode.Text = Request["orderCode"].ToString2();
this.ddlComplaintsType.SelectedValue = Request["type"].ToString2();
this.ddlComplaintsType.Enabled = false;
this.ddlRespondent.SelectedValue = Request["firmId"].ToString2();
this.ddlRespondent.Enabled = false;
this.palOrder.Visible = true;
EC_OrderBasic m_EC_OrderBasic = bll_EC_OrderBasicBLL.SelectModelById(Request["orderId"].ToInt32() ?? 0);
this.spanOrderName.InnerText = m_EC_OrderBasic.DocumentName;
this.spanOrderQuality.InnerText = m_EC_OrderBasic.OrderExtend.PrintNum.ToString2();
this.spanOrderMoney.InnerText ="¥"+ m_EC_OrderBasic.SumPrice.Value.ToString("0.00");
}
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
bool isSuccess = false;
Integrity_ComplainanInfo model = new Integrity_ComplainanInfo();
model.RespondentId = this.ddlRespondent.SelectedValue.ToString().ToGuid2();
model.ComplainantId = this.CurrentUser.MemberId;
model.OrderCode = this.txtOrderCode.Text;
if (this.hidOrderId.Value != "")
model.OrderId = this.hidOrderId.Value.ToInt32().Value;
model.ComplaintsReason = this.txtComplaintsReason.Text;
model.ComplaintsStatusId = 0;
model.ComplaintsTypeId = this.ddlComplaintsType.SelectedValue.ToInt32().Value;
model.ComplaintsTime = DateTime.Now;
model.LastUpdateTime = DateTime.Now;
isSuccess = _integrity_ComplainanInfoBLL.InserModel(model);
if (isSuccess)
{
JavaScript.RefreshDIVOpener(this);
}
else
{
JavaScript.MessageBox("保存失败", this);
}
}
#endregion
}
}