/// <summary> /// This method finds a 'Address' object. /// This method uses the 'Address_Find' procedure. /// </summary> /// <returns>A 'Address' object.</returns> /// </summary> public Address FindAddress(FindAddressStoredProcedure findAddressProc, DataConnector databaseConnector) { // Initial Value Address address = null; // Verify database connection is connected if ((databaseConnector != null) && (databaseConnector.Connected)) { // First Get Dataset DataSet addressDataSet = this.DataHelper.LoadDataSet(findAddressProc, databaseConnector); // Verify DataSet Exists if (addressDataSet != null) { // Get DataTable From DataSet DataRow row = this.DataHelper.ReturnFirstRow(addressDataSet); // if row exists if (row != null) { // Load Address address = AddressReader.Load(row); } } } // return value return(address); }
/// <summary> /// This method finds a 'Address' object. /// </summary> /// <param name='List<PolymorphicObject>'>The 'Address' to delete. /// <returns>A PolymorphicObject object with a Boolean value. internal PolymorphicObject FindAddress(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // locals Address address = null; // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Create Find StoredProcedure FindAddressStoredProcedure findAddressProc = null; // verify the first parameters is a 'Address'. if (parameters[0].ObjectValue as Address != null) { // Get AddressParameter Address paramAddress = (Address)parameters[0].ObjectValue; // verify paramAddress exists if (paramAddress != null) { // Now create findAddressProc from AddressWriter // The DataWriter converts the 'Address' // to the SqlParameter[] array needed to find a 'Address'. findAddressProc = AddressWriter.CreateFindAddressStoredProcedure(paramAddress); } // Verify findAddressProc exists if (findAddressProc != null) { // Execute Find Stored Procedure address = this.DataManager.AddressManager.FindAddress(findAddressProc, dataConnector); // if dataObject exists if (address != null) { // set returnObject.ObjectValue returnObject.ObjectValue = address; } } } else { // Raise Error Data Connection Not Available throw new Exception("The database connection is not available."); } } // return value return(returnObject); }
/// <summary> /// This method creates an instance of a /// 'FindAddressStoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'Address_Find'. /// </summary> /// <param name="address">The 'Address' to use to /// get the primary key parameter.</param> /// <returns>An instance of an FetchUserStoredProcedure</returns> public static FindAddressStoredProcedure CreateFindAddressStoredProcedure(Address address) { // Initial Value FindAddressStoredProcedure findAddressStoredProcedure = null; // verify address exists if (address != null) { // Instanciate findAddressStoredProcedure findAddressStoredProcedure = new FindAddressStoredProcedure(); // Now create parameters for this procedure findAddressStoredProcedure.Parameters = CreatePrimaryKeyParameter(address); } // return value return(findAddressStoredProcedure); }