Ejemplo n.º 1
0
            /// <summary>
            /// Moves the gun smiths.
            /// </summary>
            /// <param name="databasePath">The database path.</param>
            /// <param name="errOut">The error out.</param>
            /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
            /// <exception cref="System.Exception"></exception>
            /// <exception cref="System.Exception"></exception>
            internal static bool MoveGunSmiths(string databasePath, out string errOut)
            {
                errOut = "";
                bool   bAns = false;
                string sql  = "";

                try
                {
                    List <GunSmithWorkDone> lst = GunSmithDetails.Lists(databasePath, out errOut, true);
                    if (errOut.Length > 0)
                    {
                        throw new Exception(errOut);
                    }
                    BSOtherObjects obj = new BSOtherObjects();
                    foreach (GunSmithWorkDone l in lst)
                    {
                        string name = obj.FC(l.GunSmithName);
                        if (!ValueDoesExist(databasePath, "GunSmith_Contact_Details", "gName", name, out errOut))
                        {
                            if (!PeopleAndPlaces.GunSmiths.Add(databasePath, name, out errOut))
                            {
                                throw new Exception(errOut);
                            }
                        }
                    }
                    bAns = true;
                }
                catch (Exception e)
                {
                    errOut = $"{ErrorMessage("MoveGunSmiths", e)}.  {Environment.NewLine} {Environment.NewLine}SQL - {sql}";
                }
                return(bAns);
            }
        public void GetIdTest()
        {
            VerifyExists();
            long gsid = MGC.PeopleAndPlaces.GunSmiths.GetId(_databasePath, _gunSmithName, out _errOut);
            long id   = GunSmithDetails.GetId(_databasePath, _gunId, gsid, _gunDetailsOrderDetails, out _errOut);

            General.HasTrueValue(id > 0, _errOut);
        }
        public void ExistsTest()
        {
            VerifyExists();
            bool value = GunSmithDetails.Exists(_databasePath, _gunId, _gunSmithName, _gunDetailsOrderDetails,
                                                out _errOut);

            General.HasTrueValue(value, _errOut);
        }
        public void ListByGunTest()
        {
            VerifyExists();
            List <GunSmithWorkDone> value = GunSmithDetails.Lists(_databasePath, _gunId, out _errOut);

            PrintList(value);

            General.HasTrueValue(value.Count > 0, _errOut);
        }
        public void UpdateTest()
        {
            VerifyExists();
            long gsid  = MGC.PeopleAndPlaces.GunSmiths.GetId(_databasePath, _gunSmithName, out _errOut);
            long id    = GunSmithDetails.GetId(_databasePath, _gunId, gsid, _gunDetailsOrderDetails, out _errOut);
            bool value = GunSmithDetails.Update(_databasePath, id, _gunId, _gunSmithName, gsid, _gunDetailsOrderDetails, $"UPDATED {_gunDetailsNotes}", _gunDetailsStartDate, _gunDetailsReturnDate, out _errOut);

            General.HasTrueValue(value, _errOut);
        }
        public void AddTest()
        {
            VerifyDoesntExist();
            VerifyContactExists();
            long gsid = MGC.PeopleAndPlaces.GunSmiths.GetId(_databasePath, _gunSmithName, out _errOut);

            bool value = GunSmithDetails.Add(_databasePath, _gunId, _gunSmithName, gsid, _gunDetailsOrderDetails, _gunDetailsNotes, _gunDetailsStartDate, _gunDetailsReturnDate, out _errOut);

            General.HasTrueValue(value, _errOut);
        }
 /// <summary>
 /// Verifies the doesnt exist.
 /// </summary>
 private void VerifyDoesntExist()
 {
     if (GunSmithDetails.Exists(_databasePath, _gunId, _gunSmithName, _gunDetailsOrderDetails, out _errOut))
     {
         VerifyContactExists();
         long gsid  = MGC.PeopleAndPlaces.GunSmiths.GetId(_databasePath, _gunSmithName, out _errOut);
         long value = GunSmithDetails.GetId(_databasePath, _gunId, gsid, _gunDetailsOrderDetails, out _errOut);
         GunSmithDetails.Delete(_databasePath, value, out _errOut);
     }
 }
        /// <summary>
        /// Verifies the exists.
        /// </summary>
        private void VerifyExists()
        {
            if (!GunSmithDetails.Exists(_databasePath, _gunId, _gunSmithName, _gunDetailsOrderDetails, out _errOut))
            {
                VerifyContactExists();
                long gsid = MGC.PeopleAndPlaces.GunSmiths.GetId(_databasePath, _gunSmithName, out _errOut);

                GunSmithDetails.Add(_databasePath, _gunId, _gunSmithName, gsid, _gunDetailsOrderDetails, _gunDetailsNotes, _gunDetailsStartDate, _gunDetailsReturnDate, out _errOut);
            }
        }