예제 #1
0
        public void AddFirearm()
        {
            bool value = false;

            try
            {
                VerifyDoesNotExists();

                value = MyCollection.Add(_databasePath, false, 2, _manufacturesId,
                                         _fullName, "G26", _modelId, "RIA2323423", "Pistol: Semi-Auto - SA/DA", "9mm Luger", "black",
                                         "New", " ", _nationalityId, _gripId, "16oz", "4", "plastic", "5 in", " ", " ", "single", "10 round mag",
                                         "iron", "400.00", "billy bob", "500.00", " ", "MSRP", "500.00", "Safe", " ", " ", "1990", " ",
                                         DateTime.Now.ToString(CultureInfo.InvariantCulture), false, " ", "11/09/2021 14:20:45", " ", " ", true, "1-8", "2 lbs", " ", "Modern", "11/09/2021 14:20:45", false, " ", false, false, out _errOut);
                if (_errOut.Length > 0)
                {
                    throw new Exception(_errOut);
                }
                bool exists = MyCollection.Exists(_databasePath, _fullName, out _errOut);
                if (_errOut.Length > 0)
                {
                    throw new Exception(_errOut);
                }
                value = exists;
            }
            catch (Exception e)
            {
                _errOut = e.Message;
            }

            General.HasTrueValue(value, _errOut);
        }
예제 #2
0
 /// <summary>
 /// Verifies the does not exists.
 /// </summary>
 private void VerifyDoesNotExists()
 {
     if (MyCollection.Exists(_databasePath, _fullName, out _errOut))
     {
         long gunId = MyCollection.GetId(_databasePath, _fullName, out _errOut);
         MyCollection.Delete(_databasePath, gunId, out _errOut);
     }
 }
예제 #3
0
 /// <summary>
 /// Verifies the exists.
 /// </summary>
 private void VerifyExists()
 {
     if (!MyCollection.Exists(_databasePath, _fullName, out _errOut))
     {
         MyCollection.Add(_databasePath, false, 2, _manufacturesId,
                          _fullName, "G26", _modelId, _serialNumber, "Pistol: Semi-Auto - SA/DA", "9mm Luger", "black",
                          "New", " ", _nationalityId, _gripId, "16oz", "4", "plastic", "5 in", " ", " ", "single", "10 round mag",
                          "iron", "400.00", "billy bob", "500.00", " ", "MSRP", "500.00", "Safe", " ", " ", "1990", " ",
                          DateTime.Now.ToString(CultureInfo.InvariantCulture), false, " ", "11/09/2021 14:20:45", " ", " ",
                          true, "1-8", "2 lbs", " ", "Modern", "11/09/2021 14:20:45", false, " ", false, false, out _errOut);
     }
 }
        public void ImportFileTest()
        {
            bool value = false;

            try
            {
                //string expectedFullName = "Glock G17 Imported unit test";
                string expectedFullName = "Glock G17 Open Class";
                if (MyCollection.Exists(_databasePath, expectedFullName, out _errOut))
                {
                    long gId = MyCollection.GetId(_databasePath, expectedFullName, out _errOut);
                    if (_errOut.Length > 0)
                    {
                        throw new Exception(_errOut);
                    }
                    if (!MyCollection.Delete(_databasePath, gId, out _errOut))
                    {
                        throw new Exception(_errOut);
                    }
                }

                if (!XmlImport.Details(_databasePath, _xmlImportFile, _ownerId, false, out _errOut))
                {
                    throw new Exception(_errOut);
                }
                long gunId = MyCollection.GetLastId(_databasePath, out _errOut);
                if (_errOut.Length > 0)
                {
                    throw new Exception(_errOut);
                }
                if (!XmlImport.Accessories(_databasePath, _xmlImportFile, gunId, out _errOut))
                {
                    throw new Exception(_errOut);
                }
                if (!XmlImport.BarrelConverstionKitDetails(_databasePath, _xmlImportFile, gunId, out _errOut))
                {
                    throw new Exception(_errOut);
                }
                if (!XmlImport.GunSmithDetails(_databasePath, _xmlImportFile, gunId, out _errOut))
                {
                    throw new Exception(_errOut);
                }
                if (!XmlImport.MaintanceDetails(_databasePath, _xmlImportFile, gunId, out _errOut))
                {
                    throw new Exception(_errOut);
                }

                List <GunCollectionList> lst = MyCollection.GetList(_databasePath, gunId, out _errOut);
                if (_errOut.Length > 0)
                {
                    throw new Exception(_errOut);
                }
                MyGunCollectionTest obj = new MyGunCollectionTest();
                obj.PrintList(lst);
                value = true;
            }
            catch (Exception e)
            {
                Console.WriteLine($"ERROR: {e.Message}");
            }
            General.HasTrueValue(value, _errOut);
        }