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;
using CY.Infrastructure.Query;
using CY.BLL;
namespace CY.WebForm.Pages.financial
{
//吴辉
//外协付款
public partial class OutsourcePayOrder : BasePage
{
EC_OrderBasicBLL _eC_OrderBasicBLL = null;
OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null;
///
/// 初始化构造
///
public OutsourcePayOrder()
{
_eC_OrderBasicBLL = new EC_OrderBasicBLL();
bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL();
}
///
/// 加载事件
///
///
///
protected void Page_Load(object sender, EventArgs e)
{
try
{
Page_Load_Default();
return;
}
catch (Exception ex)
{
PAGEHandleException(ex);
Response.Clear();
Response.Write("-1");
}
Response.End();
}
///
/// 默认执行方法
///
private void Page_Load_Default()
{
UCPager1.AspNetPager.PageChanged += AspNetPager_PageChanged;
this.btn_Search.Click += btn_Search_Click;
this.txtCommission.Value = CY.Config.WebInfo.Instance.FirmOrderAgencyFee;
if (!IsPostBack && !IsCallback)
{
Pagination pa = new Pagination();
pa.PageSize = 500;
pa.PageIndex = 1;
Sys_DictionaryBLL _sys_DictionaryBLL = new Sys_DictionaryBLL();//字典业务逻辑操作类对象
this.selPayStates.DataSource = _sys_DictionaryBLL.GetDataByType("EC_订单支付状态");
this.selPayStates.DataBind();
this.selPayStates.Items.Add(new ListItem("所有", ""));
this.txtPMS_Printers.DataSource = bll_OA_CorporateClientsBLL.SelectModelPage(pa, CurrentUser.MemberId, "");
this.txtPMS_Printers.DataTextField = "OutVendorName";
this.txtPMS_Printers.DataValueField = "FirmId";
this.txtPMS_Printers.DataBind();
this.txtPMS_Printers.Items.Insert(0, new ListItem("全部", ""));
this.selPayStates.Value = "0";
//初次数据加载
btn_Search_Click(btn_Search, new EventArgs());
}
}
///
/// 搜索按钮点击事件
///
///
///
private void btn_Search_Click(object sender, EventArgs e)
{
Dictionary searchParam = new Dictionary();
SetParamValue(searchParam, 0, CurrentUser.MemberId);
SetParamValue(searchParam, 1, (string.IsNullOrEmpty(this.txtPMS_Printers.Value) ? Guid.Empty : this.txtPMS_Printers.Value.ToGuid2()));
SetParamValue(searchParam, 2, this.txtOrderId.Value.Trim());
SetParamValue(searchParam, 4, this.txtBeginData.Value.Trim());
SetParamValue(searchParam, 5, this.txtEndDate.Value.Trim());
SetParamValue(searchParam, 7, this.selPrintTypes.Value);
SetParamValue(searchParam, 9, this.selPayStates.Value);
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;
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_Outsource(pagination, SearchParam);
rptData.DataSource = result;
rptData.DataBind();
UCPager1.AspNetPager.RecordCount = pagination.RecordCount;
EC_OrderBasic m_EC_OrderBasic = _eC_OrderBasicBLL.SumOrderMoney(pagination, SearchParam);
if (m_EC_OrderBasic != null)
{
this.AllMoney.InnerText = (m_EC_OrderBasic.OrAllTradingMoney ?? 0).ToString("0.00");
this.AlreadyMoney.InnerText = (m_EC_OrderBasic.OrAllPayedMoney ?? 0).ToString("0.00");
this.NoMoney.InnerText = (m_EC_OrderBasic.OrAllUnPayedMoney ?? 0).ToString("0.00");
}
}
///
/// 查询参数
///
private Dictionary SearchParam
{
get
{
return ViewState["SearchParam"] as Dictionary;
}
set
{
ViewState["SearchParam"] = value;
}
}
}
}