using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Bll;

public partial class OrdersManage_PrintOrderBill : System.Web.UI.Page
{
	protected void Page_Load(object sender, EventArgs e)
	{
		DropDownList1.Attributes.Add("OnClick", "bind()");
        if (Convert.ToString(Session["username"]) == "")
        {
            Response.Write("<script language=javascript>alert('请登录');location='../login.aspx'</script>");
        }
		if(!IsPostBack)
		{
            Button4_Click(sender, e);
			this.Inistans();
		}
	}

	/// <summary>
	/// 页面初始化数据
	/// </summary>
	public void Inistans()
	{
		AreaBusniss ab = new AreaBusniss();
		DataSet ds = ab.GetAllArea();
		DropDownList1.DataSource = ds.Tables[0];
		DropDownList1.DataTextField = "NAME";
		DropDownList1.DataBind();
	}

	protected void Button4_Click(object sender, EventArgs e)
	{
        string area = Area.Text.ToString() == "" ? "" : Area.Text.ToString();
        string day = Day.Text == "" ? "1900-1-1" : Day.Text;
        string month = Month.Text == "" ? "1900-1-1" : Month.Text;
        string startTime = StartTime.Text == "" ? "1900-1-1" : StartTime.Text;
        string overTime = OverTime.Text == "" ? "1900-1-1" : OverTime.Text;

        OrdersBll ob = new OrdersBll();
        DataSet ds = new DataSet();
        ds = ob.GetAllNotQuOrdersInfo(area,Convert.ToDateTime(day), Convert.ToDateTime(month), Convert.ToDateTime(startTime), Convert.ToDateTime(overTime));
        GridView1.DataSource = ds.Tables["Orders"];
        GridView1.DataBind();
	}

    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        Button4_Click(sender, e);
    }
}
