/// <summary> /// This method finds a 'ToDo' object. /// This method uses the 'ToDo_Find' procedure. /// </summary> /// <returns>A 'ToDo' object.</returns> /// </summary> public ToDo FindToDo(FindToDoStoredProcedure findToDoProc, DataConnector databaseConnector) { // Initial Value ToDo toDo = null; // Verify database connection is connected if ((databaseConnector != null) && (databaseConnector.Connected)) { // First Get Dataset DataSet toDoDataSet = this.DataHelper.LoadDataSet(findToDoProc, databaseConnector); // Verify DataSet Exists if (toDoDataSet != null) { // Get DataTable From DataSet DataRow row = this.DataHelper.ReturnFirstRow(toDoDataSet); // if row exists if (row != null) { // Load ToDo toDo = ToDoReader.Load(row); } } } // return value return(toDo); }
/// <summary> /// This method finds a 'ToDo' object. /// </summary> /// <param name='List<PolymorphicObject>'>The 'ToDo' to delete. /// <returns>A PolymorphicObject object with a Boolean value. internal PolymorphicObject FindToDo(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // locals ToDo toDo = null; // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Create Find StoredProcedure FindToDoStoredProcedure findToDoProc = null; // verify the first parameters is a 'ToDo'. if (parameters[0].ObjectValue as ToDo != null) { // Get ToDoParameter ToDo paramToDo = (ToDo)parameters[0].ObjectValue; // verify paramToDo exists if (paramToDo != null) { // Now create findToDoProc from ToDoWriter // The DataWriter converts the 'ToDo' // to the SqlParameter[] array needed to find a 'ToDo'. findToDoProc = ToDoWriter.CreateFindToDoStoredProcedure(paramToDo); } // Verify findToDoProc exists if (findToDoProc != null) { // Execute Find Stored Procedure toDo = this.DataManager.ToDoManager.FindToDo(findToDoProc, dataConnector); // if dataObject exists if (toDo != null) { // set returnObject.ObjectValue returnObject.ObjectValue = toDo; } } } 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 /// 'FindToDoStoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'ToDo_Find'. /// </summary> /// <param name="toDo">The 'ToDo' to use to /// get the primary key parameter.</param> /// <returns>An instance of an FetchUserStoredProcedure</returns> public static FindToDoStoredProcedure CreateFindToDoStoredProcedure(ToDo toDo) { // Initial Value FindToDoStoredProcedure findToDoStoredProcedure = null; // verify toDo exists if (toDo != null) { // Instanciate findToDoStoredProcedure findToDoStoredProcedure = new FindToDoStoredProcedure(); // Now create parameters for this procedure findToDoStoredProcedure.Parameters = CreatePrimaryKeyParameter(toDo); } // return value return(findToDoStoredProcedure); }