コード例 #1
0
        public virtual PhotoClubsRecord GetRecord()

        {
            if (this.DataSource != null)
            {
                return(this.DataSource);
            }

            if (this.RecordUniqueId != null)
            {
                return(PhotoClubsTable.GetRecord(this.RecordUniqueId, true));
            }

            // Localization.

            throw new Exception(Page.GetResourceValue("Err:RetrieveRec", "OLR"));
        }
コード例 #2
0
        public virtual void LoadData()
        {
            // Load the data from the database into the DataSource DatabaseOLR_db%dbo.PhotoClubs record.
            // It is better to make changes to functions called by LoadData such as
            // CreateWhereClause, rather than making changes here.


            // The RecordUniqueId is set the first time a record is loaded, and is
            // used during a PostBack to load the record.
            if (this.RecordUniqueId != null && this.RecordUniqueId.Length > 0)
            {
                this.DataSource = PhotoClubsTable.GetRecord(this.RecordUniqueId, true);

                return;
            }

            // This is the first time a record is being retrieved from the database.
            // So create a Where Clause based on the staic Where clause specified
            // on the Query wizard and the dynamic part specified by the end user
            // on the search and filter controls (if any).

            WhereClause wc = this.CreateWhereClause();

            // If there is no Where clause, then simply create a new, blank record.

            if (wc == null || !(wc.RunQuery))
            {
                this.DataSource = new PhotoClubsRecord();

                return;
            }

            // Retrieve the record from the database.  It is possible
            PhotoClubsRecord[] recList = PhotoClubsTable.GetRecords(wc, null, 0, 2);
            if (recList.Length == 0)
            {
                // There is no data for this Where clause.
                wc.RunQuery = false;

                return;
            }

            // Set DataSource based on record retrieved from the database.
            this.DataSource = (PhotoClubsRecord)PhotoClubsRecord.Copy(recList[0], false);
        }