/**
* OrderDeatil.aspx.cs
*
* 功 能: 订单详情
* 类 名: OrderDeatil
*
* Ver 变更日期 负责人 变更内容
* ───────────────────────────────────
* V0.01 2013-4-24 13:25 吴崎均 初版
* V0.02 2013-5-15 18:23 吴崎均 编辑界面样式
* V0.03 2013-5-15 15:58 吴崎均 完成数据获取
* V0.04 2013-5-21 14:38 吴崎均 增加订单进度
* V0.05 2013-5-23 9:33 吴崎均 修改继承类为默认类Page使显示信息不受登录控制
*
*
*
*
*
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL.EC;
using CY.Infrastructure.Common;
using CY.Model;
using CY.BLL;
using CY.Model.Inquiry;
using CY.BLL.Sys;
namespace CY.WebForm.Pages.business
{
///
/// 订单详情
///
public partial class OrderDeatil : BasePage
{
EC_OrderBasicBLL _eC_OrderBasicBLL = new EC_OrderBasicBLL();
///
/// 页面加载事件
///
///
///
protected void Page_Load(object sender, EventArgs e)
{
try
{
switch (Request["Target"])
{
case "GetCommunication":
break;
case "print":
int orderId = Request["orderIdStr"].ToString().ToInt32().Value;
UpdatePrintState(orderId);
break;
case "Printfengqian":
int orderIds = Request["orderIdStr"].ToString().ToInt32().Value;
UpdatePrintfengqianState(orderIds);
break;
default:
Page_Load_Default();
return;
}
}
catch (Exception ex)
{
PAGEHandleException(ex);
Response.Clear();
Response.Write("-1");
}
Response.End();
}
///
/// 默认加载事件方法
///
private void Page_Load_Default()
{
LoadOrderInfo();
}
///
/// 加载订单信息
///
private bool LoadOrderInfo()
{
string orderIdStr = Request["orderId"];
this.hideOrderId.Value = orderIdStr;
if (string.IsNullOrEmpty(orderIdStr))
{
CY.WebForm.BasePage.JavaScript.MessageBox("未传递参数!", this);
return false;
}
int? orderId = MyConvert.ConvertToInt32(orderIdStr);
if (!orderId.HasValue)
{
CY.WebForm.BasePage.JavaScript.MessageBox("未传递参数!", this);
return false;
}
EC_OrderBasic _eC_OrderBasic = _eC_OrderBasicBLL.SelectModelById(orderId.Value);
if (null == _eC_OrderBasic)
{
CY.WebForm.BasePage.JavaScript.MessageBox("数据不存在!", this);
return false;
}
if (CurrentUser.MemberId!=Guid.Parse(UtilConst.AdminFirmId)&&_eC_OrderBasic.BuyerId != CurrentUser.MemberId && _eC_OrderBasic.SellerId != CurrentUser.MemberId)
{
CY.WebForm.BasePage.JavaScript.MessageBox("数据不存在!", this);
return false;
}
EC_AcceptWayByOrderBLL _eC_AcceptWayByOrderBLL = new EC_AcceptWayByOrderBLL();
EC_AcceptWayByOrder _eC_AcceptWayByOrder = _eC_AcceptWayByOrderBLL.GetModelByTargetId(orderId.Value);
if (null == _eC_AcceptWayByOrder)
{
CY.WebForm.BasePage.JavaScript.MessageBox("数据不存在!", this);
return false;
}
EC_OrderPrintParameterBLL _eC_OrderPrintParameterBLL = new EC_OrderPrintParameterBLL();
EC_OrderPrintParameter _eC_OrderPrintParameter = _eC_OrderPrintParameterBLL.GetModel(orderId.Value);
InquiryCommonModel _inquiryCommonModel = null;
if (null == _eC_OrderPrintParameter)
{
_inquiryCommonModel = new InquiryCommonModel();
}
else
{
_inquiryCommonModel = SerializationHelper.DeSerialize(typeof(InquiryCommonModel), _eC_OrderPrintParameter.PrintParameter) as InquiryCommonModel;
}
Sys_DictionaryBLL sys_DictionaryBLL = new Sys_DictionaryBLL();
_inquiryCommonModel.DeliveryModeName = sys_DictionaryBLL.GetModelByKeyid(_eC_AcceptWayByOrder.AcceptTypeId);
_inquiryCommonModel.BillModeName = _eC_AcceptWayByOrder.InvoiceDemand;
if (_inquiryCommonModel.PrintTypeId == 13)
{
_inquiryCommonModel.PrintDemand = _inquiryCommonModel.PrintCountName + "," + _inquiryCommonModel.PrintDemand;
}
rptOrder.DataSource = new List() { _eC_OrderBasic };
rptOrder.DataBind();
rptAccpteWay.DataSource = "自提".Equals(_inquiryCommonModel.DeliveryModeName) ? null : new List() { _eC_AcceptWayByOrder };
rptAccpteWay.DataBind();
rptInquiryCommon.DataSource = new List() { _inquiryCommonModel };
rptInquiryCommon.DataBind();
this.lblRemark.Text = _eC_OrderBasic.Remark;
this.lblPrintPackDeliveryRequir.Text = _eC_OrderBasic.PrintPackDeliveryRequir;
return true;
}
///
/// 改变打印状态
///
private void UpdatePrintState(int orderId)
{
EC_OrderBasic _eC_OrderBasic = _eC_OrderBasicBLL.SelectModelById(orderId);
if (CurrentUser != null)
{
//当是卖家时改变打印状态
if (CurrentUser.MemberId == _eC_OrderBasic.SellerId)
{
_eC_OrderBasicBLL.UpdatePrintState(orderId);
}
}
}
///
/// 改变打印封签状态
///
private void UpdatePrintfengqianState(int orderId)
{
if (CurrentUser != null)
{
_eC_OrderBasicBLL.UpdatePrintfengqianState(orderId);
}
}
}
}