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