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.BLL;
using CY.Infrastructure.Common;
namespace CY.WebForm.Pages.business
{
//吴辉
//生产安排
public partial class AgOrderProduction : BasePage
{
EC_OrderBasicBLL _eC_OrderBasicBLL = null;
OA_StaffBLL bll_OA_StaffBLL = null;
public bool IsUse = false;
///
/// 初始化构造
///
public AgOrderProduction()
{
_eC_OrderBasicBLL = new EC_OrderBasicBLL();
bll_OA_StaffBLL = new OA_StaffBLL();
}
///
/// 加载事件
///
///
///
protected void Page_Load(object sender, EventArgs e)
{
try
{
switch (Request["Target"])
{
default:
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;
List dialogues = _eC_OrderBasicBLL.SelectPropertyChangeRequest(CurrentUser.MemberId) as List;
if (!IsPostBack && !IsCallback)
{
Sys_DictionaryBLL _sys_DictionaryBLL = new Sys_DictionaryBLL();//字典业务逻辑操作类对象
SysInquiry_PrintingTypeBLL _sysInquiry_PrintingTypeBLL = new SysInquiry_PrintingTypeBLL();//印刷业务类型业务逻辑操作类对象
this.selPayStates.DataSource = _sys_DictionaryBLL.GetDataByType("EC_订单支付状态");
this.selPayStates.DataBind();
this.selPayStates.Items.Add(new ListItem("所有", ""));
this.selPrintTypes.DataSource = _sysInquiry_PrintingTypeBLL.SelectUsedModles();
this.selPrintTypes.DataBind();
this.selPrintTypes.Items.Add(new ListItem("其他", "-1"));
this.selOrderTypes.DataSource = _sys_DictionaryBLL.GetDataByType("EC_订单类型");
//selOrderStates.DataSource = _sys_DictionaryBLL.GetDataByType("EC_订单状态");
this.selOrderTypes.DataBind();
//selOrderStates.DataBind();
this.selPrintTypes.Items.Insert(0, new ListItem("所有", ""));
this.selOrderTypes.Items.Add(new ListItem("所有", ""));
this.selOrderStates.Items.Add(new ListItem("所有", ""));
this.selOrderStates.Items.Add(new ListItem("未开工", "2"));
this.selOrderStates.Items.Add(new ListItem("已开工", "3"));
this.selPrintTypes.Value = "";
this.selOrderTypes.Value = "";
this.selOrderStates.Value = "2";
this.selPayStates.Value = "";
this.selClientManager.DataSource = bll_OA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, false, true);
this.selClientManager.DataTextField = "Name";
this.selClientManager.DataValueField = "Name";
this.selClientManager.DataBind();
this.selClientManager.Items.Insert(0, new ListItem("全部", ""));
this.selBusinessManager.DataSource = bll_OA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, true, false);
this.selBusinessManager.DataTextField = "Name";
this.selBusinessManager.DataValueField = "Name";
this.selBusinessManager.DataBind();
this.selBusinessManager.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, 1, CurrentUser.MemberId);
SetParamValue(searchParam, 2, this.txtOrderId.Value.Trim());
SetParamValue(searchParam, 3, this.txtCustormerName.Value.Trim());
SetParamValue(searchParam, 4, this.txtBeginData.Value.Trim());
SetParamValue(searchParam, 5, this.txtEndDate.Value.Trim());
SetParamValue(searchParam, 6, this.selPrintTypes.Value);
SetParamValue(searchParam, 7, this.selOrderTypes.Value);
SetParamValue(searchParam, 8, this.selOrderStates.Value);
SetParamValue(searchParam, 9, this.selPayStates.Value);
SetParamValue(searchParam, 10, this.txtCreaterName.Value.Trim());
SetParamValue(searchParam, 11, "");
SetParamValue(searchParam, 12, this.selClientManager.Value);
SetParamValue(searchParam, 13, this.selBusinessManager.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;
else
{
}
if (target.ContainsKey(key))
{
target[key] = value;
}
else
{
target.Add(key, value);
}
}
///
/// 分页事件
///
///
///
private void AspNetPager_PageChanged(object sender, EventArgs e)
{
UCPager1.AspNetPager.PageSize = 25;
Infrastructure.Query.Pagination pagination = new Infrastructure.Query.Pagination()
{
PageSize = UCPager1.AspNetPager.PageSize,
PageIndex = UCPager1.AspNetPager.CurrentPageIndex
};
IEnumerable result = _eC_OrderBasicBLL.SelectModelPageAg(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;
}
}
}
}