コード例 #1
0
        private void LoadGridView()
        {
            DateTime dateFrom           = Conversion.TryCastDate(this.DateFromDateTextBox.Text);
            DateTime dateTo             = Conversion.TryCastDate(this.DateToDateTextBox.Text);
            string   office             = this.OfficeTextBox.Text;
            string   party              = this.PartyTextBox.Text;
            string   priceType          = this.PriceTypeTextBox.Text;
            string   user               = this.UserTextBox.Text;
            string   referenceNumber    = this.ReferenceNumberTextBox.Text;
            string   statementReference = this.StatementReferenceTextBox.Text;
            string   bookName           = TransactionBookHelper.GetTransactionBookName(this.Book, this.SubBook);

            int userId   = SessionHelper.GetUserId();
            int officeId = SessionHelper.GetOfficeId();

            WebControls.StockTransactionView.Helpers.GridViewColumnHelper.AddColumns(this.ProductViewGridView, this.SubBook);

            if (this.IsNonGlTransaction())
            {
                if (this.SubBook == SubTranBook.Receipt)
                {
                    using (DataTable table = CustomerReceipts.GetView(userId, officeId, dateFrom, dateTo, office, party, user, referenceNumber, statementReference))
                    {
                        this.ProductViewGridView.DataSource = table;
                        this.ProductViewGridView.DataBind();
                        return;
                    }
                }
                using (DataTable table = NonGlStockTransaction.GetView(bookName, dateFrom, dateTo, office, party, priceType, user, referenceNumber, statementReference))
                {
                    this.ProductViewGridView.DataSource = table;
                    this.ProductViewGridView.DataBind();
                    return;
                }
            }

            using (DataTable table = GLStockTransaction.GetView(bookName, dateFrom, dateTo, office, party, priceType, user, referenceNumber, statementReference))
            {
                this.ProductViewGridView.DataSource = table;
                this.ProductViewGridView.DataBind();
            }
        }