Пример #1
0
 protected void btnFilter_Click(object sender, EventArgs e)
 {
     if (txtDateFrom.Text == "" || txtDateTo.Text == "")
     {
         //Lọc theo mã đơn hàng
         if (txtOrderID.Text == "")
         {
             pnError.Visible = true;
             lblError.Text = "Bạn phải nhập thông tin tìm kiếm";
         }
         else
         {
             orBUS = new OrderBUS();
             if (orBUS.tblOrder_GetByID(txtOrderID.Text).Rows.Count > 0)
             {
                 this.dtlOrder.DataSource = orBUS.tblOrder_GetByID(txtOrderID.Text);
                 this.dtlOrder.DataBind();
             }
             else
             {
                 pnError.Visible = false;
                 pnSuccess.Visible = true;
                 lblSuccess.Text = "Không tìm thấy dữ liệu";
             }
         }
     }
         //Lọc theo ngày tháng lập đơn hàng
     else
     {
         DateTime from = convertStringToDate(txtDateFrom.Text);
         DateTime to = convertStringToDate(txtDateTo.Text);
         orBUS = new OrderBUS();
         if (orBUS.tblOrder_GetByDateCreate(from, to).Rows.Count > 0)
         {
             this.dtlOrder.DataSource = orBUS.tblOrder_GetByDateCreate(from, to);
             this.dtlOrder.DataBind();
         }
     }
 }