public void DeleteTest()
 {
     VerifyExists();
     long id = Appraisers.GetId(_databasePath, _appraisersName, out _errOut);
     bool value = Appraisers.Delete(_databasePath, id, out _errOut);
     General.HasTrueValue(value, _errOut);
 }
 public void EditTest()
 {
     VerifyExists();
     long id = Appraisers.GetId(_databasePath, _appraisersName, out _errOut);
     bool value = Appraisers.Update(_databasePath, id, _appraisersName, "222 here", "N/A", "myCity", "ky", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", "N/A", true, out _errOut);
     General.HasTrueValue(value, _errOut);
 }
 /// <summary>
 /// Verifies the exists.
 /// </summary>
 private void VerifyExists()
 {
     if (!Appraisers.Exists(_databasePath, _appraisersName, out _errOut))
     {
         bool value = Appraisers.Add(_databasePath, _appraisersName, out _errOut);
     }
 }
 public void GetTest()
 {
     VerifyExists();
     List<AppraisersContactDetails> value = Appraisers.Get(_databasePath, out _errOut);
     PrintList(value);
     General.HasTrueValue(value.Count > 0, _errOut);
 }
 public void GetIdTest()
 {
     VerifyExists();
     long value = Appraisers.GetId(_databasePath, _appraisersName, out _errOut);
     TestContext.WriteLine($"Id: {value}");
     General.HasTrueValue(value > 0, _errOut);
 }
Example #6
0
        /// <summary>
        /// The object factory for a particular data collection instance.
        /// </summary>
        public virtual void CreateObjectsFromData(Appraisers appraisers, System.Data.DataSet data)
        {
            // Do nothing if we have nothing
            if (data == null || data.Tables.Count == 0 || data.Tables[0].Rows.Count == 0)
            {
                return;
            }


            // Create a local variable for the new instance.
            Appraiser newobj = null;

            // Create a local variable for the data row instance.
            System.Data.DataRow dr = null;


            // Iterate through the table rows
            for (int i = 0; i < data.Tables[0].Rows.Count; i++)
            {
                // Get a reference to the data row
                dr = data.Tables[0].Rows[i];
                // Create a new object instance
                newobj = System.Activator.CreateInstance(appraisers.ContainsType[0]) as Appraiser;
                // Let the instance set its own members
                newobj.SetMembers(ref dr);
                // Add the new object to the collection instance
                appraisers.Add(newobj);
            }
        }
Example #7
0
        /// <summary>
        /// Fill method for populating an entire collection of Appraisers
        /// </summary>
        public virtual void Fill(Appraisers appraisers)
        {
            // create the connection to use
            SqlConnection cnn = new SqlConnection(Appraiser.GetConnectionString());


            try
            {
                using (cnn)
                {
                    // open the connection
                    cnn.Open();


                    // create an instance of the reader to fill.
                    SqlDataReader datareader = SqlHelper.ExecuteReader(cnn, "gsp_SelectAppraisers");


                    // Send the collection and data to the object factory
                    CreateObjectsFromData(appraisers, datareader);


                    // close the connection
                    cnn.Close();
                }


                // nullify the connection
                cnn = null;
            }
            catch (SqlException sqlex)
            {
                throw sqlex;
            }
        }
 /// <summary>
 /// Verifies the doesnt exist.
 /// </summary>
 private void VerifyDoesntExist()
 {
     if (Appraisers.Exists(_databasePath, _appraisersName, out _errOut))
     {
         long id = Appraisers.GetId(_databasePath, _appraisersName, out _errOut);
         bool value = Appraisers.Delete(_databasePath, id, out _errOut);
     }
 }
 public void GetNameTest()
 {
     VerifyExists();
     long id = Appraisers.GetId(_databasePath, _appraisersName, out _errOut);
     string value = Appraisers.GetName(_databasePath, id, out _errOut);
     TestContext.WriteLine($"Name: {value}");
     General.HasValue(value, _errOut);
 }
Example #10
0
        public void NameTest()
        {
            AutoCompleteStringCollection value = Appraisers.Name(_databasePath, out _errOut);

            foreach (var a in value)
            {
                TestContext.WriteLine(a.ToString());
            }
            General.HasTrueValue(value.Count > 0, _errOut);
        }
Example #11
0
        /// <summary>
        /// Gets all the available objects.
        /// </summary>
        public virtual Appraisers GetAll()
        {
            // create a new instance of the return object
            Appraisers objects = new Appraisers();


            // fill the objects
            this.Fill(objects);


            // return the filled object from the service
            return(objects);
        }
Example #12
0
        /// <summary>
        /// The object factory for a particular data collection instance.
        /// </summary>
        public virtual void CreateObjectsFromData(Appraisers appraisers, System.Data.SqlClient.SqlDataReader data)
        {
            // Do nothing if we have nothing
            if (data == null)
            {
                return;
            }


            // Create a local variable for the new instance.
            Appraiser newobj = null;

            // Iterate through the data reader
            while (data.Read())
            {
                // Create a new object instance
                newobj = System.Activator.CreateInstance(appraisers.ContainsType[0]) as Appraiser;
                // Let the instance set its own members
                newobj.SetMembers(ref data);
                // Add the new object to the collection instance
                appraisers.Add(newobj);
            }
        }
 public void AddQuickTest()
 {
     VerifyDoesntExist();
     bool value = Appraisers.Add(_databasePath, _appraisersName, out _errOut);
     General.HasTrueValue(value, _errOut);
 }