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.Model;
using CY.BLL.Sys;
using CY.Infrastructure.Common;
namespace CY.WebForm.Pages.membermanage
{
//吴辉
//买家订单
public partial class MemberBuyerOrder : BasePage
{
EC_OrderBasicBLL _eC_OrderBasicBLL = null;
///
/// 初始化构造
///
public MemberBuyerOrder()
{
_eC_OrderBasicBLL = new EC_OrderBasicBLL();
}
///
/// 加载事件
///
///
///
protected void Page_Load(object sender, EventArgs e)
{
UCPager1.AspNetPager.PageChanged += AspNetPager_PageChanged;
btn_Search.Click += btn_Search_Click;
try
{
if (!IsPostBack)
{
Page_Load_Default();
}
}
catch (Exception ex)
{
PAGEHandleException(ex);
Response.Clear();
Response.Write("-1");
}
}
///
/// 默认执行方法
///
private void Page_Load_Default()
{
txtCommission.Value = CY.Config.WebInfo.Instance.FirmOrderAgencyFee;
if (!IsPostBack && !IsCallback)
{
Sys_DictionaryBLL _sys_DictionaryBLL = new Sys_DictionaryBLL();//字典业务逻辑操作类对象
selOrderStates.DataSource = _sys_DictionaryBLL.GetDataByType("EC_订单状态");
selOrderStates.DataBind();
selOrderStates.Items.Insert(0, new ListItem("所有", ""));
//初次数据加载
btn_Search_Click(btn_Search, new EventArgs());
}
}
///
/// 搜索按钮点击事件
///
///
///
private void btn_Search_Click(object sender, EventArgs e)
{
Dictionary searchParam = new Dictionary();
SetParamValue(searchParam, 0, Request["MemberId"].ToGuid2());
SetParamValue(searchParam, 2, txtOrderId.Value.Trim());
SetParamValue(searchParam, 4, txtBeginData.Value.Trim());
SetParamValue(searchParam, 5, txtEndDate.Value.Trim());
SetParamValue(searchParam, 6, "");
SetParamValue(searchParam, 8, selOrderStates.Value);
SetParamValue(searchParam, 9, "");
SetParamValue(searchParam, 14, "");
SearchParam = searchParam;
UCPager1.AspNetPager.CurrentPageIndex = 1;//重置页数
//再次查询
AspNetPager_PageChanged(UCPager1.AspNetPager, new EventArgs());
}
///
/// 设置查询参数方法
///
/// 设置目标
/// 键
/// 值
private static void SetParamValue(Dictionary target, int key, object value)
{
if (string.IsNullOrEmpty(string.Format("{0}", value)))
return;
else
{
}
if (target.ContainsKey(key))
{
target[key] = value;
}
else
{
target.Add(key, value);
}
}
///
/// 分页事件
///
///
///
private void AspNetPager_PageChanged(object sender, EventArgs e)
{
//UCPager1.AspNetPager.PageSize = 3;
Infrastructure.Query.Pagination pagination = new Infrastructure.Query.Pagination()
{
PageSize = UCPager1.AspNetPager.PageSize,
PageIndex = UCPager1.AspNetPager.CurrentPageIndex
};
IEnumerable result = _eC_OrderBasicBLL.SelectModelPage(pagination, SearchParam);
rptData.DataSource = result;
rptData.DataBind();
UCPager1.AspNetPager.RecordCount = pagination.RecordCount;
}
///
/// 查询参数
///
private Dictionary SearchParam
{
get
{
return ViewState["SearchParam"] as Dictionary;
}
set
{
ViewState["SearchParam"] = value;
}
}
///
/// 可不可以冻结订单
///
///
public bool IsCanFreezeOrder(int OrderState)
{
//订单状态为“确认收货”,"已完成","已终止","已冻结","处理中","退款"时不能冻结订单
IList typeList = new List()
{
6,-1,0,-2,-5,-4
};
if (typeList.Contains(OrderState))
{
return false;
}
else
{
return true;
}
}
}
}