using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL;
using CY.Infrastructure.Common;
using CY.Model;
using CY.BLL.EC;
using CY.Infrastructure.Query;
namespace CY.WebForm.Pages.business
{
//吴辉
//后道工单列表
public partial class AgOutsourcSingleAfterList : BasePage
{
EC_OrderBasicBLL bll_EC_OrderBasicBLL = null;
OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null;
//初始化
public AgOutsourcSingleAfterList()
{
bll_EC_OrderBasicBLL = new EC_OrderBasicBLL();
bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL();
}
//页面加载
protected void Page_Load(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Request["delete"]))
{
EC_OrderBasic _eC_OrderBasic = bll_EC_OrderBasicBLL.SelectModelById(Request["delete"].ToInt32().Value);
if (_eC_OrderBasic.BuyerId == CurrentUser.MemberId)
{
if (bll_EC_OrderBasicBLL.DeleteOutOrder(Request["delete"].ToInt32().Value))
Response.Redirect("/Pages/business/AgOutsourcSingleAfterList.aspx");
else
Response.Redirect("/Pages/business/AgOutsourcSingleAfterList.aspx");
}
else
Response.Redirect("/Pages/business/AgOutsourcSingleAfterList.aspx");
}
UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
if (!IsPostBack)
{
BindOutFirm();
BindList();
}
}
//绑定外协厂商
public void BindOutFirm()
{
Pagination pa = new Pagination();
pa.PageSize = 500;
pa.PageIndex = 1;
this.selOutFirm.DataSource = bll_OA_CorporateClientsBLL.SelectModelPage(pa, CurrentUser.MemberId, "");
this.selOutFirm.DataTextField = "OutVendorName";
this.selOutFirm.DataValueField = "FirmId";
this.selOutFirm.DataBind();
this.selOutFirm.Items.Insert(0,new ListItem("全部", ""));
}
//绑定数据
private void BindList()
{
Pagination pa = new Pagination();
pa.PageSize = UCPager1.AspNetPager.PageSize;
pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
this.RepClientList.DataSource = bll_EC_OrderBasicBLL.SelectAferOfOutOrder(pa, CurrentUser.MemberId, this.txtStartCreatTime.Value.ToDateTime2(), this.txtEndCreatTime.Value.ToDateTime2(), this.txtStartReturnTime.Value.ToDateTime2(), this.txtEndReturnTime.Value.ToDateTime2(), this.txtCreater.Value, this.selOutFirm.Value, this.selWorkStates.Value, this.txtOutOrderId.Value, 3);
this.RepClientList.DataBind();
UCPager1.AspNetPager.RecordCount = pa.RecordCount;
}
//分页事件
protected void AspNetPager1_PageChanged(object src, EventArgs e)
{
BindList();
}
//查询事件
protected void btn_Search_Click(object sender, EventArgs e)
{
BindList();
}
///
/// 是否已经操作
///
///
///
///
///
public bool IsOpearted(object keyidObj, object orderStateObj, object opTypeObj)
{
int keyid = (int)keyidObj;
int orderState = (int)orderStateObj;
string opType = (string)opTypeObj;
return bll_EC_OrderBasicBLL.IsOpearted(keyid, orderState, opType);
}
}
}