示例#1
0
        private void LoadGridView()
        {
            DateTime dateFrom           = Conversion.TryCastDate(this.dateFromDateTextBox.Text);
            DateTime dateTo             = Conversion.TryCastDate(this.dateToDateTextBox.Text);
            string   office             = this.officeInputText.Value;
            string   party              = this.partyInputText.Value;
            string   priceType          = string.Empty;
            string   user               = this.userInputText.Value;
            string   referenceNumber    = this.referenceNumberInputText.Value;
            string   statementReference = this.statementReferenceInputText.Value;
            string   bookName           = TransactionBookHelper.GetInvariantTransactionBookName(this.Book, this.SubBook);

            if (this.priceTypeInputText != null)
            {
                priceType = this.priceTypeInputText.Value;
            }

            int userId   = this.UserId;
            int officeId = this.OfficeId;

            GridViewColumnHelper.AddColumns(this.productViewGridView, this.SubBook);

            if (this.IsNonGlTransaction)
            {
                this.productViewGridView.DataSource = NonGlStockTransaction.GetView(this.Catalog, userId, bookName, officeId, dateFrom,
                                                                                    dateTo, office, party, priceType, user, referenceNumber, statementReference);
                this.productViewGridView.DataBind();
                return;
            }

            if (this.Book == TranBook.Sales && this.SubBook == SubTranBook.Receipt)
            {
                this.productViewGridView.DataSource = CustomerReceipts.GetView(this.Catalog, userId, officeId, dateFrom, dateTo,
                                                                               office, party, user, referenceNumber, statementReference);
                this.productViewGridView.DataBind();
                return;
            }


            this.productViewGridView.DataSource = GLStockTransaction.GetView(this.Catalog, userId, bookName, officeId, dateFrom,
                                                                             dateTo, office, party, priceType, user, referenceNumber, statementReference);
            this.productViewGridView.DataBind();
        }
        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();
            }
        }