Пример #1
0
    // gets line items for given invoice number
    private List <LineItem_AS3> GetCreateLines(int _invoiceNum)
    {
        // build command, get reader
        string          _query  = string.Format("SELECT * FROM LineItem WHERE (InvoiceNumber = {0});", _invoiceNum);
        OleDbCommand    _cmd    = new OleDbCommand(_query, connection);
        OleDbDataReader _reader = _cmd.ExecuteReader();

        // Parse records, build lines list
        List <LineItem_AS3> _lines = new List <LineItem_AS3>();

        while (_reader.Read())
        {
            LineItem_AS3 _line = CreateLine(_reader);
            if (_line == null)
            {
                Trace.Warn("shop errors", "failed to parse line record");
            }
            else
            {
                _lines.Add(_line);
            }
        }

        return(_lines);
    }
Пример #2
0
    // adds item line to invoice portion
    private void AddItemLine(Table _table, LineItem_AS3 _line)
    {
        TableRow _row = new TableRow();

        InventoryItem_AS3 _item = _line.Item;

        _row.Cells.Add(CreateCell(string.Format("{0}", _item.SKU)));
        _row.Cells.Add(CreateCell(_item.Description));

        _row.Cells.Add(CreateCell(string.Format("{0:c2}", _item.UnitPrice), HorizontalAlign.Right));
        _row.Cells.Add(CreateCell(string.Format("{0}", _line.Quantity), HorizontalAlign.Right));
        _row.Cells.Add(CreateCell(string.Format("{0:f2}", (double)_item.UnitWeight), HorizontalAlign.Right));

        _row.Cells.Add(CreateCell(string.Format("{0:c2}", (double)_item.UnitPrice * _line.Quantity), HorizontalAlign.Right));
        _row.Cells.Add(CreateCell(string.Format("{0:f2}", (double)_item.UnitWeight * _line.Quantity), HorizontalAlign.Right));

        _table.Rows.Add(_row);
    }