Пример #1
0
        public invoiceLineAll GetSingleInvLineData(string _prmInvLineId)
        {
            invoiceLineAll _list = new invoiceLineAll();

            string _query = "SELECT inv_line_id"
                            + ",inv_id"
                            + ",item_desc"
                            + ",item_qty"
                            + ",unit_price"
                            + ",sub_total"
                            + " FROM invoice_line"
                            + " WHERE inv_line_id=" + _prmInvLineId + " LIMIT 1";

            if (this.OpenConnection() == true)
            {
                MySqlCommand cmd = new MySqlCommand(_query, _connection);
                MySqlDataReader dataReader = cmd.ExecuteReader();

                while (dataReader.Read())
                {
                    _list = new invoiceLineAll(dataReader["inv_line_id"].ToString(), dataReader["inv_id"].ToString(), dataReader["item_desc"].ToString(), dataReader["item_qty"].ToString(), dataReader["unit_price"].ToString(), dataReader["sub_total"].ToString());
                }
                dataReader.Close();

            }

            this.CloseConnection();
            return _list;
        }
        private void invline_datagrid_MouseDown(object sender, MouseButtonEventArgs e)
        {
            invoiceLineGrid _invLineGrid = new invoiceLineGrid();
            invoiceLineAll _invLineAll = new invoiceLineAll();

            _invLineGrid = (invoiceLineGrid)this.invline_datagrid.SelectedItem;

            if (_invLineGrid != null)
            {
                _invLineAll = this._invLineController.GetSingleInvLineData(_invLineGrid.inv_line_id);
                this.lineid_txt.Text = _invLineAll.inv_line_id;
                this.linedesc_txt.Text = _invLineAll.item_desc;
                this.lineqty_txt.Text = _invLineAll.item_qty;
                this.unitprice_txt.Text = _invLineAll.unit_price;
                this.subtotal_txt.Text = _invLineAll.sub_total;
            }
        }