Example #1
0
        private void queryBtn_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(batchInfoTextBox.Text))
            {
                using (var db = JunShengDb.Create())
                {
                    var batchInfos = JunShengDb.QueryBatchInfosByBatch(db, batchInfoTextBox.Text).ToArray();
                    if (batchInfos.Length > 0)
                    {
                        var dataTable = new DataTable();
                        var ccc       = new DataColumn(nameof(BatchItem.BatchNo));
                        dataTable.Columns.Add(new DataColumn(nameof(BatchItem.BatchNo)));
                        dataTable.Columns.Add(new DataColumn(nameof(BatchItem.SerinalNo)));
                        dataTable.Columns.Add(new DataColumn(nameof(BatchItem.QRCodeContent)));

                        foreach (var info in batchInfos)
                        {
                            var row = dataTable.NewRow();
                            row[nameof(BatchItem.BatchNo)]       = info.BatchNo;
                            row[nameof(BatchItem.SerinalNo)]     = info.SerinalNo;
                            row[nameof(BatchItem.QRCodeContent)] = info.QRCodeContent;
                            dataTable.Rows.Add(row);
                        }

                        dataGridView1.DataSource = dataTable;
                        dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);
                    }
                }
            }
        }
Example #2
0
 private AppContext()
 {
     DB = JunShengDb.Create();
 }