/**
|
* 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;
|
using CY.SQLDAL;
|
using System.Data.SqlClient;
|
|
namespace CY.WebForm.Pages.business
|
{
|
/// <summary>
|
/// 订单详情
|
/// </summary>
|
public partial class OrderDeatil : BasePage
|
{
|
EC_OrderBasicBLL _eC_OrderBasicBLL = new EC_OrderBasicBLL();
|
Sys_DictionaryBLL _sys_DictionaryBLL = new Sys_DictionaryBLL();//字典业务逻辑操作类对象
|
public int ContractCount = 0;
|
public string BuyerId = "";
|
/// <summary>
|
/// 页面加载事件
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
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();
|
}
|
|
/// <summary>
|
/// 默认加载事件方法
|
/// </summary>
|
private void Page_Load_Default()
|
{
|
LoadOrderInfo();
|
}
|
|
/// <summary>
|
/// 加载订单信息
|
/// </summary>
|
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_AcceptWayByOrder.NumPerBag = _eC_OrderBasic.OrderExtend.NumPerBag;
|
_eC_AcceptWayByOrder.BagNum = _eC_OrderBasic.OrderExtend.BagNum;
|
|
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;
|
}
|
var sys_Dictionarie = _sys_DictionaryBLL.GetDataByType("印刷单位").FirstOrDefault(x=>x.MeanValue == _inquiryCommonModel.Unit);
|
if (sys_Dictionarie != null)
|
{
|
_eC_OrderBasic.UnitName = sys_Dictionarie.Name;
|
}
|
BuyerId = _eC_OrderBasic.BuyerId.ToString();
|
//查询客户是否有合同
|
Database DC = new Database();
|
try
|
{
|
|
string sqlStr = string.Format("select count(*) from [dbo].[OA_CorporateClientContract] where CorporateClientsid='{0}'", _eC_OrderBasic.BuyerId);
|
SqlCommand myCmd = new SqlCommand(sqlStr, DC.Connection);
|
ContractCount = (int)myCmd.ExecuteScalar();
|
}
|
catch (Exception)
|
{
|
|
ContractCount = 0;
|
}
|
finally
|
{
|
if (DC.Connection.State != System.Data.ConnectionState.Closed)
|
DC.Connection.Close();
|
}
|
|
|
rptOrder.DataSource = new List<EC_OrderBasic>() { _eC_OrderBasic };
|
rptOrder.DataBind();
|
rptAccpteWay.DataSource = "自提".Equals(_inquiryCommonModel.DeliveryModeName) ? null : new List<EC_AcceptWayByOrder>() { _eC_AcceptWayByOrder };
|
rptAccpteWay.DataBind();
|
rptInquiryCommon.DataSource = new List<InquiryCommonModel>() { _inquiryCommonModel };
|
rptInquiryCommon.DataBind();
|
|
this.lblRemark.Text = _eC_OrderBasic.Remark;
|
this.lblPrintPackDeliveryRequir.Text = _eC_OrderBasic.PrintPackDeliveryRequir;
|
return true;
|
}
|
|
/// <summary>
|
/// 改变打印状态
|
/// </summary>
|
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);
|
}
|
}
|
}
|
|
|
/// <summary>
|
/// 改变打印封签状态
|
/// </summary>
|
private void UpdatePrintfengqianState(int orderId)
|
{
|
|
if (CurrentUser != null)
|
{
|
|
_eC_OrderBasicBLL.UpdatePrintfengqianState(orderId);
|
|
}
|
}
|
}
|
}
|