/**
* QuoteDemandList.aspx.cs
*
* 功 能: 报价需求列表管理页
* 类 名: QuoteDemandList
*
* Ver 变更日期 负责人 变更内容
* ───────────────────────────────────
* V0.01 2013-4-9 10:43 吴崎均 初版
* V0.02 2013-4-12 17:45 吴崎均 完成分页查询、增加批量删除
* V0.03 2013-4-16 吴崎均 变更查询方式,使分页过程中修改查询条件对分页无影响
* V0.04 2013-6-16 18:40 吴崎均 细节调整,显示创建时间、时间范围搜索将截止日期加一天、增加名称与数据状态查询
*
*
*
*
*
*
*/
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.BLL.Sys;
using CY.Infrastructure.Common;
namespace CY.WebForm.Pages.business
{
///
/// 报价需求管理
///
public partial class QuoteDemandList : BasePage
{
private SysInquiry_PrintingTypeBLL _sysInquiry_PrintingTypeBLL = null;//印刷业务类型业务逻辑操作类对象
private EC_QuoteDemandBLL _eC_QuoteDemandBLL = null;//报价需求逻辑操作对象
///
/// 初始化
///
public QuoteDemandList()
{
_sysInquiry_PrintingTypeBLL = new SysInquiry_PrintingTypeBLL();
_eC_QuoteDemandBLL = new EC_QuoteDemandBLL();
}
protected void Page_Load(object sender, EventArgs e)
{
try
{
switch (Request["Target"])
{
case "BatchDelete":
CY.WebForm.cs.WebUtil.DeleteData(_eC_QuoteDemandBLL.DeleteDataByIds, CurrentUser.ShortName);//调用通用删除方法
break;
case "publish":
case "setend":
CY.WebForm.cs.WebUtil.ChangeState(_eC_QuoteDemandBLL.ChangeState);//调用通用修改状态方法
break;
default:
UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
btn_Search.Click += new EventHandler(btn_Search_Click);
if (!IsPostBack && !IsCallback)
{
InitPrintTypeData();
BingData();
}
else { }
return;
}
}
catch (Exception ex)
{
PAGEHandleException(ex);
Response.Clear();
Response.Write("-1");
}
Response.End();
}
///
/// 查询按钮点击事件
///
///
///
private void btn_Search_Click(object sender, EventArgs e)
{
PrintTypeId = string.IsNullOrEmpty(selPrintTypes.Value) ? -1 : MyConvert.ConvertToInt32(selPrintTypes.Value).Value;
BeginDate = MyConvert.ConvertToDateTime(txtBeginDate.Value);
EndDate = MyConvert.ConvertToDateTime(txtEndDate.Value);
EndDate = EndDate.HasValue ? (Nullable)EndDate.Value.AddDays(1) : null;
Name = txtName.Value;
UCPager1.AspNetPager.CurrentPageIndex = 1;
BingData();
}
///
/// 分页事件
///
///
///
protected void AspNetPager1_PageChanged(object src, EventArgs e)
{
BingData();
}
///
/// 加载是否结束情况数据
///
private void InitPrintTypeData()
{
selPrintTypes.DataSource = _sysInquiry_PrintingTypeBLL.SelectUsedModles();
selPrintTypes.DataBind();
selPrintTypes.Items.Add(new ListItem("不限", ""));
}
///
/// 绑定数据
///
private void BingData()
{
txtBeginDate.Value = BeginDate.HasValue ? BeginDate.Value.ToString(UtilConst.DATEFORMAT) : "";
txtEndDate.Value = EndDate.HasValue ? EndDate.Value.AddDays(-1).ToString(UtilConst.DATEFORMAT) : "";
selPrintTypes.Value = -1 == PrintTypeId ? "" : PrintTypeId.ToString();
txtName.Value = Name;
Infrastructure.Query.Pagination pagination = new Infrastructure.Query.Pagination() { PageSize = UCPager1.AspNetPager.PageSize, PageIndex = UCPager1.AspNetPager.CurrentPageIndex };
rptData.DataSource = _eC_QuoteDemandBLL.SelectModelPage(pagination, CurrentUser.MemberId, Name, BeginDate, EndDate, PrintTypeId);
UCPager1.AspNetPager.RecordCount = pagination.RecordCount;
rptData.DataBind();
}
#region 查询参数
private string Name
{
get { object obj = ViewState["Name"]; return null == obj ? null : MyConvert.ConvertToString(Name); }
set { ViewState["Name"] = value; }
}
private DateTime? BeginDate
{
get { object obj = ViewState["BeginDate"]; return null == obj ? null : MyConvert.ConvertToDateTime(obj); }
set { ViewState["BeginDate"] = value; }
}
private DateTime? EndDate
{
get { object obj = ViewState["EndDate"]; return null == obj ? null : MyConvert.ConvertToDateTime(obj); }
set { ViewState["EndDate"] = value; }
}
private int PrintTypeId
{
get { object obj = ViewState["PrintTypeId"]; return null == obj ? -1 : MyConvert.ConvertToInt32(obj).Value; }
set { ViewState["PrintTypeId"] = value; }
}
#endregion
}
}