/**
|
* OrderProgressRate.aspx.cs
|
*
|
* 功 能: 订单进度
|
* 类 名: OrderProgressRate
|
*
|
* Ver 变更日期 负责人 变更内容
|
* ───────────────────────────────────
|
* V0.01 2013-5-21 9:48 吴崎均 初版
|
*
|
*
|
*
|
*/
|
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.Sys;
|
using System.Text;
|
using CY.BLL.EC;
|
using CY.Infrastructure.Common;
|
|
namespace CY.WebForm.Pages.business
|
{
|
/// <summary>
|
/// 订单进度
|
/// </summary>
|
public partial class OrderProgressRate : BasePage
|
{
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (IsPostBack || IsCallback)
|
{
|
return;
|
|
}
|
else ;
|
string id = Request["id"];
|
string typeidStr = Request["typeid"];
|
if (string.IsNullOrEmpty(Request["orderId"]) || string.IsNullOrEmpty(id) || string.IsNullOrEmpty(typeidStr))
|
{
|
return;
|
}
|
|
try
|
{
|
int? orderId = MyConvert.ConvertToInt32(id);
|
int? typeId = MyConvert.ConvertToInt32(typeidStr);
|
if (!orderId.HasValue || !typeId.HasValue) return; else ;
|
Sys_DictionaryBLL _sys_DictionaryBLL = new Sys_DictionaryBLL();
|
IEnumerable<Sys_Dictionary> types = _sys_DictionaryBLL.GetDataByType("EC_订单状态");
|
StringBuilder builder = new StringBuilder();
|
|
foreach (Sys_Dictionary item in types)
|
{
|
if (0 >= item.MeanValue) continue; else ;//已终止与中断不要
|
//if (0 < typeId.Value && 6 == item.MeanValue) continue; else ;
|
builder.Append(",{");
|
builder.Append(string.Format("id:{0},name:'{1}'", item.MeanValue, 1 == item.MeanValue ? "已下单" : item.Name));
|
builder.Append("}");
|
}
|
builder.Remove(0, 1);//去掉第一个逗号
|
builder.Insert(0, "[");
|
builder.Append("]");
|
Request.RequestContext.RouteData.DataTokens.Add("operates", builder.ToString());
|
|
|
EC_OrderBasicBLL _eC_OrderBasicBLL = new EC_OrderBasicBLL();
|
IList<EC_OrderOperate> orderOperates = _eC_OrderBasicBLL.SelectOrderOperates(orderId.Value) as IList<EC_OrderOperate>;
|
|
if (null == orderOperates || 0 == orderOperates.Count)
|
{
|
Request.RequestContext.RouteData.DataTokens.Add("dooperates", builder.ToString());
|
return;
|
}
|
else ;
|
|
EC_OrderOperate lastOperate = orderOperates.OrderBy(p => p.LastUpdateTime).Last();
|
if (lastOperate.OperateType != 0&&lastOperate.OperateType != -2)
|
{
|
orderOperates = orderOperates.Where(p => (p.OperateType != 0) && (p.OperateType != -2)).ToList<EC_OrderOperate>();
|
}
|
|
IEnumerable<IGrouping<int?, EC_OrderOperate>> groupOperate = orderOperates.GroupBy(o => o.OperateType);
|
builder = new StringBuilder();
|
string operateName = null;
|
foreach (IGrouping<int?, EC_OrderOperate> group in groupOperate)
|
{
|
EC_OrderOperate item = null;
|
if (group.Count() > 1)
|
item = group.OrderBy(obj => obj.LastUpdateTime).Last();//最后一个操作(最后操作时间最大的那个)
|
else
|
item = group.First();//仅有一个取第一个
|
|
builder.Append(",{");
|
|
Sys_Dictionary [] findResult = types.Where(t => t.MeanValue == item.OperateType).ToArray();
|
operateName = findResult.Length > 0 ? findResult[0].Name : "";
|
builder.Append(string.Format("id:{0},operator:'{1}',dotime:'{2}',name:'{3}'", item.OperateType, item.Operator, item.LastUpdateTime.Value.ToString(UtilConst.DATETIMEFORMAT), operateName));
|
builder.Append("}");
|
}
|
|
|
builder.Remove(0, 1);//去掉第一个逗号
|
builder.Insert(0, "[");
|
builder.Append("]");
|
|
Request.RequestContext.RouteData.DataTokens.Add("dooperates", builder.ToString());
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
Response.Clear();
|
Response.Write("<script>alert('数据获取失败!');</script>");
|
Response.End();
|
}
|
|
|
}
|
}
|
}
|