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)));
        }
예제 #2
0
        //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;
                }
            }
        }
예제 #3
0
        /// <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);
        }
예제 #4
0
        /// <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);
            }
        }
예제 #5
0
 //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());
     }
 }
예제 #6
0
파일: Service.cs 프로젝트: Emtey/BootCamp
    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);
        }
    }
예제 #7
0
        //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));
        }