public ProtobufDataProvider([NotNull] string databaseName, [NotNull] string filePath) { Assert.ArgumentNotNullOrEmpty(databaseName, nameof(databaseName)); Assert.ArgumentNotNullOrEmpty(filePath, nameof(filePath)); DataSet = new ItemsDataSet(new FileInfo(MainUtil.MapPath(filePath))); }
//Call this method to refresh the DataGridView. private void GridRefresh(short memberID) { if (!RowCheckIn) { try { ItemsDataSet myItems = myDb.GetItems(memberID); itemsBindingSource.DataSource = myItems; if (myItems.Tables[0].Rows.Count > 3 || isExpired) { checkOutToolStripMenuItem.Enabled = false; } else { checkOutToolStripMenuItem.Enabled = true; } } catch (LibraryException) { string myErr = string.Format("Error on grid refresh."); tsslLabel.Text = myErr; txtMemberID.Focus(); return; } } }
/// <summary> /// Retrieves items. /// </summary> /// <param name="memberNumber">Member ID</param> /// <returns>Items Data Set</returns> public ItemsDataSet GetItems(Int16 memberNumber) { ItemsTableAdapter ita = new ItemsTableAdapter(); ItemsDataSet ids = new ItemsDataSet(); ita.Fill(ids.Items, memberNumber); return(ids); }
/// <summary> /// Gets the items (books) that are checked out to a member. /// </summary> /// <param name="memberNumber">The Member's ID</param> /// <returns>Listing of Items</returns> public ItemsDataSet GetItems(short memberNumber) { ItemsDataSet myDataSet = new ItemsDataSet(); try { myDataSet = myAccess.GetItems(memberNumber); return(myDataSet); } catch (LibraryException) { throw new LibraryException(ErrorCode.None); } }
//Item Data private void ItemData() { try { EclipsePOS.WPF.SystemManager.Data.ItemsDataSet itemDataSet = new ItemsDataSet(); EclipsePOS.WPF.SystemManager.Data.ItemsDataSetTableAdapters.itemTableAdapter itemTableAdapter = new EclipsePOS.WPF.SystemManager.Data.ItemsDataSetTableAdapters.itemTableAdapter(); itemTableAdapter.Fill(itemDataSet.item); itemDataSet.WriteXml(View.OutputFolderPath() + "\\Item.xml", XmlWriteMode.WriteSchema); } catch (Exception e) { //Microsoft.Windows.Controls.MessageBox.Show(e.ToString()); } }
public ItemsDataSet GetItems(short memberNumber) { ItemsDataSet myDataSet = new ItemsDataSet(); DBInteraction myDb = new DBInteraction(); try { myDataSet = myDb.GetItems(memberNumber); return(myDataSet); } catch (LibraryException ex) { throw new SoapException(ex.Message, ExceptionCodes.None); } }
//Item private void ItemData() { try { EclipsePOS.WPF.SystemManager.Data.ItemsDataSet itemDataSetXml = new ItemsDataSet(); itemDataSetXml.ReadXml(View.InputFolderPath() + "\\Item.xml", XmlReadMode.ReadSchema); EclipsePOS.WPF.SystemManager.Data.ItemsDataSet itemDataSetRDB = new ItemsDataSet(); EclipsePOS.WPF.SystemManager.Data.ItemsDataSetTableAdapters.itemTableAdapter itemTableAdapter = new EclipsePOS.WPF.SystemManager.Data.ItemsDataSetTableAdapters.itemTableAdapter(); itemTableAdapter.Fill(itemDataSetRDB.item); itemDataSetRDB.Merge(itemDataSetXml); itemTableAdapter.Update(itemDataSetRDB); } catch (Exception e) { //Microsoft.Windows.Controls.MessageBox.Show(e.ToString()); return; } }
public void TestRead() { // arrange var db = "core"; // act { var definitions = Resource.GetStream($"{db}.definitions.dat"); GC.Collect(); var mem = Process.GetCurrentProcess().PrivateMemorySize64; var dataSet = new ItemsDataSet(definitions); Console.WriteLine((Process.GetCurrentProcess().PrivateMemorySize64 - mem) / 1024 / 1024 + "MB"); // assert Assert.IsNotNull(dataSet); Assert.AreEqual(22418, dataSet.Definitions.Count); // SELECT COUNT(*) AS B FROM [dbo].[Items] // 22418 for core, 4633 for master Assert.AreEqual(4450, dataSet.Children.Count); // SELECT COUNT(A.B) FROM (SELECT [ParentID] AS B FROM [dbo].[Items] GROUP BY [ParentID]) AS A // 4450 for core, 1389 for master } GC.Collect(); // act and assert performance var sw = new Stopwatch(); var repeat = 1; for (var i = 0; i < repeat; ++i) { var definitions = Resource.GetStream($"{db}.definitions.dat"); sw.Start(); ItemsDataSet.OpenRead(definitions); sw.Stop(); } Console.WriteLine(new TimeSpan(sw.Elapsed.Ticks / repeat)); }